# JD Pay

> Accept one-time JD Pay payments for physical goods through the Direct API or browser Checkout, with an explicit business type, and confirm the result on your server.

## Basic information

The customer continues to the JD Pay payment page and follows its instructions to complete payment.

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

| Customer country/region | Order currency |
| --- | --- |
| 🇬🇧 GB | GBP |
| 🇧🇪 BE, 🇩🇪 DE, 🇪🇸 ES, 🇫🇷 FR, 🇱🇺 LU, 🇳🇱 NL | EUR |

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

This guide applies to applications enabled for physical-goods payments. You provide the order and customer details and explicitly identify the physical-goods business type. Before using another business type or order currency, confirm the enabled scope for your merchant and application with Onerway. Use [List Available Payment Methods](/payments/versions/v2/api-reference/endpoints/list-available-payment-methods) to check the current order.

## Before you start

Complete [Integration Setup](/payments/versions/v2/get-started/setup). Confirm that JD Pay physical-goods payments are enabled for your application, including use of business type `100001`, and confirm the transaction limits, payment expiry, settlement arrangements, and test procedure. See [Currency and Amount Validation](/payments/versions/v2/get-started/currency-and-amount) for amount formatting.

Prepare the goods, billing, and shipping information required by the API. Use the customer's actual country and contact details. Configure notification and return URLs, and retain a mapping between your order and the Onerway payment identifiers. The business type describes the merchant's sale; your server supplies it, rather than asking the customer to select it during payment.

## Start the payment

### Direct API

1. Check [List available payment methods](/payments/versions/v2/api-reference/endpoints/list-available-payment-methods) for the current order. After the customer selects this method, call [Create direct transaction](/payments/versions/v2/api-reference/endpoints/direct-create-transaction) from your server with `productType=LPMS`, `subProductType=DIRECT`, `txnType=SALE`, and `paymentMode=WEB`. Set `lpmsType=JdPay` in [`lpmsInfo`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#request-lpmsInfo), encoded as a JSON string.
2. Supply top-level [`metaData`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#request-metaData) as a JSON string containing `{"bizTP":"100001"}` for this physical-goods flow. The value of `bizTP` is also a string. Supply the actual billing and shipping details in `billingInformation` and `shippingInformation`, both encoded as JSON strings. Include the physical goods, notification and return URLs, and merchant-collected end-user IP, browser, and device information in [`txnOrderMsg`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#request-txnOrderMsg). For the order and goods, use the order currency in the table above for the customer country/region (GBP or EUR); goods amounts, discounts, and shipping charges must total `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 `JdPay`, use the order currency in the table above for the customer country/region (GBP or EUR), supply the actual physical goods and customer details, and add the `metaData` value above. Do not rely on an omitted business type or include `subscription` in this one-time payment flow. 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/versions/v2/online-payments/payment-methods/local-payment-methods#handle-the-customer-action). Do not repeatedly create the same order while waiting.
4. The JD Pay page guides the customer through payment. When the customer returns to your site, display the result retrieved from your server. See [Request authentication](/payments/versions/v2/get-started/authentication) for authentication.

### Checkout

If you offer only this method, first call [List Available Payment Methods](/payments/versions/v2/api-reference/endpoints/list-available-payment-methods) and check that it is returned for the current order. When Checkout displays all available methods, Onerway performs this filtering.

1. On your server, call [Create Checkout Payment](/payments/versions/v2/api-reference/endpoints/create-checkout-payment) with `productType=ALL`, `subProductType=DIRECT`, `txnType=SALE`, and `paymentMode=WEB`. To show only JD Pay, set [`lpmsInfo.lpmsType`](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-lpmsInfo) to `JdPay`, sending `lpmsInfo` as a JSON string. If you omit `lpmsInfo`, the customer chooses from the methods available for the order.
2. For this physical-goods flow, supply top-level [`metaData`](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-metaData) as a JSON string containing `{"bizTP":"100001"}`. The value of `bizTP` is a string. For example, the outer request contains `"metaData": "{\"bizTP\":\"100001\"}"`. Do not rely on an omitted business type, add `bizTP` as a top-level request parameter, or include `subscription` in this one-time payment flow.
3. Supply billing, shipping, goods, return URL, and notification URL fields as required by the API. Both `billingInformation` and `shippingInformation` are JSON strings. For the order and goods, use the order currency in the table above for the customer country/region (GBP or EUR); goods amounts, discounts, and shipping charges must total `orderAmount`.<br />Select the request example **Unified Checkout with all available payment methods**. Replace its order and customer data, use the order currency in the table above for the customer country/region (GBP or EUR), supply the physical goods, and add the `metaData` and `paymentMode` values above. Add this method's `lpmsInfo` if you want to show only JD Pay. Remove the example's `cardInfo` object for this flow. The example demonstrates the shared Checkout request structure.
4. Select the response example **Unified Checkout session created**. Save 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.
5. Checkout guides the customer to the JD Pay payment page. When the customer returns to `returnUrl`, display the order result obtained from your server. See [Checkout Integration](/payments/versions/v2/online-payments/checkout) for request authentication, redirects, and return handling.

## Customer steps and final result

The customer opens the JD Pay payment page, checks the payment details, and follows the page's instructions to complete payment. Any authentication or confirmation requested by that page takes place there. Your application should not collect the customer's JD Pay password or verification codes. Follow the instructions for the current payment; this guide does not prescribe a particular login, QR-code, or funding method.

The customer may leave before completing payment. Opening the payment page or returning to your website does not establish that payment succeeded. Keep the order pending until your server obtains the result.

Process the verified [Payment Result notification](/payments/versions/v2/api-reference/webhooks/payment-result) on your server. If a notification is missing or the result needs checking, use the saved `paymentId` with [Query Payments](/payments/versions/v2/api-reference/endpoints/query-payments). Fulfil the order only after server-side confirmation of success. See [Webhooks](/payments/versions/v2/get-started/webhooks) for signature verification, acknowledgement, idempotency, and query fallback.

## Refunds and disputes

Confirm the refund capabilities, restrictions, and dispute process applicable to your merchant with Onerway. If refunds are enabled, follow [Refunds](/payments/versions/v2/online-payments/scenarios/refunds).

## Testing and go-live

Confirm the test environment and available JD Pay physical-goods test procedure with Onerway, then use [Sandbox Testing](/payments/versions/v2/get-started/testing) to verify:

1. Test each path you use with a physical-goods order, using the order currency in the table above for the customer country/region (GBP or EUR), `metaData` containing `bizTP="100001"`, and `paymentMode=WEB`. For the Direct API, check that the returned redirect opens the JD Pay page. For Checkout, check that the first `redirectUrl` opens Checkout and JD Pay is available before proceeding to its payment page.
2. Continue to the JD Pay payment page, check the payment details, and complete the agreed payment test. Confirm the result on your server. Opening the payment page alone does not pass payment acceptance.
3. Test leaving the payment page and returning before the final result is known. Also test query fallback for a missing notification and idempotent handling of duplicate notifications.
4. During go-live acceptance, retain the notification and acknowledgement for the same order and query it once to check that the results agree. Verify production enablement for this business type, notification and return URLs, limits, and expiry. Test refunds separately if enabled.
