Before submitting your cart, you can use the cartCreatePaymentIntent mutation. This payment intent tracks the total amount that needs to be paid. It will be updated when the user adds or removes products or when shipping methods are updated. The payment can be completed using Apple Pay, Google Pay, or the Stripe Link UI.

After creating the payment intent, the response provides the updated Cart with the associated payment intent details.

mutation CreatePaymentIntent($id: ID!) {
  cartCreatePaymentIntent(id: $id) {
    id
    paymentIntent {
      id
      clientSecret
      externalId
    }
    # Other fields of the Cart type can be queried here
  }
}

Input Parameters for cartCreatePaymentIntent

  • id: The ID of the cart for which you want to create a payment intent.

Example:

{
  "id": "cart_ZMe6Bb4GqqUe3BWV"
}

Types

Cart

  • Contains details about the cart, including items, addresses, payment intent details, and other relevant information. You can refer to the Cart type in the schema for a complete list of fields and their descriptions.

PaymentIntent

  • Contains details about the payment intent:
  • id: The unique identifier for the payment intent.
  • clientSecret: A secret string used to complete the payment on the client side.
  • externalId: An external identifier for the payment intent, typically provided by the payment gateway.

You can refer to the PaymentIntent type in the schema for more details.