GraphQL post-payment
The post-payment process may involve capturing payments, adding tracking fulfillments, and issuing refunds. This section provides examples of how to use the GraphQL Admin API for these tasks.
Anchor to Payment capturePayment capture
Captures payment for an authorized transaction on an order if the Payments setting is configured to manual capture. Using the order ID, you can fetch an order and OrderTransaction, then call the GraphQL Admin API's orderCapture mutation to capture the authorized payment.
The following example captures an authorized payment using the orderCapture mutation:
orderCapture
Input
Response
Shop Pay Wallet supports multi-capture, enabling you to execute partial captures by providing any amount less than the currently uncaptured amount.
For the first partial capture made against an authorization, you can also void the remaining authorization after capturing an amount by including "finalCapture": true in your partial capture input. For more details, refer to the orderCapture documentation.
After an authorization has been partially captured, it can no longer be voided by any means. It must either be captured, or left to expire after the 7 to 30 day authorization period.
After an authorization has been partially captured, it can no longer be voided by any means. It must either be captured, or left to expire after the 7 to 30 day authorization period.
With Extended Authorizations, you may capture payments beyond seven days on most card types for a small fee. For more information, refer to Credit card authorization periods.
You can also use the Order Authorization API to void an authorization and then replace it with a new authorization.
By combining partial captures using "finalCapture": true with the Order Authorization API to create new authorizations, you can re-issue an authorization for the uncaptured amount, while also minimizing times where authorized amounts are held on a customer's card for items they've canceled before fulfillment.
While you may choose to re-issue authorizations immediately after void or expiration to maintain an active authorization, it isn't necessary. Authorizations can be re-issued on demand, as long as the total amount captured and total amount currently authorized is less than the order total.
Anchor to Fulfillment trackingFulfillment tracking
You can fetch an order and fulfillment order using the order ID.
If the order is shipped with a tracking number, then you must run the fulfillmentCreate mutation to update the tracking information and fulfill the order. You can make subsequent updates to the tracking information using the fulfillmentTrackingInfoUpdate mutation.
If the order is for store pickup, then you should instead run the fulfillmentOrderLineItemsPreparedForPickup mutation to update the status.
The following example creates a fulfillment with tracking information using the fulfillmentCreate mutation:
fulfillmentCreate
Input
Response
The following example shows how to use the fulfillmentOrderLineItemsPreparedForPickup mutation:
fulfillmentOrderLineItemsPreparedForPickup
Input
Response
Anchor to Refund creationRefund creation
Using the order ID returned from a completed checkout, you can run the refundCreate mutation:
refundCreate
Input
Response
Anchor to Cancelling and deleting ordersCancelling and deleting orders
You can cancel orders in Shopify using the asynchronous orderCancel mutation, which effectively stops the order from being further processed in Shopify: