# Dana for Payment Setup API
To accept Dana payments, you must:
1. Create a payment setup.
2. Confirm the payment.
3. Redirect the customer to Dana.
---
## Create a payment setup
Call the [Create a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/createAPaymentSetup) endpoint.
> **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/setups`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups`
### Request example
```json
{
"amount": 110000,
"currency": "IDR",
"payment_methods": {
"dana": {
"terminal_type": "app"
}
},
"settings": {
"success_url": "https://example.com/payments/success",
"failure_url": "https://example.com/payments/failure"
}
}
```
In the request body, provide the following:
| Field | Description |
| --- | --- |
| `amount`
`number` | The payment amount, in the [minor currency unit](https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value).
Minimum: 1
**Required** |
| `currency`
`string` | Three-letter ISO 4217 [currency code](https://www.checkout.com/docs/developer-resources/codes/currency-codes.md).
Supported value: `IDR`
**Required** |
| `payment_methods.dana.terminal_type`
`string` | The type of terminal used for the payment.
Supported values:
- `app`
- `wap`
- `web`
**Required** |
| `settings.failure_url`
`string` | The URL to redirect the customer to if the payment fails.
Format: URI
Max length: 1024
**Required** |
| `settings.success_url`
`string` | The URL to redirect the customer to if the payment is successful.
Format: URI
Max length: 1024
**Required** |
| `description`
`string` | A description of the payment.
Max length: 100 |
| `payment_methods.dana.os_type`
`string` | The operating system of the customer's device.
Required if `terminal_type` is `wap` or `app`.
Supported values:
- `android`
- `ios` |
| `reference`
`string` | A reference you can use to identify the payment.
Max length: 80 |
### Response example
```json
{
"id": "set_rcmepwrchqab2wsergcafvijfy",
"processing_channel_id": "pc_wzjki6hw5puepb5fnvqlizj2e4",
"amount": 110000,
"currency": "IDR",
"payment_type": "Regular",
"reference": "ORDER_01234",
"description": "Dana payment",
"payment_methods": {
"dana": {
"status": "ready",
"flags": []
}
},
"available_payment_methods": [
"dana"
],
"settings": {
"success_url": "https://example.com/payments/success",
"failure_url": "https://example.com/payments/failure"
}
}
```
The response returns a `payment_methods` object, which contains the payment methods enabled on your account.
When all required fields are present, the `payment_methods.dana` object shows a `ready` [status](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-using-the-payment-setup-api.md#Payment_method_status).
---
## Confirm the payment
Confirm the payment by calling the [Confirm a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/confirmAPaymentSetup) endpoint and provide:
- The payment setup `id` as the `{id}` path parameter.
- `dana` as the `{payment_method_name}` path parameter.
### Request example
**Production**
`POST` `https://{prefix}.api.checkout.com/payments/setups/{id}/confirm/dana`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups/{id}/confirm/dana`
### Response example
```json
{
"id": "pay_sxzrgliy2w3e5gpnby3chlswwq",
"status": "Pending",
"reference": "ORDER_01234",
"customer": {
"id": "cus_2g4ehcpm6phexgkzahlwxvbgne"
},
"_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 the customer to the `redirect.href` URL from the response. The customer completes the payment on the Dana page and is then redirected back to your `settings.success_url` or `settings.failure_url`.