processPayment

fun processPayment(intent: PaymentIntent, callback: PaymentIntentCallback)

Processes a payment after collecting a payment method succeeds.

=== Synchronous capture ===

Stripe Terminal uses two-step card payments to prevent unintended and duplicate payments. When processPayment completes successfully, a charge has been authorized on the customer's card, but not yet been "captured". Your app must synchronously notify your backend to capture the PaymentIntent in order to settle the funds to your account.

=== Handling failures ===

When processPayment fails, the SDK returns an error that includes the updated PaymentIntent. Your app should inspect the updated PaymentIntent to decide how to retry the payment.

  1. If the updated PaymentIntent is null, the request to Stripe's servers timed out and the PaymentIntent's status is unknown. We recommend that you retry processPayment with the original PaymentIntent. If you instead choose to abandon the original PaymentIntent and create a new one, do not capture the original PaymentIntent. If you do, you might charge your customer twice.

  2. If the updated PaymentIntent's status is still REQUIRES_CONFIRMATION (e.g., the request failed because your app is not connected to the internet), you can call processPayment again with the updated PaymentIntent to retry the request.

  3. If the updated PaymentIntent's status changes to REQUIRES_PAYMENT_METHOD (e.g., the request failed because the card was declined), call collectPaymentMethod with the updated PaymentIntent to try charging another card.

See https://stripe.com/docs/terminal/payments#process.

Parameters

intent

The PaymentIntent that should be processed

callback

The PaymentIntentCallback to be called when processing completes