--- title: GraphQL pre-payment description: Use the Storefront API to create and submit Shop Pay payment request sessions. api_name: commerce-components source_url: html: 'https://shopify.dev/docs/api/commerce-components/pay/graphql-pre-payment' md: 'https://shopify.dev/docs/api/commerce-components/pay/graphql-pre-payment.md' --- # GraphQL pre-payment **Note:** This API is **only available to select merchants and partners** using third-party checkout solutions. For more information, contact [our enterprise sales team](https://www.shopify.com/solutions/shop-pay/enterprise#contact-sales). These mutations are used with the Storefront API to affect the Shop Pay payment request session. *** ## Example: Shop​Pay​Payment​Request​Session​Create Details about the `ShopPayPaymentRequestSessionCreate` mutation can be found on the dedicated Storefront API [ShopPayPaymentRequestSessionCreate](https://shopify.dev/docs/api/storefront/latest/mutations/shopPayPaymentRequestSessionCreate) page. ## Mutation ```graphql mutation shopPayPaymentRequestSessionCreate($sourceIdentifier: String!, $paymentRequest: ShopPayPaymentRequestInput!) { shopPayPaymentRequestSessionCreate(sourceIdentifier: $sourceIdentifier, paymentRequest: $paymentRequest) { shopPayPaymentRequestSession { token sourceIdentifier checkoutUrl paymentRequest { … } } userErrors { field message } } } ``` ## Input ```json { "sourceIdentifier": "xyz123", "paymentRequest": { // … } } ``` ## Response ```json { "shopPayPaymentRequestSessionCreate": { "shopPayPaymentRequestSession": { "sourceIdentifier": "xyz123", "token": "db4eede13822684b13a607823b7ba40d", "checkoutUrl": "https://shop.app/checkout/1/spe/db4eede13822684b13a607823b7ba40d/shoppay", "paymentRequest": { // … } }, "userErrors": [] } } ``` ### Shop​Pay​Payment​Request​Session​Create Arguments | Argument | Type | Description | | - | - | - | | sourceIdentifier | String! | A unique identifier for the source of the order. | | paymentRequest | ShopPayPaymentRequestInput! | The payment request details. | #### Source Identifier The sourceIdentifier must be unique across all orders to ensure accurate tracking and referencing. For instance, it could be a unique ID associated with an order or checkout on your platform. ### Shop​Pay​Payment​Request​Session | Field | Type | Description | | - | - | - | | token | String | The unique token for the payment request session. | | sourceIdentifier | String | A unique identifier for the source of the order. | | checkoutUrl | String | The URL for the checkout associated with the payment request session. | | paymentRequest | ShopPayPaymentRequest | The payment request associated with the session. | ### User​Errors | Field | Type | Description | | - | - | - | | field | String | The field that caused the error. | | message | String | The error message. | *** ## Example: Shop​Pay​Payment​Request​Session​Submit Details about the `ShopPayPaymentRequestSessionSubmit` mutation can be found on the dedicated Storefront API [ShopPayPaymentRequestSessionSubmit](https://shopify.dev/docs/api/storefront/latest/mutations/shopPayPaymentRequestSessionSubmit) page. ## Mutation ```graphql mutation shopPayPaymentRequestSessionSubmit($token: String!, $paymentRequest: ShopPayPaymentRequestInput!, $idempotencyKey: String!, $orderName: String) { shopPayPaymentRequestSessionSubmit(token: $token, paymentRequest: $paymentRequest, idempotencyKey: $idempotencyKey, orderName: $orderName) { paymentRequestReceipt { token processingStatusType } userErrors { field message } } } ``` ## Input ```json { "token": "db4eede13822684b13a607823b7ba40d", "paymentRequest": { … }, "idempotencyKey": "REPLACE_ME_WITH_A_UNIQUE_KEY", } ``` ## Response ```json { "shopPayPaymentRequestSessionSubmit": { "paymentRequestReceipt": { "token": "a607823b7ba40ddb4eede13822684b13", "processingStatusType": "ready" }, "userErrors": [] } } ``` ### Arguments | Field | Type | Description | | - | - | - | | token | String! | The unique token for the payment request session. | | paymentRequest | ShopPayPaymentRequestInput! | The payment request details. | | idempotencyKey | String! | A unique string (typically a UUID or similar identifier) that must be attached to the submit request to ensure that payment transactions occur only once. For more information, see [idempotent requests](https://shopify.dev/docs/api/usage/idempotent-requests). | | orderName | String | The name to be assigned to the order that is created from the payment request. | ### Payment​Request​Receipt | Field | Type | Description | | - | - | - | | token | String | The unique token for the payment request receipt. This will be different than session token. | | processingStatusType | String | The processing status of the payment request. | | paymentRequest | ShopPayPaymentRequest | The details of the payment request. | ### User​Errors | Field | Type | Description | | - | - | - | | field | String | The field that caused the error. | | message | String | The error message. | ***