Getting started
Testing
The test environment, the test card, and what to check before you go live.
Integrate against the test environment (https://api-test.hansapay.io) first. It uses separate credentials.
What to test before going live:
- Signing. Call
/payments/querywith{"merchant_order_no":"TEST-DOES-NOT-EXIST"}. A correctly signed request returns{"code":2002,"msg":"Order not found|orderNotFound"}; a signing mistake returns HTTP 401 or 403. - Response verification. Verify the signature of that response as described in Verifying responses.
- A payment through to a webhook. Create a checkout payment, pay it, and check that your webhook handler verifies the signature and replies
success. - Duplicates. Send the same webhook body to your handler twice and check it is processed once.
- Failure paths. A declined payment, a refund, and an order in a currency other than USD, so that you see both amounts described in Amounts and currency.
In the test environment, card payments go to the card provider's sandbox. Use this test card:
| Field | Value |
|---|---|
card_number | 4111111111111111 |
exp_month, exp_year | 12, 2030 (any future date) |
cvc | 123 |
cardholder_name | Any name |
The sandbox does not decide the outcome from the card number. A sandbox payment waits on the provider's test checkout page, which offers "Mark as Paid" to complete it; you then receive the payment.updated webhook as in production. Ask your account manager for any other test outcomes you need, such as a declined payment.
