Skip to main content

Pay For Presale with Stripe Saved Card

The payStripeForPreSaleWithSavedCard mutation allows a user to pay for a presale order using a saved card with Stripe.

Mutation: payStripeForPreSaleWithSavedCard

Schema:

payStripeForPreSaleWithSavedCard(
id: Int,
presaleId: Int!,
orderId: Int!,
amount: Float!,
fiatAmount: Float!,
fiatType: String!,
cardId: Int!,
paymentIntentId: String!
): PayResponse

Parameters

  • id (Int): The payment ID. This is null for the first call.
  • presaleId (Int): The ID of the presale. This field is mandatory.
  • orderId (Int): The ID of the order to pay for. This field is mandatory.
  • amount (Float): The amount to pay. This field is mandatory.
  • fiatAmount (Float): The amount to pay in the specified currency. This field is mandatory.
  • fiatType (String): The currency type to pay in. This field is mandatory.
  • cardId (Int): The ID of the saved card to use for the payment. This field is mandatory.
  • paymentIntentId (String): The payment intent ID from Stripe. This field is mandatory.

Return

The mutation returns a PayResponse object.

Example Mutation

The following is an example of how to use the payStripeForPreSaleWithSavedCard mutation to pay for a presale order using a saved card with Stripe:

mutation {
payStripeForPreSaleWithSavedCard(
id: null,
presaleId: 1,
orderId: 123,
amount: 500.0,
fiatAmount: 500.0,
fiatType: "USD",
cardId: 456,
paymentIntentId: "pi_1Fxxxxx"
) {
clientSecret,
paymentIntentId,
requiresAction,
error
}
}

Note

  • This mutation is similar to payStripeForPreSale but uses cardId instead of paymentMethodId and omits the isSavedCard flag.

In this example, the mutation initiates a payment for the presale order with ID 123 in the presale with ID 1. The amount to pay is 500.0 in USD. The cardId is used to specify the saved card, and the paymentIntentId is obtained from Stripe. The return value includes the PayResponse details such as clientSecret, paymentIntentId, requiresAction, and error.