Skip to main content

GraphQL pre-payment

These mutations are used with the Storefront API to affect the Shop Pay payment request session.


Anchor to Example: ShopPayPaymentRequestSessionCreateExample: ShopPayPaymentRequestSessionCreate

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": []
}
}

Anchor to ShopPayPaymentRequestSessionCreate ArgumentsShopPayPaymentRequestSessionCreate Arguments

ArgumentTypeDescription
sourceIdentifierString!A unique identifier for the source of the order.
paymentRequestShopPayPaymentRequestInput!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.

Anchor to ShopPayPaymentRequestSessionShopPayPaymentRequestSession

FieldTypeDescription
tokenStringThe unique token for the payment request session.
sourceIdentifierStringA unique identifier for the source of the order.
checkoutUrlStringThe URL for the checkout associated with the payment request session.
paymentRequestShopPayPaymentRequestThe payment request associated with the session.

FieldTypeDescription
fieldStringThe field that caused the error.
messageStringThe error message.

Anchor to Example: ShopPayPaymentRequestSessionSubmitExample: ShopPayPaymentRequestSessionSubmit

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": []
}
}

FieldTypeDescription
tokenString!The unique token for the payment request session.
paymentRequestShopPayPaymentRequestInput!The payment request details.
idempotencyKeyString!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.
orderNameStringThe name to be assigned to the order that is created from the payment request.

Anchor to PaymentRequestReceiptPaymentRequestReceipt

FieldTypeDescription
tokenStringThe unique token for the payment request receipt. This will be different than session token.
processingStatusTypeStringThe processing status of the payment request.
paymentRequestShopPayPaymentRequestThe details of the payment request.

FieldTypeDescription
fieldStringThe field that caused the error.
messageStringThe error message.

Was this page helpful?