# Test your integration

> There's no sandbox. How to get a key, where to test, how to try writes without harming real data, and how to clean up afterwards.

Web page: https://developer.yoprint.com/start/testing/

> **Caution: No sandbox**
>
> YoPrint has no sandbox, test mode or test environment. Every request works on a real team's data, with the same effects as the web app: customers get emails, webhooks fire, and labels cost money.

## Get a key to test with

You create an API key in **Profile**: on the **API Access** card, select **Create API Key**. Opening the page never creates one. Creating a key needs:

- A plan that includes API access, Pro or higher (the [Quickstart](https://developer.yoprint.com/start/quickstart.md#1-get-your-key-and-team-id) lists them).
- An active, paid subscription.

**On a trial, you can't create a key in Profile.** The card says "API keys need an active subscription. If you're on a trial and want to try the API, email support\@yoprint.com." The API itself works on a Pro trial: if you already have a key, it works on the trial team too.

Once you have a key, the card's **Make your first request** section has a request that checks the key and your Team ID together. See the [Quickstart](https://developer.yoprint.com/start/quickstart.md).

## Test on a separate team

The safest place to test is a team you don't use for real work. To test on a separate team, email support\@yoprint.com. Support will tell you whether one can be set up for you, and what it costs.

What you need on your side:

- You create the key on a team with a paid plan that includes API access, usually your live team.
- You're a member of the test team. Your key works on every team you're a member of whose plan includes API access (Pro or higher), so you don't need another key: change the team slug in the path to switch between the test team and your live team. See [Teams and the team slug](https://developer.yoprint.com/concepts/teams.md).

## If you test on your live team

Start with reads. They change nothing. Then, for writes:

- **Name test records clearly**, for example a customer called "TEST Northwind Apparel", so your team can tell them apart.
- **Use a test customer whose only contact is you.** Emails and texts go to the record's contacts. Never send a message or an approval to a real customer while testing.
- **Don't buy labels.** Getting rates is free. To test the rest of the shipping flow, record a label bought elsewhere instead. You can't connect a Shippo test key to YoPrint: GoShippo is connected by signing in to Shippo in the web app, and every label bought through it is real. See [Ship an order](https://developer.yoprint.com/guides/shipping.md).
- **Don't charge cards.** Record test payments only on test orders, and delete them afterwards.
- **Watch the email limits.** Test emails count toward your team's daily limit, and going over it blocks the whole team's email. See [Limits](https://developer.yoprint.com/concepts/limits.md).
- **Tell your team.** Webhooks, Zapier and other integrations on the team react to your test records too.

## Try webhooks without changing anything

See the shape of an event, built from your team's latest matching record:

`GET /v1/api/store/{team_slug}/setting/webhook_subscription/sample/{event_name}` [Show a sample event](https://developer.yoprint.com/reference/webhook-subscriptions/v1-webhook-subscription-sample.md)

To receive a real delivery, subscribe a test URL (a public `https://` address), publish a test order, then delete it. That sends `order.created` and then `order.deleted`. See [Receive events with webhooks](https://developer.yoprint.com/guides/webhooks.md).

## Clean up

Clean up in this order. Deleting a published order moves its payments to the customer's credit, so delete test payments first.

1. **Payments.** Delete each test payment you recorded on the order. Card payments can't be deleted. Refund them instead.

   `DELETE /v2/api/store/{team_slug}/v2/sales_order/{hash_id}/payment/{payment_reference}` [Delete a payment or refund](https://developer.yoprint.com/reference/payments/v2-sales-order-manual-payment-destroy.md)

2. **The sales order or quote.** Deleting it moves it to the trash, where it can be restored. It also deletes its invoices, jobs and shipments, releases its stock, and asks Shippo to refund labels bought for it.

   `DELETE /v2/api/store/{team_slug}/v2/sales_order/{order_unique_key}` [Delete a sales order or quote](https://developer.yoprint.com/reference/sales-orders/v2-order-destroy.md)

3. **The customer**, once it has no open quote or sales order. It goes to the trash too.

   `DELETE /v1/api/store/{team_slug}/customer/{hash_id}` [Delete a customer](https://developer.yoprint.com/reference/customers/v1-customer-destroy.md)

4. **Products and webhooks.** Phase out test products, or delete them after the delete check, and delete test webhook subscriptions.

## Next

- [Quickstart](https://developer.yoprint.com/start/quickstart.md): your first read and write.
- [Retries and duplicates](https://developer.yoprint.com/concepts/retries-and-duplicates.md): how to retry without making two of something.
