Testing
Sandbox test cards and the scenarios to run for each checkout, for Altruon.js callbacks, trials and coupons before you go live.
Test your integration in sandbox before you take a real payment. Sandbox is a separate environment with its own backoffice, URLs and keys. This page lists the test cards and the scenarios to run.
Sandbox at a glance
| Sandbox value | |
|---|---|
| Backoffice | https://login.sandbox.altruon.io |
| API base URL | https://{your-domain}.api.sandbox.altruon.io |
| Hosted page link | https://{your-domain}.sandbox.altruon.io/checkout/p/{id} |
| Dynamic hosted checkout URL | https://{your-domain}.sandbox.altruon.io/checkout/s/{sessionId} |
| Secret key (server only) | sk_sandbox_... |
| Publishable key (browser) | pk_sandbox_... |
See Sandbox and environments for how to get access.
Test cards
Use these card numbers in sandbox. Enter any future expiry date and any three-digit CVC.
| Scenario | Card number |
|---|---|
| Successful payment | 4111 1111 1111 1111 |
| Declined payment | 4000 0000 0000 0002 |
| 3D Secure required | 4000 0027 6000 3184 |
| Insufficient funds | 4000 0000 0000 9995 |
Test a hosted checkout
These steps apply to hosted pages and to dynamic hosted checkout.
- Open the hosted page link, or create a sandbox session with
hostedCheckout: trueand open itscheckout_url. - Check the page: your logo and colors, the plan and any pre-applied coupons in the order summary, the fields you enabled, and the payment methods routed for the currency.
- On dynamic hosted checkout, check that the fields you sent in
customerDataare pre-filled. - Pay with the successful test card.
Once the payment succeeds:
- The shopper is redirected to your redirect URL.
- A subscription is created on your billing platform.
- The invoice is marked paid.
- The transaction is recorded with the acquirer's own transaction ID.
- For a hosted page, the Converted counter and the conversion rate of the page update under Settings > Hosted Pages.
Scenarios worth running
| Scenario | What to expect |
|---|---|
| A declined card or a failed 3D Secure challenge on dynamic hosted checkout | The shopper returns to the same /checkout/s/{sessionId} URL with the form restored and can retry while the session is valid. |
A failed payment on a session created without paymentData.paymentMethod | Every routed payment method stays available, so the shopper can switch method. |
| A session left open for more than 15 minutes | The session expires. A hosted page link can be opened again and the session counts in the Expired column. A dynamic session cannot be restarted: create a new one. |
| A hosted page in Draft or Archived status | The link is rejected at checkout. |
Test Altruon.js callbacks
Trigger each callback of your Altruon.js integration at least once.
| Callback | How to trigger it |
|---|---|
onSuccess | Pay with the successful test card, 4111 1111 1111 1111. |
onFailure | Pay with the declined test card, 4000 0000 0000 0002. |
onDataRequired | Leave required fields empty and attempt the payment. |
onActionRequired with a redirect | Pay with the 3D Secure test card, 4000 0027 6000 3184. |
onActionRequired with a QR code | Select Pix or UPI as the payment method. |
A session is single use. After a failed payment in Altruon.js, create a new session before the shopper retries. See Payment results for how to handle each callback, and the callbacks reference for their payloads.
To see a complete integration running against your sandbox keys, clone the merchant demo described in Altruon.js examples.
Test trials
- Use sandbox plans with a trial period configured on each billing platform you connect.
- Check that the estimate returns
trialEndbefore the payment. - Complete the checkout, then confirm that the subscription is in
trialstatus in Altruon. - Confirm that the subscription becomes
activeafter the trial end webhooks arrive. - Run a checkout without a trial and one with an amount due today, and confirm that both still charge as before.
See Trials for the supported acquirers and payment methods.
Test coupons
Test every coupon in sandbox before you use it in production. Invalid or unknown codes are rejected by the billing platform. See Coupons for the identifier each billing platform expects.
Check the result
After a successful test payment, look up the outcome from your server with the transaction ID:
GET https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/{transactionId}/detailsThe response describes the transaction with its customer, invoice and subscription. See Get transaction details.