Manage test orders
You can use the REST Admin API to create test orders and transactions to validate your app's behavior. To avoid platform fees, this guide shows you how to manage test orders with the REST Admin API by completing the following tasks:
- Creating an order with an authorized transaction
- Getting a transaction ID to use as a parent ID when capturing the transaction
- Capturing the transaction and setting the
test
property totrue
on the order
Other methods, such as using a manual payment gateway and the cash on delivery payment method, don't create a test order and are subject to platform fees.
Requirements
Anchor link to section titled "Requirements"- Your app can make authenticated requests to the REST Admin API.
- Your app has the
read_orders
andwrite_orders
access scopes. For more information on requesting access scopes when your app is installed, refer to Getting started with OAuth. You've familiarized yourself with the concepts of orders and transactions.
Transactions are associated to orders and occur each time there is an exchange of money. Transactions are processed by payment providers, and involve the transfer of money from the the customer's credit card to the merchant's bank account. For more information, refer to How a credit card payment gets processed.
Step 1: Create an order
Anchor link to section titled "Step 1: Create an order"To test an order, create an order with an authorization transaction by sending a POST request to the Order resource. Include the transactions
object in the body of the request:
Step 2: Get a transaction ID
Anchor link to section titled "Step 2: Get a transaction ID"After you create the order, the returned Order
object includes an ID. You can use the order ID to return the transaction and its ID. To retrieve the transaction, send a GET request to the Order Transaction resource:
Step 3: Capture the transaction
Anchor link to section titled "Step 3: Capture the transaction"After you return the transaction, you can use its ID to create a capture transaction to capture payment.
To create the capture transaction, send a Transaction
object in the body of a POST request to the Order Transaction resource. The following example includes the transaction ID of the authorization as the parent_id
and sets the test
property to true
:
Step 4: Confirm the test order
Anchor link to section titled "Step 4: Confirm the test order"You can retrieve the order to verify that it's in test mode. If the order is a test order, then the response includes the test
property set to true
:
- Learn how to create test orders by using Shopify's Bogus Gateway, or putting Shopify Payments into test mode.
- Edit existing orders using the GraphQL Admin API.
- Explore examples for querying orders, including retrieving sales data from an order, using the GraphQL Admin API.