# stc pay

> Accept stc pay payments through the Direct API, Checkout, or Web SDK with customer and product details supplied in advance, confirm payment on your server, and handle delivery information for settlement.

## Basic information

Customers verify their stc pay account and confirm payment on the hosted page.

- Integration paths: [Direct API](/payments/online-payments/api), [Checkout](/payments/online-payments/checkout), [Web SDK](/payments/online-payments/sdk)
- Transaction type: One-time payment
- `lpmsInfo.lpmsType`: `stcpay`
- Web SDK `config.paymentMethod`: `['stcpay']`

| Customer country/region | Order currency |
| --- | --- |
| 🇸🇦 SA | SAR |

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

This guide covers enabled configurations for one-time purchases of physical or digital goods. It applies when you collect the customer and product details before creating the payment, as described in [Before you begin](#before-you-begin). Before using another market or order currency, confirm the enabled scope for your merchant account and application with Onerway, then check the current order with [List available payment methods](/payments/api-reference/endpoints/list-available-payment-methods).

## Before you begin

Complete [Setup](/payments/get-started/setup) and confirm that stc pay is enabled. Also confirm transaction limits, the applicable payment validity period, settlement arrangements, and the test procedure. For amount formatting, see [Currency and amount validation](/payments/get-started/currency-and-amount).

Confirm that your merchant account and application are enabled for stc pay and the product categories you sell. Collect a stable customer identifier, billing name, email, phone number, and country; for physical goods, also collect the delivery recipient’s full contact and address details. Use the customer’s actual billing and shipping countries. Configure your notification and return URLs, and store the mapping between your order and the Onerway identifiers.

For each integration path on this page, prepare the following details before creating the payment. Follow the field conditions of the API you use. The shared API Reference example does not include all of these method-specific details.

| Field | Value for this flow |
| --- | --- |
| [`merchantCustId`](/payments/api-reference/endpoints/create-checkout-payment#request-merchantCustId) | Stable customer identifier in your system; reuse it for the same customer. |
| [`billingInformation`](/payments/api-reference/endpoints/create-checkout-payment#request-billingInformation) | Collected `firstName`, `lastName`, `email`, `country`, `phone`, and `phoneCountryCode`. Follow the API format for the local number and separate country code. |
| [`shippingInformation`](/payments/api-reference/endpoints/create-checkout-payment#request-shippingInformation) | Follow the API conditions, including its required email and country. For physical goods, also provide the recipient’s `firstName`, `lastName`, `phone`, `phoneCountryCode`, `city`, `address`, and `postalCode`. For digital goods, the API’s required fields still apply. |
| [`txnOrderMsg.products`](/payments/api-reference/endpoints/create-checkout-payment#request-txnOrderMsg-products) | Include the product name, quantity, unit price, currency, `type`, and `productAvatarUrl`. Categorize merchandise as `physical` or `virtual`; retain the API’s distinct types for shipping-fee and discount lines. |
| [`txnOrderMsg.customerPlatform`](/payments/api-reference/endpoints/create-checkout-payment#request-txnOrderMsg-customerPlatform) | Your website domain for web purchases or application name for app purchases. |

Encode `billingInformation`, `shippingInformation`, and `txnOrderMsg` as JSON strings. The nested `txnOrderMsg.products` value is also a JSON string. Follow the [product field definitions](/payments/api-reference/endpoints/create-checkout-payment#request-txnOrderMsg-products) for amounts and image requirements.

## Start the payment

### Direct API

1. Check [List available payment methods](/payments/api-reference/endpoints/list-available-payment-methods) for the current order. After the customer selects this method, call [Create direct transaction](/payments/api-reference/endpoints/direct-create-transaction) from your server with `productType=LPMS`, `subProductType=DIRECT`, `txnType=SALE`, and `paymentMode=WEB`. Set `lpmsType=stcpay` in [`lpmsInfo`](/payments/api-reference/endpoints/direct-create-transaction#request-lpmsInfo), encoded as a JSON string.
2. Supply the stable [`merchantCustId`](/payments/api-reference/endpoints/direct-create-transaction#request-merchantCustId) and all customer and product details prepared above. Encode `billingInformation`, `shippingInformation`, and `txnOrderMsg` as JSON strings, including the nested `txnOrderMsg.products` JSON string. Include notification and return URLs, and merchant-collected end-user IP, browser, and device information in [`txnOrderMsg`](/payments/api-reference/endpoints/direct-create-transaction#request-txnOrderMsg). Use SAR for the order and products; product amounts, discounts, and shipping fees 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 `stcpay`, use SAR, and supply the actual order together with the customer identifier, billing, recipient, product category and image, and `customerPlatform` details described above. Apply the recipient requirements for the actual product type. 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 stc pay page guides the customer through payment. When the customer returns to your site, display the result retrieved from your server. See [Request signing](/payments/get-started/request-signing) for authentication.

### Checkout

When locking Checkout to this method, first call [List available payment methods](/payments/api-reference/endpoints/list-available-payment-methods) for the current order and confirm that the method is returned. When Checkout displays all available methods, Onerway performs this filtering.

1. On your server, call [Create checkout payment](/payments/api-reference/endpoints/create-checkout-payment) with `productType=ALL`, `subProductType=DIRECT`, and `txnType=SALE`. To show only stc pay, set [`lpmsInfo.lpmsType`](/payments/api-reference/endpoints/create-checkout-payment#request-lpmsInfo) to `stcpay`, sending `lpmsInfo` as a JSON string. If you omit `lpmsInfo`, the customer chooses from the methods available for the order.
2. Submit the stable customer identifier in the top-level [`merchantCustId`](/payments/api-reference/endpoints/create-checkout-payment#request-merchantCustId), together with the required billing, shipping, product, return URL, and notification URL fields. Encode [`billingInformation`](/payments/api-reference/endpoints/create-checkout-payment#request-billingInformation) and `shippingInformation` as JSON strings. Keep product and order currencies consistent, and ensure that product amounts, discount entries, and shipping fees add up to `orderAmount`.<br />Select the request example “Unified Checkout with all available payment methods”. Replace the order and customer details, use SAR for this flow, supply all the customer and product details listed above, and add this method’s `lpmsInfo` if you want to select only stc pay. Remove the example’s `cardInfo` object for this flow. 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 that payment has not been completed.
4. Checkout handles the payment page and subsequent customer interaction. When the customer reaches `returnUrl`, display the result retrieved from your server. For signing, redirects, and return handling, see [Checkout integration](/payments/online-payments/checkout).

### Web SDK

This flow uses the default Payment Element with the customer, recipient, and product details above supplied when creating the transaction. The SDK collects device information; this does not replace the customer details.

1. On your server, call [Create SDK transaction](/payments/api-reference/endpoints/sdk-create-transaction) with `productType=ALL`, `subProductType=DIRECT`, `txnType=SALE`, and an order in SAR. At creation, supply the top-level [`merchantCustId`](/payments/api-reference/endpoints/sdk-create-transaction#request-merchantCustId), [`billingInformation`](/payments/api-reference/endpoints/sdk-create-transaction#request-billingInformation), and [`shippingInformation`](/payments/api-reference/endpoints/sdk-create-transaction#request-shippingInformation). Include products, your website domain as `customerPlatform`, and notification and return URLs in [`txnOrderMsg`](/payments/api-reference/endpoints/sdk-create-transaction#request-txnOrderMsg). Encode these objects and the nested `products` value as JSON strings as specified by the API. For a standard Web SDK flow, omit `paymentMode` and `osType`; the SDK collects the end-user IP, browser, and device information.
2. Select the request example **One-time SDK payment**. Replace the order, customer, and application details, use SAR for the order and products, and supply the method-specific details listed above. Retain the requirements for the actual product type and recipient. Select the response example **One-time SDK transaction created** and store `paymentId` against your order. Initialize the client with `paymentId`; do not start this flow using the creation response's `redirectUrl`.
3. Follow [Web SDK integration](/payments/online-payments/sdk) to create a Checkout instance, register event listeners, and then mount the Payment Element. To display only stc pay, set `config.paymentMethod=['stcpay']` and check that `stcpay` is present in `availablePaymentMethods` from the `ready` event. Filtering narrows the methods available for the order; it does not enable an unavailable method.
4. When the customer selects stc pay and confirms payment, call `confirmPayment()` and let the SDK handle the customer interaction. For `paymentStatus=R` with `nextAction.type=PresentToShopper`, retain the same Checkout instance and mounted Payment Element, and wait for `payment_result` without confirming again. For `RedirectShopper`, query the result on your server when the customer returns to `returnUrl`. Do not assume that every payment uses the same action.
5. Follow the customer and final-result steps below. SDK events, a displayed page, or a browser return do not replace server-side notification and query handling. The logistics-upload requirements after delivery of physical goods also apply to this path.

## Customer actions and final result

Customers enter or check their stc pay phone number on the hosted page, request and enter the SMS verification code as instructed, review the amount, and confirm payment. Your application does not collect the verification code or build its own stc pay verification form.

Customers may leave before completing verification or payment. Receiving a code, completing verification, or returning to your site does not confirm payment. Keep the order awaiting confirmation until your server retrieves the result.

Process the order using a signature-verified [payment result webhook](/payments/api-reference/webhooks/payment-result). If no notification has arrived or you need to check the result, call [Query payments](/payments/api-reference/endpoints/query-payments) with the stored `paymentId`. Fulfill the order only after your server confirms a successful payment. For verification, acknowledgement, idempotency, and query fallback, see [Webhooks](/payments/get-started/webhooks).

## Delivery information and settlement

For physical goods, fulfill the order after your server confirms successful payment. Once the package has actually been delivered and signed for, call [Upload logistics information](/payments/api-reference/endpoints/upload-logistics-info) for that successful transaction. Use its original `transactionId`, select `carrierNo` from the linked carrier list, and submit the real `trackingNo`. The API Reference contains the shared request example and signing requirements.

Payment success and settlement eligibility are separate. Delivery information is used for subsequent settlement processing; a successful upload response does not mean that settlement funds have arrived. Submitting the same `transactionId` again replaces the saved logistics information, so verify corrections before resubmitting.

For digital-goods purchases, you do not upload logistics information.

## Refunds and disputes

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

## Testing and go-live

Confirm the test environment and available stc pay test procedure with Onerway, then follow [Sandbox testing](/payments/get-started/testing):

1. Test each path you use with SAR and the customer, product, and recipient details required for the product type. For the Direct API, check that the returned redirect opens the stc pay payment page. For Checkout, check that the first `redirectUrl` opens Checkout and stc pay is available before proceeding to the payment page. For Web SDK, verify that `ready` includes `stcpay`, the default component allows selection, and confirmation handles the returned action. A customer cancelling or clicking repeatedly must not create or confirm duplicate payments.
2. Open the hosted stc pay page and check the phone-number, SMS-verification, and payment-confirmation steps. Complete the agreed payment test and verify the result on your server. Completing verification alone does not pass the successful-payment check.
3. Test a customer leaving before payment, failed verification or payment, and a return to your site before a final result. Verify query fallback when no notification has arrived and idempotent handling of duplicate notifications. For physical goods, separately verify the agreed logistics-upload procedure after the package has been delivered and signed for; do not use fabricated shipment details.
4. For go-live acceptance, retain the notification and acknowledgement for the same order. Query the payment status and check that it matches the notification. Check production enablement, notification and return URLs, limits, and validity periods. Test refunds separately if they are enabled.
