# Checkout integration

> Create a checkout payment on your server, redirect the customer to the Onerway-hosted page to pay, and confirm the result through webhooks.

Create every Checkout payment on your server: call the create checkout payment API to obtain a `redirectUrl`, then redirect the customer's browser to the Onerway-hosted checkout page to complete the payment. Onerway handles the payment page, 3DS authentication, and PCI compliance. Browser, device, and cardholder IP data are collected by the hosted checkout page — do not collect or submit them from your server.

Before you begin, follow [Setup](/payments/versions/v2/get-started/setup) to obtain your API credentials and add your server's public outbound IP addresses to the allowlist for the target environment. Send the `ApiKey` header with each server-side API request as described in [Request authentication](/payments/versions/v2/get-started/authentication). Before going live, follow [Sandbox testing](/payments/versions/v2/get-started/testing) to verify all scenarios used by your integration in the sandbox.

Checkout uses Onerway's Google Pay integration, so no Google Pay website registration is needed; that applies only to [Direct API integrations](/payments/versions/v2/online-payments/payment-methods/google-pay#website-registration-before-going-live).

## Integration flow

<steps level="3">

### Create a payment on your server

Create the transaction through [Create checkout payment](/payments/versions/v2/api-reference/endpoints/create-checkout-payment). The [`txnOrderMsg` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-txnOrderMsg) must include `returnUrl` (synchronous return address) and `notifyUrl` (webhook notification address). In the [`products` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-txnOrderMsg-products), product amounts, discounts, and shipping fees must add up to `orderAmount`.

After creation the transaction status is `U` (unpaid), and the response returns the [`redirectUrl` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#response-data-redirectUrl).

On your server, associate the merchant order with the `paymentId`, `transactionId`, and `redirectUrl` returned when you create the payment.

### Redirect to the checkout page

Redirect the customer's browser to `redirectUrl`. The customer selects a payment method and completes the payment on the hosted page; when 3DS authentication is required, the checkout page guides the customer through it — no merchant handling is needed.

### Handle the payment return

After payment the customer returns to your site through `returnUrl`. The synchronous return is for page flow only: add your order ID to `returnUrl`, show the customer a "processing" state when they return, and process the order once the webhook arrives. The final payment result is determined by [webhooks](#confirm-the-payment-result).

</steps>

## Reopen checkout after an interruption

When the customer returns to the order after closing or refreshing the page, or closing or restarting the app, first [query the transaction](/payments/versions/v2/api-reference/endpoints/query-transactions) on your server by passing the stored `transactionId` in `transactionIds`, then show the current payment progress.

If no payment has taken place, you can reopen the original `redirectUrl` to continue payment. You do not need to create another checkout payment solely because the page was interrupted. If the customer has submitted payment and the outcome is unknown, query and wait for the result without automatically creating a new payment or asking the customer to pay again. For a paid transaction, show the payment result. For an authorized transaction, follow [Pre-authorization and capture](/payments/versions/v2/online-payments/scenarios/pre-authorization) for subsequent operations.

If the page reports an invalid link or a closed transaction, query the original payment status as well. A closed page, a client timeout, or an inaccessible link is not proof of payment failure.

## Payment method display scope

Which payment methods the checkout page displays is controlled by the [`productType` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-productType); the actual processing model is further determined by `subProductType` and `txnType`.

| Goal | Server-side input |
| --- | --- |
| Display card payment methods only | `productType=CARD` |
| Display all available payment methods | `productType=ALL`; the customer chooses on the checkout page. |
| Lock to a single local payment method or wallet | `productType=ALL` together with the [`lpmsInfo.lpmsType` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-lpmsInfo-lpmsType); the checkout page displays only that payment method, with `ApplePay` and `GooglePay` for the wallets. |

How each payment method is supported on the checkout page and what to prepare is covered in [Payment methods](/payments/versions/v2/online-payments/payment-methods).

## Saved card option

The checkout page offers the customer the option to save their card information when both of the following are true: you submit a stable [`merchantCustId` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-merchantCustId) when creating the payment, and **Save payment details** is turned on in the merchant portal. The option is not selected by default; the card is saved only after the customer opts in and completes the payment. Submit the [`subProductType` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-subProductType) according to the scenario — `DIRECT`, `SUBSCRIBE`, or `INSTALLMENT`; no dedicated value is needed for saving cards. Keep submitting the same `merchantCustId` on later payments, and the checkout page presents the customer's available saved cards.

To turn on **Save payment details**, sign in to the merchant portal, go to **Settings → Payment settings → Payment page settings**, click the name of the brand applied to your website to open its details, and turn on the switch. Turn it on separately in the sandbox and production environments: [Sandbox payment page settings](https://sandbox-merchant.onerway.com/settings/payment/checkout/brand) · [Production payment page settings](https://merchant.onerway.com/settings/payment/checkout/brand).

Additional considerations for the Checkout integration: for subscription checkout, submit the required customer identifier in [`subscription.merchantCustId`](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-subscription-merchantCustId). The top-level `merchantCustId` is optional and must match when also submitted. The requirements for `merchantCustId`, the saved payment method result webhook, and listing and deleting saved tokens are covered in [Saved payment methods](/payments/versions/v2/online-payments/scenarios/saved-payment-methods).

## Subscriptions

Initial subscriptions are completed on the checkout page: submit the [`subProductType` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-subProductType) `=SUBSCRIBE` together with the [`subscription` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-subscription) (`requestType=0`); the billing model is determined by the [`subscription.selfExecute` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-subscription-selfExecute). Renewals and plan changes are initiated by your server through the Direct API; the checkout page is not involved.

Choosing between managed and self-managed subscriptions, contract credentials, lifecycle notifications, and plan change rules are covered in [Subscription payments](/payments/versions/v2/online-payments/scenarios/subscriptions).

## Pre-authorization

When the [`txnType` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-txnType) is `AUTH`, the checkout page performs a pre-authorization: the order amount is held on the customer's card without an immediate charge, and any 3DS authentication is guided by the checkout page. After the pre-authorization succeeds, store the `transactionId` and `paymentId` from the response; your server later captures or voids through [Capture or void authorization](/payments/versions/v2/api-reference/endpoints/capture-or-void-authorization).

Scope, the lifecycle from authorization to capture or void, notifications, boundaries, and status handling are covered in [Pre-authorization and capture](/payments/versions/v2/online-payments/scenarios/pre-authorization).

## Profit sharing

Profit sharing applies to the platform model: the platform merchant creates the payment with the receiving sub-merchant's `merchantNo`, and the payment is eligible for profit sharing only when you submit the [`paymentMethodOptions` field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-paymentMethodOptions) with `profitShare=true` in its `share` object; the checkout payment flow is the same as an ordinary payment. When you also set `profitShareRate`, Onerway allocates funds automatically after a successful `SALE` or `CAPTURE`; without it, your server initiates profit sharing through the API. To receive automatic profit share and reversal notifications, also set `profitShareNotifyUrl`. Submit `paymentMethodOptions` as a JSON string as required by the API.

Choosing between automatic and API-initiated profit sharing, result notifications, queries, and reversals are covered in [Profit sharing](/payments/versions/v2/online-payments/scenarios/profit-sharing).

## Confirm the payment result

The final result of a Checkout payment is determined by webhooks: the [payment result webhook](/payments/versions/v2/api-reference/webhooks/payment-result) for ordinary payments, the [subscription payment webhook](/payments/versions/v2/api-reference/webhooks/subscription-payment) for subscriptions, and the [authorization, capture, and void webhook](/payments/versions/v2/api-reference/webhooks/authorization-capture) for pre-authorizations. When the customer opts in to saving a card, the tokenization result arrives separately in the [saved payment method result webhook](/payments/versions/v2/api-reference/webhooks/payment-method-result). Signature verification, acknowledgement and retries, deduplication, status interpretation, and query fallback follow the shared rules in [Webhooks](/payments/versions/v2/get-started/webhooks).

Additional considerations for the Checkout integration: the `returnUrl` return is not guaranteed to carry transaction parameters, so do not use any parameter on the return URL to drive order processing; if the customer has returned but no webhook has arrived, fall back to [Query transactions](/payments/versions/v2/api-reference/endpoints/query-transactions). Transaction status is determined by the [`status` response field](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#response-data-status) and the same field in webhooks; see the API Reference for all values.
