Test in a Sandbox Environment
Important
The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.
The Buy with Prime sandbox is an isolated environment that you can use to test applications that use the Buy with Prime API before you deploy them to production. The sandbox environment replicates the functionality of the Buy with Prime API, but it doesn't change production data or cause real-world events such as product shipments and merchant fee charges. The sandbox environment provides test data such as shopper identities and a default product catalog.
Note
There is no way to promote or migrate an instance in the sandbox environment to a live Buy with Prime API instance.
Test the Buy with Prime API in a sandbox environment
In the sandbox environment, you can call all of the Buy with Prime APIs. When you use the sandbox environment to place orders, you get responses to calls to create returns and cancel orders, but there is no real-world change.
In the sandbox environment, Buy with Prime business products publish all of the events listed in Event Types.
Publish events without real-world changes
In the sandbox environment, you call mutations to test events that are typically published during shipping, delivery, returns, and refunds scenarios:
- Change the State of an Outbound Package in the Sandbox
- Change the State of a Return Package in the Sandbox
Set up the sandbox environment
To set up the sandbox environment, contact your Buy with Prime solutions architect.
Sandbox constraints
- Inventory counts remain unchanged except when an order is placed.
INVENTORY_CHANGED
events are not published even when an order is successfully placed.- The return delivery failure reason is set to
UNDELIVERABLE
no matter which reason you set. - Programmatic returns are not supported in the sandbox environment.
Example testing scenarios
The following are some end to end scenarios we recommend for testing your application.
As you test your application, you might need to wait for the mutations because they are asynchronous. For specific wait times, see the following:
After the appropriate wait time, you can query the order or return to see the updated state.
Simulate delivering an order. The order contains a single product that offers Buy with Prime.
- Create a minimum fulfillable Buy with Prime order.
- Update all items to be IN_TRANSIT in a single package.
- Update a package as DELIVERED.
Simulate delivering an order. The order contains one product that offers Buy with Prime as well as one product that doesn’t.
- Create an order that includes an item to be fulfilled by Amazon but isn't offered through Buy with Prime.
- Update all items to be IN_TRANSIT in multiple packages. The two items will be in separate packages. You can use their respective IDs to update them.
- Update multiple packages as DELIVERED.
Simulate cancelling an order by request from the customer. The order contains a single product that offers Buy with Prime.
- Create an order that includes an item to be fulfilled by Amazon but isn't offered through Buy with Prime.
- Update all line items in the package CANCELLED due to CUSTOMER_REQUEST.
Simulate a return for an order. The order contains a single product that offers Buy with Prime.
- Create a minimum fulfillable Buy with Prime order.
- Update all items to be IN_TRANSIT in a single package.
- Update a package as DELIVERED.
- Using the Merchant Online Return Center, create a return.
- Update a return package as DROPPED_OFF.
- Update a return package as IN_TRANSIT.
- Update a return package as DELIVERED.
- Update return line item grading details.
Related topics
Updated 2 days ago