Skip to main content

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

ProductionTest
URLhttps://api.yeti.host/v1/ecomhttps://test.yeti.host/v1/ecom
API keysProduction keys from BasecampContact us, we'll get you setup
MoneyRealNot 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

NumberBrandWhat happens
4111 1111 1111 1111VisaAuthorised
5500 0000 0000 0004MastercardAuthorised
3700 0000 0000 002AmexAuthorised

Cards that trigger 3D Secure

NumberBrandWhat happens
4212 3456 7891 0006Visa3DS2 challenge (frictionless available)
5201 2815 0512 9736Mastercard3DS2 challenge required

Cards that get refused

NumberBrandWhat happens
4000 0000 0000 0002VisaRefused

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:

  1. Your endpoint comes back with a 2xx response.
  2. You're verifying the HMAC signature properly.
  3. You handle all the event types you care about.
  4. 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-Key doesn't create a duplicate.

Switching to production

When you're happy everything's working:

  1. Change the base URL to https://api.yeti.host/v1/ecom.
  2. Swap your test API key for a production one.
  3. Set the Adyen Drop-in/Components environment to "live".
  4. Point your webhook target URL at your production endpoint.