Process an offsite payment

Payment processing begins when Shopify makes an HTTP call to your payments app. Your app responds with a redirect URL that Shopify uses to redirect the customer to your app's payment page. After the payment is finalized, you need to communicate the result to Shopify using the paymentSessionResolve or paymentSessionReject mutation. After the paymentSessionResolve or paymentSessionReject mutation is called, you can't change the payment state.

The following diagram illustrates how a payment flow works between the payments app and Shopify:

payment processing steps

  1. The customer completes checkout, triggering a request for payment.
  2. Shopify sends a backend request to the payments app, specifying the amount and currency to be charged.
  3. The app responds with an HTTP code 200 (OK) and a redirect URL of a payment page hosted by the Partner's app.
  4. Shopify redirects the customer to the redirect URL.
  5. The payments app collects the customer’s payment credentials and processes the payment as described in the backend request.
  6. The payments app finalizes the payment as resolved, rejected, or pended by calling Shopify's GraphQL API, implementing a retry policy as needed.
  7. Shopify responds with an HTTP code 200 (OK) and the redirect URL to confirm the payment state is updated.
  8. The payments app redirects the customer to Shopify, with an HTTP code 301 (Moved permanently).
  9. The customer continues to checkout.