#Asp-pi-error

1 messages · Page 1 of 1 (latest)

tribal moon
#

Hey! Is there a specific question? The error is pretty descriptive: you're trying to confirm a Payment Intent that has previously been confirmed

(you can't confirm the same PI twice)

crystal widget
#

i only used one time for confirm payment intent

#

STPPaymentHandler.shared().confirmPayment(paymentIntentParams!,
with: self as! STPAuthenticationContext)
{ (handlerStatus, paymentIntent, error) in
switch handlerStatus {

                 case .succeeded:
                    print("sucess")
                    print("error",error)
                    if let paymentIntent = paymentIntent, paymentIntent.status == STPPaymentIntentStatus.requiresConfirmation {
                        print("Re-confirming PaymentIntent after handling action")
                        print(paymentIntent.stripeId)
                   
                    }
                    else {
                       print(paymentIntent?.stripeId)
                 
                    }
                     // Payment succeeded
                     // ...
                    break
                 case .canceled:
                    print("cancel")
                    print("error",error)
          
                    break
                     // Payment canceled
                     // ...
                 case .failed:
                    print("failed")
                    print("error",error)
         
                    break
                     // Payment failed
                     // ...
                 @unknown default:
                     fatalError()
                 }
             }
         // Payment succeeded, show a receipt view
         break
     case .error:
        print("error")
         // Payment failed, show the error
         break
     case .userCancellation:
        print("userCancelled")
         // User cancelled the payment
         break
     @unknown default:
         fatalError()
     }
#

this code i used only one time

tribal moon
#

You must have previously ran this logic for the Payment Intent then

tribal moon
#

If you share the Payment Intent ID I can correlate that

crystal widget
#

Payment intent not for me got failed error

#

Generated only client secret id in my backend side that client secret id i given to this line
STPPaymentHandler.shared().confirmPayment(paymentIntentParams!,
with: self as! STPAuthenticationContext)

#

I got only failed msg

tribal moon
#

Then that client_secret had been used previous to confirm that Payment Intent

crystal widget
#

We are not using this codes before

tribal moon
#

Your backend needs to create a new Payment Intent

#

Or if you can share the Payment Intent ID then I can see what's actually going on

crystal widget
#

Okay i will check with my backend

#

Thanks for your support

tribal moon
#

Sure, np!

crystal widget
#

♥️