Testing
We've got a test environment that works just like production, so you can build and test your whole integration before going live with real money.
The test environment
| Production | Test | |
|---|---|---|
| URL | https://api.yeti.host/v1/ecom | https://test.yeti.host/v1/ecom |
| API keys | Production keys from Basecamp | Contact us, we'll get you setup |
| Money | Real | Not real |
Everything else is the same -- same endpoints, same request shapes, same response formats. The only things that change are the URL and your API key.
Getting test API keys
You get test keys from Basecamp, the same way you'd get production ones. Just make sure you're exercising the same endpoints and flows you'll use in production, so you're testing the same code paths.
Setting up the frontend for testing
Since you're using Adyen Drop-in or Components, you'll need to point those at Adyen's test environment too:
const checkout = await AdyenCheckout({
environment: 'test', // "test" for testing, "live" for real
clientKey: clientToken, // from GET /config on test.yeti.host
// ...
});
When you go live, swap "test" for "live" and use the client token from your production GET /config call.
Test card numbers
Adyen provides test card numbers you can use to simulate different scenarios. Here are the ones you'll probably use most:
Cards that work
| Number | Brand | What happens |
|---|---|---|
4111 1111 1111 1111 | Visa | Authorised |
5500 0000 0000 0004 | Mastercard | Authorised |
3700 0000 0000 002 | Amex | Authorised |
Cards that trigger 3D Secure
| Number | Brand | What happens |
|---|---|---|
4212 3456 7891 0006 | Visa | 3DS2 challenge (frictionless available) |
5201 2815 0512 9736 | Mastercard | 3DS2 challenge required |
Cards that get refused
| Number | Brand | What happens |
|---|---|---|
4000 0000 0000 0002 | Visa | Refused |
For the expiry date, any future date works (like 03/30). For the CVC, any three digits will do (like 737). Amex needs four digits (like 7373).
There are loads more test scenarios available -- declined for specific reasons, slow responses, and so on. For a Yeti-focused summary and quick reference, see Test Cards. For the full, always up-to-date list, check the Adyen test cards page.
Testing webhooks
To test webhooks locally, you'll need something like ngrok to create a public HTTPS URL that points to your local machine. Set that URL as your webhook target in Basecamp.
When you're testing, check that:
- Your endpoint comes back with a
2xxresponse. - You're verifying the HMAC signature properly.
- You handle all the event types you care about.
- Your endpoint responds within 15 seconds.
Before you go live
Run through this checklist in the test environment:
- Auth works: Your server can get the client token from
GET /config. - Sessions work: You can create a session and the Adyen Drop-in shows up.
- Happy path: A test card payment goes through start to finish.
- 3D Secure: A 3DS payment works properly (for whichever flow you're using).
- Refused payments: Your integration handles a refused payment without falling over.
- Webhooks: Your webhook endpoint picks up notifications and verifies them.
- Capture (if you're using manual capture): You can capture an authorised payment.
- Reversal: You can cancel or refund a payment.
- Error handling: Your integration deals with 400, 401, 403, and 500 errors sensibly.
- Idempotency: Sending the same request twice with the same
Idempotency-Keydoesn't create a duplicate.
Switching to production
When you're happy everything's working:
- Change the base URL to
https://api.yeti.host/v1/ecom. - Swap your test API key for a production one.
- Set the Adyen Drop-in/Components
environmentto"live". - Point your webhook target URL at your production endpoint.