# Maya

> Accept one-time Maya payments through the Direct API, Checkout, or the Web SDK, and confirm the result on your server.

## Basic information

Maya is a wallet used by customers in the Philippines.

- 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`: `PayMaya`
- Web SDK `config.paymentMethod`: `['PayMaya']`

| Customer country/region | Order currency |
| --- | --- |
| 🇵🇭 PH | PHP |

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

Maya keeps the legacy identifier `PayMaya` for `lpmsInfo.lpmsType`. This guide covers enabled configurations. All paths described here require billing name, email, country, and a government-issued identity identifier supplied in advance; the Direct API also uses the phone and address details listed below.

Before integrating another market or using another order currency, confirm the enabled scope for your merchant account and application with Onerway, then use [List available payment methods](/payments/api-reference/endpoints/list-available-payment-methods) to check the current order.

## Before you begin

Complete [Setup](/payments/get-started/setup) and confirm with Onerway that Maya is enabled. Also confirm the customer identity requirements, applicable transaction limits, payment validity period, and settlement arrangements. For amount formatting, see [Currency and amount validation](/payments/get-started/currency-and-amount).

Collect accurate customer billing details and submit them in `billingInformation` when creating the payment. Use the customer’s actual billing country. Configure your server notification URL and customer return URL, and store the mapping between your order and `paymentId`.

## Start the payment

### Direct API

For this Direct API flow, collect the customer details before creating the payment and supply `firstName`, `lastName`, `email`, `country`, `identityNumber`, `phoneCountryCode`, `phone`, `city`, `province`, `postalCode`, `street`, and `number` in [`billingInformation`](/payments/api-reference/endpoints/direct-create-transaction#request-billingInformation). Use the customer’s actual billing country and follow the API conditions for shipping information and any other fields.

Use a local phone number without its country code in `phone`, and the corresponding dialing code as digits without `+` in `phoneCountryCode`. Submit the customer’s government-issued identity identifier in `identityNumber`, following the requirements for your enabled configuration. Use `street` for the street name and `number` for the house number. Supply `birthDate` and the full `address` according to the API conditions.

1. Check [List available payment methods](/payments/api-reference/endpoints/list-available-payment-methods) for the current order. After the customer selects Maya, 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=PayMaya` in [`lpmsInfo`](/payments/api-reference/endpoints/direct-create-transaction#request-lpmsInfo), encoded as a JSON string.
2. Supply the customer details listed above in `billingInformation`, and follow the API requirements for `shippingInformation`. Encode both as JSON strings. Include products, 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). 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 `PayMaya`, use PHP for this flow, and supply the actual order and the customer details required by this Direct flow. The example amount does not establish a transaction limit.
3. Store the returned `paymentId` and `transactionId`. When `status=R` and `actionType=RedirectURL`, direct the customer to the returned `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 customer follows the payment flow opened by the returned URL to complete authorization or payment confirmation. 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

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 Maya, set [`lpmsInfo.lpmsType`](/payments/api-reference/endpoints/create-checkout-payment#request-lpmsInfo) to `PayMaya`, sending `lpmsInfo` as a JSON string. If you omit `lpmsInfo`, the customer chooses from the methods available for the order.
2. Supply the billing, shipping, product, return URL, and notification URL fields required by the API. Encode `billingInformation` and `shippingInformation` as JSON strings, including the required email and country for each. 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, and add this method's `lpmsInfo` if you want to select only this method. Use PHP for this flow. Remove the example’s `cardInfo` object for this flow.
For this Checkout flow, also include the collected `firstName`, `lastName`, and [`identityNumber`](/payments/api-reference/endpoints/create-checkout-payment#request-billingInformation-identityNumber) in `billingInformation`, along with the customer’s `email` and `country`.
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. Onerway Checkout handles the payment page and customer payment interaction. When the customer reaches `returnUrl`, retrieve the order result from your server. If no notification has arrived, use the stored transaction identifier to [Query transactions](/payments/api-reference/endpoints/query-transactions). For signing, redirects, and return handling, see [Checkout integration](/payments/online-payments/checkout).

### Web SDK

Keep the SDK payment-method interface and provide the customer details for this SDK path when creating the transaction. Submit `firstName`, `lastName`, `email`, `country`, and `identityNumber` in [`billingInformation`](/payments/api-reference/endpoints/sdk-create-transaction#request-billingInformation), encoded as a JSON string. Follow the API conditions for other fields. The linked “One-time SDK payment” example omits these billing details; add them when implementing this flow.

1. On your server, call [Create SDK transaction](/payments/api-reference/endpoints/sdk-create-transaction) with `productType=ALL`, `subProductType=DIRECT`, and `txnType=SALE`. Select the request example “One-time SDK payment” and the response example “One-time SDK transaction created”. These examples show the shared creation flow before a payment method is selected. Replace the amount, currency, and product details with the actual order, keeping the product and order currencies consistent.
2. Initialize Checkout with the returned `paymentId`, following [Web SDK integration](/payments/online-payments/sdk). To display only this method, set `config.paymentMethod` to `['PayMaya']` in the initialization options. Then subscribe to events and mount the Payment Element. This configuration only filters methods returned by the server; it does not enable Maya.
3. In the `ready` event, check that `availablePaymentMethods` contains `PayMaya`.
4. After the customer selects Maya and completes the form, call `confirmPayment()` from your payment button. Handle the actual `paymentStatus` and `nextAction` returned. For the complete event and error handling flow, see [Web SDK integration](/payments/online-payments/sdk).

With the Web SDK, `paymentStatus=R` means that customer interaction must continue. Handle the actual `nextAction.type` returned:

- `PresentToShopper`: keep the current SDK Checkout instance and leave its Payment Element mounted while the SDK presents the payment interface, wait for `payment_result`, and do not call `confirmPayment()` again.
- `RedirectShopper`: wait for the customer to reach the `returnUrl` supplied when creating the order, then query the order on your server. Initially show that the result is being confirmed.

## Customer actions and final result

After selecting Maya, customers follow the payment page instructions to authenticate their Maya account, review the amount, and confirm payment. Authentication takes place on the payment page; your application does not collect the customer’s wallet password or verification codes.

When customers return to your site, show that the result is being confirmed and retrieve the order result from your server. Closing the wallet page or canceling the interaction does not by itself determine the final order status.

Process the order on your server using a signature-verified [payment result webhook](/payments/api-reference/webhooks/payment-result). If the notification has not 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).

## Refunds and disputes

Before integration, 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, available Maya test procedure, and customer test data with Onerway, then follow [Sandbox testing](/payments/get-started/testing):

1. Test each path you use with PHP and the customer details required for that path. For the Direct API, handle the actual response and verify that `R + RedirectURL` opens the returned URL. For Checkout, confirm that the first `redirectUrl` opens Checkout and that `PayMaya` is available. For the Web SDK, check that `ready.availablePaymentMethods` contains `PayMaya`.
2. Select Maya and complete the agreed wallet test, including account authentication and payment confirmation where the test environment supports them. Confirm the result on your server before updating the order; merely opening the payment page does not pass the successful-payment check. For go-live acceptance, retain the notification and acknowledgement for the same order, then make an active query to verify that the results agree.
3. Cancel or close the wallet page before completing payment and test the return to your site. Confirm that a return to your site alone never marks the order as paid, and test query fallback when no notification has arrived.
4. Verify idempotent handling of duplicate notifications. Before going live, check production enablement, notification and return URLs, limits, and validity periods. Test refunds separately if they are enabled.
