GraphQL pre-payment
These mutations are used with the Storefront API to affect the Shop Pay payment request session.
Details about the ShopPayPaymentRequestSessionCreate mutation can be found on the dedicated Storefront API ShopPayPaymentRequestSessionCreate page.
Mutation
mutation shopPayPaymentRequestSessionCreate($sourceIdentifier: String!, $paymentRequest: ShopPayPaymentRequestInput!) {
shopPayPaymentRequestSessionCreate(sourceIdentifier: $sourceIdentifier, paymentRequest: $paymentRequest) {
shopPayPaymentRequestSession {
token
sourceIdentifier
checkoutUrl
paymentRequest {
…
}
}
userErrors {
field
message
}
}
}
Input
{
"sourceIdentifier": "xyz123",
"paymentRequest": {
// …
}
}
Response
{
"shopPayPaymentRequestSessionCreate": {
"shopPayPaymentRequestSession": {
"sourceIdentifier": "xyz123",
"token": "db4eede13822684b13a607823b7ba40d",
"checkoutUrl": "https://shop.app/checkout/1/spe/db4eede13822684b13a607823b7ba40d/shoppay",
"paymentRequest": {
// …
}
},
"userErrors": []
}
}
| 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.| 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. |
Anchor to UserErrorsUser Errors
| Field | Type | Description |
|---|---|---|
| field | String | The field that caused the error. |
| message | String | The error message. |
Details about the ShopPayPaymentRequestSessionSubmit mutation can be found on the dedicated Storefront API ShopPayPaymentRequestSessionSubmit page.
Mutation
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
{
"token": "db4eede13822684b13a607823b7ba40d",
"paymentRequest": {
…
},
"idempotencyKey": "REPLACE_ME_WITH_A_UNIQUE_KEY",
}
Response
{
"shopPayPaymentRequestSessionSubmit": {
"paymentRequestReceipt": {
"token": "a607823b7ba40ddb4eede13822684b13",
"processingStatusType": "ready"
},
"userErrors": []
}
}
Anchor to ArgumentsArguments
| 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. |
| orderName | String | The name to be assigned to the order that is created from the payment request. |
| 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. |
Anchor to UserErrorsUser Errors
| Field | Type | Description |
|---|---|---|
| field | String | The field that caused the error. |
| message | String | The error message. |
Was this page helpful?