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:

  1. Signing. Call /payments/query with {"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.
  2. Response verification. Verify the signature of that response as described in Verifying responses.
  3. A payment through to a webhook. Create a checkout payment, pay it, and check that your webhook handler verifies the signature and replies success.
  4. Duplicates. Send the same webhook body to your handler twice and check it is processed once.
  5. 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:

FieldValue
card_number4111111111111111
exp_month, exp_year12, 2030 (any future date)
cvc123
cardholder_nameAny 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.