# Dana for Unified Payments API Dana has a 2-step process: 1. [Request a payment](#Request_a_payment). 2. [Redirect the customer](#Redirect_the_customer). When accepting payments with Dana, you need to display the Alipay+ and Dana logos on your payment interface. To ensure that the logos match Alipay's requirements, refer to their [Brand display guidelines for online payments](https://docs.alipayplus.com/alipayplus/alipayplus/ux_cashier_acq_older_edition/brand_online_acq#quwEA) and [Brand display guidelines for cashier payments](https://docs.alipayplus.com/alipayplus/alipayplus/brand_guidelines/brand_cashier_acq). --- ## Request a payment For the full API specification, see the [API reference](https://api-reference.checkout.com/). **Live** `POST` `https://{prefix}.api.checkout.com/payments` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments` ### Request example You can process Dana payments in its local currency (IDR) or in the currencies associated with your entity. Use the `currency` field in your payment request to specify the processing currency. If a customer ID or email is not provided in the request, we automatically create a customer profile and return the customer ID in the response. ```json { "amount": 1100, "currency": "IDR", "source": { "type": "dana" }, "processing": { "terminal_type": "APP", "os_type": "IOS" }, "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure", "payment_type": "Regular", "reference": "ORD-5023-4E89", "capture": true, "customer": { "name": "John Smith", "email": "john.smith@example.com" }, "shipping": { "address": { "country": "GB" } }, "items": [ { "reference": "1st item reference", "name": "1st item name", "unit_price": 10 } ], "processing_channel_id": "pc_ekaubqrravqupfxde7kxvd2t3i" } ``` ### Response example If you receive a `202 Success` response with a payment `id` and a `status` field set to `Pending`, your request was successful. ```json { "id": "pay_sxzrgliy2w3e5gpnby3chlswwq", "status": "Pending", "reference": "ORD-5023-4E89", "customer": { "id": "cus_2g4ehcpm6phexgkzahlwxvbgne", "email": "john.smith@example.com", "name": "John Smith" }, "_links": { "self": { "href": "https://{prefix}.api.checkout.com/payments/pay_sxzrgliy2w3e5gpnby3chlswwq" }, "redirect": { "href": "https://psp.ac.alipay.com/page/simulation-wallet/acwallet/alipayconnectcode.html?code=281666040095AHvh5AIKT0a3kv8X6Zzv3kiv&pspName=DANA&loadMode=2" } } } ``` --- ## Redirect the customer Redirect your customer to the `redirect` link’s `href` in the response. This will allow the customer to authorize the payment, before they are transferred to your predefined success or failure URL. --- ## Request a recurring payment You can set up recurring payments for a subscription-based service. This allows you to make pre-authorized fund deductions from a customer’s account. To request a recurring payment, your payment request should have `payment_type` set to `recurring`. To get a detailed view of all required and optional fields, see our [API reference](https://api-reference.checkout.com/). > **Information** > > Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md). **Production** `POST` `https://{prefix}.api.checkout.com/payments` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments` ### Initial request example ```json { "amount": 1100, "currency": "EUR", "source": { "type": "dana" }, "processing": { "terminal_type": "WEB" }, "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure", "payment_type": "Recurring", "reference": "ORD-5023-4E89", "capture": "true", "customer": { "email": "john.smith@example.com", "name": "John Smith" }, "shipping": { "address": { "country": "GB" } }, "items": [ { "reference": "1st item reference", "name": "1st item name", "unit_price": 10 } ], "processing_channel_id": "pc_ekaubqrravqupfxde7kxvd2t3i" } ``` ### Initial response example If you receive a `202 Success` response with a payment `id` and a `status` field set to `Pending`, your request was successful. ```json { "id": "pay_4z3h7526xn6evko3vnybrmnu4e", "status": "Pending", "reference": "ORD-5023-4E89", "customer": { "id": "cus_2g4ehcpm6phexgkzahlwxvbgne", "email": "john.smith@example.com", "name": "John Smith" }, "source": { "id": "src_gnyde6bvifsukobwjb2vkwkbni", "type": "dana" }, "_links": { "self": { "href": "https://{prefix}.api.checkout.com/payments/pay_4z3h7526xn6evko3vnybrmnu4e" }, "redirect": { "href": "https://g.alipayplus.com/page/aplus-linker/acwallet/qrcode.html?url=alipayconne" } } } ``` ### Subsequent request example ```json { "amount": 44, "currency": "EUR", "source": { "type": "id", "id": "src_inmwstthmjyfcskeir3gcqtyj4" }, "payment_type": "Recurring", "reference": "ORD-5023-4E89-1234", "customer": { "name": "John Smith", "email": "john.smith@example.com" }, "shipping": { "address": { "country": "GB" } }, "items": [ { "reference": "1st item reference", "name": "1st item name", "unit_price": 43, "quantity": 1 } ], "processing_channel_id": "pc_ekaubqrravqupfxde7kxvd2t3i" } ``` ### Subsequent response example ```json { "id": "pay_xljv6f7ye4lebinkv7i7pho634", "status": "Pending", "reference": "ORD-5023-4E89-1234", "customer": { "id": "cus_mzrvode5g2jubm4bgbaad2usbu", "email": "john.smith@example.com", "name": "John Smith" }, "source": { "id": "src_inmwstthmjyfcskeir3gcqtyj4", "type": "dana" }, "_links": { "self": { "href": "https://{prefix}.api.checkout.com/payments/pay_xljv6f7ye4lebinkv7i7pho634" } } } ``` --- ## Get details about a payment You can retrieve details about an existing Dana payment by using the payment `id` found in the payment response. Use the following details to set up your request. **Live** `GET` `https://{prefix}.api.checkout.com/payments/{id}` **Sandbox** `GET` `https://{prefix}.api.sandbox.checkout.com/payments/{id}` ### Response example ```json { "id": "pay_sxzrgliy2w3e5gpnby3chlswwq", "requested_on": "2022-09-02T07:15:58.894077Z", "source": { "type": "dana" }, "items": [ { "name": "1st item name", "unit_price": 10, "reference": "1st item reference" } ], "amount": 1100, "currency": "EUR", "payment_type": "Regular", "reference": "ORD-5023-4E89", "status": "Captured", "approved": true, "balances": { "total_authorized": 1100, "total_voided": 0, "available_to_void": 0, "total_captured": 1100, "available_to_capture": 0, "total_refunded": 0, "available_to_refund": 1100 }, "customer": { "id": "cus_mzrvode5g2jubm4bgbaad2usbu", "email": "john.smith@example.com", "name": "John Smith" }, "shipping": { "address": { "country": "GB" } }, "processing": { "partner_customer_id": "210220900020124540718" }, "_links": { "self": { "href": "https://{prefix}.api.checkout.com/payments/pay_7domcpi745nu5bdhm5rtrblbem" }, "actions": { "href": "https://{prefix}.api.checkout.com/payments/pay_7domcpi745nu5bdhm5rtrblbem/actions" }, "refund": { "href": "https://{prefix}.api.checkout.com/payments/pay_7domcpi745nu5bdhm5rtrblbem/refunds" } } } ``` --- ## Refund a payment Dana supports both partial and full refunds. You can refund a payment through the [Dashboard](https://dashboard.checkout.com) or using the [Refund API](https://www.checkout.com/docs/payments/manage-payments/refund-a-payment.md). **Live** `POST` `https://{prefix}.api.checkout.com/payments/{id}/refunds` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/{id}/refunds` ### Request example ```json { "amount": 20 } ``` ### Response example ```json { "action_id": "act_c4x2vjvnx4uelb4io72fa4e57a", "_links": { "payment": { "href": "https://{prefix}.api.checkout.com/payments/pay_fzzdurog3squjj2ityho7x3o64" } } } ``` --- ## Testing Dana To start testing, contact your account manager or implementation engineer to: - Activate Dana payments in the sandbox environment. - Get credentials to access the Alipay+ Linker app. To begin testing once you've completed merchant onboarding to Dana: 1. Sign in to the sandbox environment using the username and password provided by your account manager. 2. Create a Dana sandbox transaction by following the request a payment instructions. 3. Use the testing credentials to know what to do next depending on the device you are using. ### Testing credentials When requesting a Dana payment, there are specific steps to follow depending on the device being used and the `processing.terminal_type` specified in the payment request. | Device | processing.terminal_type | After selecting redirect link | | --- | --- | --- | | Computer | `APP` | Select _Pay Now_. | | Application | `APP` | Select _Pay Now_. | | Computer | `WEB` | For this method, make sure you have set up Dana as an e-wallet under _Common Settings_ in the Alipay+ Linker app. To choose the correct e-wallet, select _TEST_WALLET_.

1. Sign in to Alipay+ Linker app with the credentials provided by your account manager.
2. Select _Dana_ as an e-wallet under _Common Settings_.
3. Select _Scan_.
4. Scan the QR code from your computer screen.
5. Select _Pay Now_. | | Application | `WEB` | 1. Open the URL with the Alipay+ Linker app. You will be redirected to a payment confirmation page.
2. Select _Pay Now_. |