Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation TransactionCreate($input: OrderCaptureInput!) { orderCapture(input: $input) { transaction { accountNumber amountSet { presentmentMoney { amount currencyCode } shopMoney { amount currencyCode } } authorizationCode authorizationExpiresAt createdAt errorCode fees { amount { amount currencyCode } } formattedGateway gateway id kind manuallyCapturable maximumRefundableV2 { amount currencyCode } multiCapturable order { id } parentTransaction { id } paymentDetails { ... on CardPaymentDetails { paymentMethodName } ... on ShopPayInstallmentsPaymentDetails { paymentMethodName } } paymentIcon { url } paymentId processedAt receiptJson settlementCurrency shopifyPaymentsSet { refundSet { acquirerReferenceNumber } } status test totalUnsettledSet { presentmentMoney { amount currencyCode } shopMoney { amount currencyCode } } user { id } } userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Order/431501862\",\n \"parentTransactionId\": \"gid://shopify/OrderTransaction/336526656\",\n \"amount\": \"1000.00\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation TransactionCreate($input: OrderCaptureInput!) {\n orderCapture(input: $input) {\n transaction {\n accountNumber\n amountSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n authorizationCode\n authorizationExpiresAt\n createdAt\n errorCode\n fees {\n amount {\n amount\n currencyCode\n }\n }\n formattedGateway\n gateway\n id\n kind\n manuallyCapturable\n maximumRefundableV2 {\n amount\n currencyCode\n }\n multiCapturable\n order {\n id\n }\n parentTransaction {\n id\n }\n paymentDetails {\n ... on CardPaymentDetails {\n paymentMethodName\n }\n ... on ShopPayInstallmentsPaymentDetails {\n paymentMethodName\n }\n }\n paymentIcon {\n url\n }\n paymentId\n processedAt\n receiptJson\n settlementCurrency\n shopifyPaymentsSet {\n refundSet {\n acquirerReferenceNumber\n }\n }\n status\n test\n totalUnsettledSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n user {\n id\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Order/431501862\",\n \"parentTransactionId\": \"gid://shopify/OrderTransaction/336526656\",\n \"amount\": \"1000.00\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation TransactionCreate($input: OrderCaptureInput!) {\n orderCapture(input: $input) {\n transaction {\n accountNumber\n amountSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n authorizationCode\n authorizationExpiresAt\n createdAt\n errorCode\n fees {\n amount {\n amount\n currencyCode\n }\n }\n formattedGateway\n gateway\n id\n kind\n manuallyCapturable\n maximumRefundableV2 {\n amount\n currencyCode\n }\n multiCapturable\n order {\n id\n }\n parentTransaction {\n id\n }\n paymentDetails {\n ... on CardPaymentDetails {\n paymentMethodName\n }\n ... on ShopPayInstallmentsPaymentDetails {\n paymentMethodName\n }\n }\n paymentIcon {\n url\n }\n paymentId\n processedAt\n receiptJson\n settlementCurrency\n shopifyPaymentsSet {\n refundSet {\n acquirerReferenceNumber\n }\n }\n status\n test\n totalUnsettledSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n user {\n id\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Order/431501862\",\n \"parentTransactionId\": \"gid://shopify/OrderTransaction/336526656\",\n \"amount\": \"1000.00\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<[\n \"id\" => \"gid://shopify/Order/431501862\",\n \"parentTransactionId\" => \"gid://shopify/OrderTransaction/336526656\",\n \"amount\" => \"1000.00\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation TransactionCreate($input: OrderCaptureInput!) {\n orderCapture(input: $input) {\n transaction {\n accountNumber\n amountSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n authorizationCode\n authorizationExpiresAt\n createdAt\n errorCode\n fees {\n amount {\n amount\n currencyCode\n }\n }\n formattedGateway\n gateway\n id\n kind\n manuallyCapturable\n maximumRefundableV2 {\n amount\n currencyCode\n }\n multiCapturable\n order {\n id\n }\n parentTransaction {\n id\n }\n paymentDetails {\n ... on CardPaymentDetails {\n paymentMethodName\n }\n ... on ShopPayInstallmentsPaymentDetails {\n paymentMethodName\n }\n }\n paymentIcon {\n url\n }\n paymentId\n processedAt\n receiptJson\n settlementCurrency\n shopifyPaymentsSet {\n refundSet {\n acquirerReferenceNumber\n }\n }\n status\n test\n totalUnsettledSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n user {\n id\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Order/431501862\",\n \"parentTransactionId\": \"gid://shopify/OrderTransaction/336526656\",\n \"amount\": \"1000.00\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation TransactionCreate($input: OrderCaptureInput!) {\n orderCapture(input: $input) {\n transaction {\n accountNumber\n amountSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n authorizationCode\n authorizationExpiresAt\n createdAt\n errorCode\n fees {\n amount {\n amount\n currencyCode\n }\n }\n formattedGateway\n gateway\n id\n kind\n manuallyCapturable\n maximumRefundableV2 {\n amount\n currencyCode\n }\n multiCapturable\n order {\n id\n }\n parentTransaction {\n id\n }\n paymentDetails {\n ... on CardPaymentDetails {\n paymentMethodName\n }\n ... on ShopPayInstallmentsPaymentDetails {\n paymentMethodName\n }\n }\n paymentIcon {\n url\n }\n paymentId\n processedAt\n receiptJson\n settlementCurrency\n shopifyPaymentsSet {\n refundSet {\n acquirerReferenceNumber\n }\n }\n status\n test\n totalUnsettledSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n user {\n id\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Order/431501862", "parentTransactionId": "gid://shopify/OrderTransaction/336526656", "amount": "1000.00" } }
response: { "data": { "orderCapture": { "transaction": { "accountNumber": "", "amountSet": { "presentmentMoney": { "amount": "1000.0", "currencyCode": "USD" }, "shopMoney": { "amount": "1000.0", "currencyCode": "USD" } }, "authorizationCode": null, "authorizationExpiresAt": null, "createdAt": "2024-11-05T18:47:35Z", "errorCode": null, "fees": [], "formattedGateway": "(For Testing) Bogus Gateway", "gateway": "bogus", "id": "gid://shopify/OrderTransaction/1068278467", "kind": "CAPTURE", "manuallyCapturable": false, "maximumRefundableV2": null, "multiCapturable": true, "order": { "id": "gid://shopify/Order/431501862" }, "parentTransaction": { "id": "gid://shopify/OrderTransaction/336526656" }, "paymentDetails": null, "paymentIcon": null, "paymentId": "#1014.3", "processedAt": "2024-11-05T18:47:35Z", "receiptJson": "{}", "settlementCurrency": null, "shopifyPaymentsSet": null, "status": "SUCCESS", "test": true, "totalUnsettledSet": { "presentmentMoney": { "amount": "0.0", "currencyCode": "USD" }, "shopMoney": { "amount": "0.0", "currencyCode": "USD" } }, "user": null }, "userErrors": [] } } }