Bulky icon indicating copy to clipboard operation
Bulky copied to clipboard

"Stripe.StripeException: One of the following params should be provided for this request payment_intent or charge"

Open oneline opened this issue 2 years ago • 6 comments

CancelOrder Any One Help ... when I Refunding on CancelOrder, Occur this error "Stripe.StripeException: One of the following params should be provided for this request payment_intent or charge"

oneline avatar Sep 23 '22 15:09 oneline

Hello, I do show the fix in the next video.

bhrugen avatar Sep 23 '22 15:09 bhrugen

Hello, I do show the fix in the next video.

Ok Sir..... Thank you for your prompt response.

oneline avatar Sep 27 '22 13:09 oneline

Sir please help this problem .. I can't solve this issue Untitled

oneline avatar Oct 01 '22 16:10 oneline

Hello, everyone.

I have found a fix. The whole thing works if we use UpdateStripePaymentId() method inside public IActionResult OrderConfirmation(int id) method. Due to the latest Stripe update, A PaymentIntent is no longer created during Checkout Session creation in payment mode. Instead, aPaymentIntentwill be created when the Session is confirmed.

This is my method :

public IActionResult OrderConfirmation(int id)

        {
            OrderHeader orderHeader = _db.OrderHeader.GetFirstorDefault(u => u.Id == id);
            if (orderHeader.PaymentStatus != SD.PaymentStatusDelayedPayment)
            {
                //if condition checks if the user is a company user. If hes is not then this block will execute.

                var service = new SessionService();
                Session session = service.Get(orderHeader.SessionId);

                
                
                if (session.PaymentStatus.ToLower() == "paid")
                {
                    _db.OrderHeader.UpdateStripePaymentId(orderHeader.Id, session.Id, session.PaymentIntentId);
                    _db.OrderHeader.UpdateStatus(id, SD.StatusApproved, SD.PaymentStatusApproved);
                    _db.Save();
                }

               

            }
            List<ShoppingCart> shoppingCarts = _db.ShoppingCart.GetAll(u=>u.ApplicationUserId==orderHeader.ApplicationUserId).ToList();

            _db.ShoppingCart.RemoveRange(shoppingCarts);
            _db.Save();
            return View(id);
        }

Tahmeed-Asaad avatar Oct 05 '22 22:10 Tahmeed-Asaad

This is Not working ....

On Thu, Oct 6, 2022, 3:38 AM Tahmeed Asaad @.***> wrote:

Hello, everyone.

I have found a fix. The whole thing works if we use UpdateStripePaymentId() method inside public IActionResult OrderConfirmation(int id) method. Due to the latest Stripe update, A PaymentIntent is no longer created during Checkout Session creation in payment mode. Instead, aPaymentIntentwill be created when the Session is confirmed.

This is my method :

`public IActionResult OrderConfirmation(int id)

{
    OrderHeader orderHeader = _db.OrderHeader.GetFirstorDefault(u => u.Id == id);
    if (orderHeader.PaymentStatus != SD.PaymentStatusDelayedPayment)
    {
        //if condition checks if the user is a company user. If hes is not then this block will execute.

        var service = new SessionService();
        Session session = service.Get(orderHeader.SessionId);



        if (session.PaymentStatus.ToLower() == "paid")
        {
            _db.OrderHeader.UpdateStripePaymentId(orderHeader.Id, session.Id, session.PaymentIntentId);
            _db.OrderHeader.UpdateStatus(id, SD.StatusApproved, SD.PaymentStatusApproved);
            _db.Save();
        }



    }
    List<ShoppingCart> shoppingCarts = _db.ShoppingCart.GetAll(u=>u.ApplicationUserId==orderHeader.ApplicationUserId).ToList();

    _db.ShoppingCart.RemoveRange(shoppingCarts);
    _db.Save();
    return View(id);
}`

— Reply to this email directly, view it on GitHub https://github.com/bhrugen/Bulky/issues/8#issuecomment-1269031366, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALV27SYACJJUEXXGB3ILY7DWBX34XANCNFSM6AAAAAAQUCM6OU . You are receiving this because you authored the thread.Message ID: @.***>

oneline avatar Oct 13 '22 08:10 oneline

how can i fixed it ? please tell me.

IMRAN-5740 avatar Aug 15 '23 05:08 IMRAN-5740