When to use OnePay
Use OnePay when your project has an active OnePay Gateway Vault configuration and you need a provider-hosted checkout in LKR or USD. Start checkout with the sharedcreateOrder() function, then use the OnePay-specific status function only from your backend when you need to observe a pending transaction.
The shared UPG lifecycle—availability,
createOrder(), and completePayment()—is documented in Quick Setup. This page covers only OnePay-specific functions and presentation.SDK Functions
- PHP SDK
- Laravel SDK
- Node.js SDK
Retrieve a OnePay transaction status
Usestatus() for a transaction ID that your backend stored from the prepared checkout session. It retrieves the OnePay provider observation and returns a small, safe summary. It is useful for bounded polling while an order remains pending; it is not a substitute for the normal shared completion flow.
- PHP SDK
- Laravel SDK
- Node.js SDK
paid_on is null when OnePay has not supplied a payment time. provider_status is SUCCESS or PENDING in this status summary. The SDK does not return OnePay credentials, raw request signatures, or provider-native response data.Prepare a callback payload
OnePay callbacks can wake up your completion handler, but they are not payment proof. Preserve the callback exactly in aOnePayCallbackPayload, then pass its array to shared completePayment() together with the original server-only completion context.
- PHP SDK
- Laravel SDK
- Node.js SDK
callback:Prepare a browser-return payload
A customer returning to your application is only a signal to check the payment. Wrap the query parameters and complete the original payment on your backend; never mark an order as paid from the browser redirect alone.- PHP SDK
- Laravel SDK
- Node.js SDK
return:Payment Elements
Use an explicit OnePay method when you want to control its title and placement. Keep the mode returned by server-side availability:overlay uses the official OnePay SDK presentation, while redirect sends the customer to the prepared hosted URL.
Gateway-specific options
There are no released OnePay tender-selectionproviderOptions. Your backend may choose redirect or overlay only after availability confirms that OnePay and the selected mode are usable for the active project environment.
- The OnePay transaction reference comes from the prepared session; do not invent or replace it in browser code.
- The configured Gateway Vault environment is selected on the backend. A buyer must never select sandbox or production.
overlaydoes not remove the need for a return URL and a configured OnePay notification path.
Completion, webhooks, and safety
On a callback or browser return, pass the stored completion context and one of the payloads above to commoncompletePayment() with its default reconcileProvider: true. OnePay status is the authority for a terminal result. The normalized response can be succeeded, pending, failed, cancelled, or unknown; fulfil only when it is verified and paymentStatus is succeeded.
If status retrieval is temporarily unavailable, retain the order as pending and retry from your backend with bounded, idempotent work. Never use an overlay event, callback arrival, or browser redirect as proof of payment.