# Afterpay

> Accept one-time USD payments with Afterpay through Checkout or the Direct API and confirm the result on your server.

## Basic information

The customer reviews the payment schedule and terms offered by Afterpay before confirming the purchase.

- Integration paths: [Checkout](/payments/online-payments/checkout), [Direct API](/payments/online-payments/api)
- Transaction type: One-time payment
- `lpmsInfo.lpmsType`: `Afterpay`

| Customer country/region | Order currency |
| --- | --- |
| 🇺🇸 US | USD |

The customer country/region is the `billingInformation.country` value in the payment request.

This guide applies to merchants and applications enabled for this flow.

## Before you begin

Complete [Setup](/payments/get-started/setup) and confirm that your merchant and application are enabled for this payment flow. Confirm your transaction limits, payment expiry, settlement arrangements, and test procedure with Onerway. Follow [Currency and amount validation](/payments/get-started/currency-and-amount) for USD order amounts.

Supply actual customer and product information according to the API requirements, including the customer’s email and billing country `US`. Configure your return page and notification endpoint, and store the mapping between your order and the Onerway payment identifiers.

During enablement, agree with Onerway when to process payment status and fulfil the order. Follow the agreed fulfilment procedure. Payment plans and customer eligibility depend on the result offered by Afterpay.

## Start the payment

### Checkout

1. On your server, call [Create Checkout Payment](/payments/api-reference/endpoints/create-checkout-payment) with `productType=ALL`, `subProductType=DIRECT`, `txnType=SALE`, `paymentMode=WEB`, and `orderCurrency=USD`. To show only Afterpay, set [`lpmsInfo.lpmsType`](/payments/api-reference/endpoints/create-checkout-payment#request-lpmsInfo) to `Afterpay`, sending `lpmsInfo` as a JSON string. If you omit `lpmsInfo`, the customer chooses from the methods available for the order.
2. Supply the customer and product details, notification URL, and return URL required by the API. Encode `billingInformation`, `shippingInformation`, and `txnOrderMsg` as JSON strings. Keep product and order currencies consistent and ensure the product amounts, discounts, and shipping charges total `orderAmount`.<br />Select the request example “Unified Checkout with all available payment methods”. Replace the placeholders with your order and customer data, use USD, and remove `cardInfo` for this flow. Add this method's `lpmsInfo` if you want to show only Afterpay. The example shows the shared Checkout request structure.
3. Select the response example “Unified Checkout session created”. Store the returned `paymentId` and `transactionId` against your order, then redirect the customer's browser to `redirectUrl`. The initial `status=U` means the payment is unpaid.
4. The customer selects or confirms Afterpay in Checkout. Checkout handles the subsequent payment page. If the method is absent, contact Onerway to check application enablement and order conditions.

See [Checkout integration](/payments/online-payments/checkout) for signing and return-page handling. Before creating the payment, you can use [List available payment methods](/payments/api-reference/endpoints/list-available-payment-methods) to check availability for the current order.

### Direct API

1. Check [List available payment methods](/payments/api-reference/endpoints/list-available-payment-methods) for the current order. After the customer selects Afterpay, call [Create direct transaction](/payments/api-reference/endpoints/direct-create-transaction) from your server with `productType=LPMS`, `subProductType=DIRECT`, `txnType=SALE`, `paymentMode=WEB`, and `orderCurrency=USD`. Set `lpmsType=Afterpay` in [`lpmsInfo`](/payments/api-reference/endpoints/direct-create-transaction#request-lpmsInfo), encoded as a JSON string.
2. Supply the customer's actual billing details in `billingInformation`, with `country` set to `US`, and the actual shipping details in `shippingInformation`. Encode both as JSON strings. Include products, notification and return URLs, and the end-user IP address in [`txnOrderMsg`](/payments/api-reference/endpoints/direct-create-transaction#request-txnOrderMsg). Keep product and order currencies consistent, with product amounts, discounts, and shipping fees adding up to `orderAmount`.<br />Select the request example “Redirect local payment request (illustrative)”. It uses Bancontact / BE / EUR to show the shared structure. Replace the method with `Afterpay`, use USD for this flow, and supply the actual order and customer details. The example amount does not establish a transaction limit.
3. Store the returned `paymentId` and `transactionId`. When `status=R` and `actionType=RedirectURL`, redirect the customer’s browser to `redirectUrl`. The response example “Redirect local payment response (illustrative)” shows this shape. For other actions or states, follow [Local payment integration](/payments/online-payments/payment-methods/local-payment-methods#handle-the-customer-action). Do not repeatedly create the same order while waiting.
4. The Afterpay page guides the customer through approval. When the customer returns to your site, display the result retrieved from your server. See [Request signing](/payments/get-started/request-signing) for authentication.

## Customer actions and final result

The customer signs in to Afterpay or follows the registration steps offered on the payment page. Afterpay determines the customer’s eligibility and the available payment plan. The customer reviews the schedule, terms, and amount before approval. Your application does not collect the customer’s Afterpay login details.

See [Afterpay’s instructions](https://www.afterpay.com/en-US/help/217425866-How-does-Afterpay-work) for customer guidance; follow the options offered on the payment page.

Returning to your website does not confirm payment success. Process the signature-verified [Payment Result notification](/payments/api-reference/webhooks/payment-result) on your server. If the notification is missing or you need to check the result, call [Query payments](/payments/api-reference/endpoints/query-payments) with the saved `paymentId`. See [Webhooks](/payments/get-started/webhooks) for verification, acknowledgement, idempotency, and query fallback.

Update payment status from the server notification or query result, and fulfil orders according to the agreed procedure. Customer approval or a return to your website alone must not mark the order paid.

## Refunds and disputes

Confirm the refund capabilities, partial-refund support, request deadlines, and dispute process enabled for your account with Onerway. If refunds are enabled, follow [Refunds](/payments/online-payments/scenarios/refunds) and track the refund result separately.

## Testing and go-live

Agree the test environment and customer approval procedure with Onerway, then follow [Sandbox testing](/payments/get-started/testing).

1. Create a USD order with the required customer and product details for each path you use. For Checkout, verify that the returned URL opens Checkout and Afterpay is available. For the Direct API, verify that the returned `redirectUrl` opens the Afterpay page.
2. Select the method, check the displayed amount, and complete the agreed customer actions. Retain the notification and acknowledgement for the same order, then query the payment and check that the results agree.
3. Test cancellation, incomplete payment, and returning before the final result. Confirm that a return alone never marks the order paid, duplicate notifications are handled idempotently, and missing notifications can be reconciled by querying the payment.
4. Before launch, verify production enablement, notification and return URLs, USD order support, limits, and expiry. Test refunds separately if enabled.
