All Onerway API requests require authentication using merchant credentials. When you create a Onerway account, we provide you with a complete set of credentials—merchant number, secret key, and store ID—for both sandbox and production environments. The sandbox environment lets you safely test Onerway features without processing real money, while the production environment handles live transactions.
This guide walks you through a simple Onerway API interaction: creating a payment order. For a deeper dive into our API architecture and design principles, see the API OverviewPayments API. If you're ready to start accepting real payments, check out our Payments quickstart.
Every account comes with complete API credential sets for both sandbox and production environments.
The easiest way to explore the Onerway API is through Apifox, which lets you make API requests directly from your browser. Since it runs in sandbox mode, you can experiment without any risk to real funds.
Run in Apifox buttonYou should see a response like this:
{
"respCode": "20000",
"respMsg": "Success",
"data": {
"transactionId": "1967964791566110720",
"merchantTxnId": "268b51e4-cbef-4a39-856b-dcc18f3f6805",
"merchantNo": "800209",
"responseTime": "",
"txnTime": "",
"orderAmount": "0.50",
"orderCurrency": "USD",
"txnAmount": "",
"txnCurrency": null,
"txnTimeZone": null,
"status": "U",
"reason": null,
"redirectUrl": "https://sandbox-checkout.onerway.com/checkout?key=c716f87fbf4c473f93948c618c507126&checkoutDetail=H4sIAAAAAAAAAMVXTXPbNhD9Kx6eLRkESRD0qQrtTJWxnYzkpNN2cgCBpcSUIlgQlKJm8t%2B74IcsOWrS5pBeNMQDFti3%2B7ALffJEXc%2BVd%2B35MY05JzxkQcxD4scJ9S69DRi5FpV90N41J4SS5AgTG0DDWQbl0crHj1W3H2U8i3wIJzKDfBKKIJnwiGUTJaXP8yBnnESnZo9Ftx8lNJqQZOKzC0qvI3rtJ1%2Bu%2B01XuLZqy%2FLSswjta2e6nN3deh0w2%2Bi2sgiRaUR6KG2NgUruEXy7vEGsabM3RqtW2sH8Zr64TR9xRgqjHDavcuT9%2ByevQEZ%2ByANGKYsTzkIWRTymTyvR%2Bt18OUPb%2BmTLdLZwR5V6pd8Iu0ZkbW3dXF9dGV0hHwVbXTeqEKtpVupsKrWB6a6olN410wrsld6Cwd8ajLCFriY7yCaNyj5ejSff4dZXsZ9DKCTPgUkIZBxmIfUh5jnNOFOUT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TAkDxXBLrhmBJXTuebI4VmogEWuto4IlKX%2BnCztgXshnfzE5B2onthqxOw19URKlqrF8N9OVwqFLYT33ibcDBT20LCFxVvXlkwGMzuD0DCue%2BKizSAMf%2Bn5zgNvM9%2FA2ZV27c3DAAA", // Checkout payment link
"sign": "4585af83d9804c2fdbb144832735544688e323483a01b4a3fab4948c694c118c",
"contractId": "",
"tokenId": null,
"eci": null,
"transactionOrderNo": null,
"periodValue": null,
"lpmsType": null,
"qrCode": null,
"subscriptionManageUrl": null
}
}
To test different payment scenarios, you can use the following test card numbers:
| Card Number | Brand | Result |
|---|---|---|
4761 3441 3614 1390 | Visa | Payment successful |
4000 0209 5159 5032 | Visa | Requires 3DS verification |
4000 1284 4949 8204 | Visa | Card declined |
You might encounter these common errors during testing:
| Error Code | Description | Handling Suggestion |
|---|---|---|
40013 | Abnormal parameters (cannot be read) | Check if environment variables are properly configured |
70002 | Unknown decline | Contact technical support |
Every payment order you create generates a complete transaction record. View and manage your transactions in the Onerway Dashboard.
Click any transaction ID to see detailed information across these sections:
Sale, Auth, etc.4111 11** **** 1111)Customize where customers land after completing their payment.
Add a returnUrl to your payment request:
{
"txnOrderMsg": {
// ...other fields...
"returnUrl": "https://your-domain.com/payment/landing_page"
}
}
returnUrl for payment confirmation. Customers might close their browser or lose internet connection before reaching your landing page. Set up a webhook event handler so Onerway can send payment events directly to your server, bypassing the client entirely. If webhook notification , Onerway will retry multiple timesPayments API.Webhooks notify your server about payment events in real-time, independent of the customer's browser.
Add a notifyUrl to your payment request:
{
"txnOrderMsg": {
// ...other fields...
"notifyUrl": "https://your-domain.com/webhook/onerway"
}
}
Learn how to process webhook events in our Webhooks guidePayments API.