tanqoryExtInvoicePaymentStart
- Mutation
- Storefront
Pays the invoice's amount due, with a card vault session through the payments account (sessionId, as cartPaymentUpdate's directPaymentMethod) or an option of paymentOptions (optionId; a gateway account's card option takes sessionId too when its gateway takes the card from the card vault, none when the gateway takes the card itself on its page or in its browser SDK, e.g. 2C2P, Omise, GB Prime Pay; a manual method pays a draft only). attemptToken makes it idempotent: the same token, or a payment already processing, waiting or done for this invoice, answers that attempt again. The answer is the same union as cartCompletionAttempt: Success (the draft's new order, or the order paid), Failed, Processing, or ActionRequired, finished with tanqoryExtCheckoutPaymentAction / tanqoryExtCheckoutPaymentActionComplete and polled with cartCompletionAttempt like a cart's attempt. A gateway sends the buyer back to https://<shop domain>/checkout/invoice/processing?attempt=<attempt id>.
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
kind | TanqoryExtInvoiceKind! | Required | |
id | ID! | Required | |
token | String! | Required | |
attemptToken | String! | Required | |
payment | TanqoryExtInvoicePaymentInput! | Required |
Returns
TanqoryExtInvoicePaymentStartPayload!
| Field | Type | Description |
|---|---|---|
result | CartCompletionAttemptResult | |
userErrors | [CartUserError!]! |
Example request
A starting point: required arguments as variables and a few fields of the result. Replace the placeholders.
Set STORE_ID and TANQORY_STOREFRONT_TOKEN in your environment first (Make your first API call).
curl -X POST "https://$STORE_HOST/api/v1/stores/$STORE_ID/2026-10/graphql" \
-H "X-Tanqory-Storefront-Access-Token: $TANQORY_STOREFRONT_TOKEN" \
-H "Content-Type: application/json" \
--data '{"query":"mutation TanqoryExtInvoicePaymentStart($kind: TanqoryExtInvoiceKind!, $id: ID!, $token: String!, $attemptToken: String!, $payment: TanqoryExtInvoicePaymentInput!) {\n tanqoryExtInvoicePaymentStart(kind: $kind, id: $id, token: $token, attemptToken: $attemptToken, payment: $payment) {\n userErrors {\n code\n field\n message\n }\n }\n}","variables":{"kind":"DRAFT_ORDER","id":"gid://tanqory/Type/id","token":"","attemptToken":"","payment":{"amount":{"amount":"","currencyCode":"USD"}}}}'// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `mutation TanqoryExtInvoicePaymentStart(\$kind: TanqoryExtInvoiceKind!, \$id: ID!, \$token: String!, \$attemptToken: String!, \$payment: TanqoryExtInvoicePaymentInput!) {
tanqoryExtInvoicePaymentStart(kind: \$kind, id: \$id, token: \$token, attemptToken: \$attemptToken, payment: \$payment) {
userErrors {
code
field
message
}
}
}`;
const variables = {
"kind": "DRAFT_ORDER",
"id": "gid://tanqory/Type/id",
"token": "",
"attemptToken": "",
"payment": {
"amount": {
"amount": "",
"currencyCode": "USD"
}
}
};
const res = await fetch(`https://${process.env.STORE_HOST}/api/v1/stores/${process.env.STORE_ID}/2026-10/graphql`, {
method: 'POST',
headers: {
'X-Tanqory-Storefront-Access-Token': process.env.TANQORY_STOREFRONT_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
});
console.log(res.status, JSON.stringify(await res.json(), null, 2));# Python 3, standard library only. Save as request.py and run: python3 request.py
import json, os, urllib.request
query = """mutation TanqoryExtInvoicePaymentStart($kind: TanqoryExtInvoiceKind!, $id: ID!, $token: String!, $attemptToken: String!, $payment: TanqoryExtInvoicePaymentInput!) {
tanqoryExtInvoicePaymentStart(kind: $kind, id: $id, token: $token, attemptToken: $attemptToken, payment: $payment) {
userErrors {
code
field
message
}
}
}"""
variables = json.loads("""{
"kind": "DRAFT_ORDER",
"id": "gid://tanqory/Type/id",
"token": "",
"attemptToken": "",
"payment": {
"amount": {
"amount": "",
"currencyCode": "USD"
}
}
}""")
req = urllib.request.Request(
"https://" + os.environ["STORE_HOST"] + "/api/v1/stores/" + os.environ["STORE_ID"] + "/2026-10/graphql",
data=json.dumps({"query": query, "variables": variables}).encode(),
headers={
"X-Tanqory-Storefront-Access-Token": os.environ["TANQORY_STOREFRONT_TOKEN"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.status, json.dumps(json.load(res), indent=2))