> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# Direct Carrier Billing via Boku

> Set up Direct Carrier Billing through Boku in Payrails: the OTP opt-in, the confirm request and later subscription charges.

<picture noZoom>
  ![Direct Carrier Billing logo](https://assets.payrails.io/img/logos/dcb/logo.svg)
</picture>

<picture noZoom>
  ![Boku logo](https://assets.payrails.io/img/logos/boku/logo-full-bleed.svg)
</picture>

Accept [Direct Carrier Billing](https://docs.payrails.com/docs/integrations/payment-methods/direct-carrier-billing) (DCB) payments with Boku as the payment service provider (PSP). The customer confirms the first payment with a one-time password (OTP) sent to their phone. Payrails saves the Boku opt-in and charges later payments to the same carrier account without a new OTP.

## Supported workflows

<table>
  <thead>
    <tr><th>Workflow</th><th>Supported</th></tr>
  </thead>

  <tbody>
    <tr><td>Payrails SDK</td><td>✔</td></tr>
    <tr><td>Payrails API</td><td>✔</td></tr>
    <tr><td>[Delayed / Manual Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✖</td></tr>
    <tr><td>[Instant Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✔</td></tr>
    <tr><td>[Cancel / Void](https://docs.payrails.com/docs/orchestration/payment-acceptance/cancel-a-payment.md)</td><td>✖</td></tr>
    <tr><td>[Refund / Reverse](https://docs.payrails.com/docs/orchestration/payment-acceptance/refund-a-payment.md)</td><td>✔</td></tr>
    <tr><td>[Save Instruments](https://docs.payrails.com/docs/resources/manage-instruments.md)</td><td>✔</td></tr>
    <tr><td>[Merchant Initiated Transaction (MIT)](https://docs.payrails.com/docs/resources/payments/authorization-flags.md)</td><td>✔</td></tr>
  </tbody>
</table>

## Before you begin

Complete these steps before you send your first DCB payment through Boku:

1. Set up a Boku integration in your workspace. Follow the [Boku integration setup guide](https://docs.payrails.com/docs/integrations/payment-providers/boku.md) if you don't have one yet.
2. Ask Boku to enable DCB on your Boku merchant account for each country and carrier you plan to bill.
3. In the Payrails Portal, go to **Settings → Integrations**, open your Boku integration, select **DCB** under **Payment methods**, and save.
4. Add DCB as a [payment option](https://docs.payrails.com/docs/integrations/payment-methods/set-up-payment-methods.md) in your workflow.

## Request fields for Boku

Send these fields in the authorize request, in addition to the standard [authorize fields](https://docs.payrails.com/reference/authorizeaction.md). **Required** fields must be present for the payment to succeed. Payrails sends **Optional** fields to the PSP when you include them.

| Field | Status | Description |
| - | - | - |
| `meta.customer.country.code` | Required | The customer's carrier country, such as `AE`. Payrails uses it to pick the Boku endpoint for the country. Send it on every payment and refund. |
| `meta.customer.phone.number` | Required | The customer's full mobile number with the country dialing code and no plus sign, such as `971501234567`. Needed on the first payment, where Payrails sends it to Boku to start the opt-in. |
| `meta.order.description` | Required | Between one and 255 characters. Sent to Boku as the item description on each charge. |
| `meta.order.processingType` | Optional | Send `Subscription` or `CardOnFile` on later payments with a saved instrument. Payrails then charges the saved opt-in. |

## Authorize a DCB payment

The first payment for a customer has two steps: authorize to start the opt-in, then confirm with the OTP.

### Start the opt-in

Call [authorize a payment](https://docs.payrails.com/reference/authorizeaction.md) with `dcb` as the `paymentMethodCode`. Set `storeInstrument` to `true` to reuse the opt-in for later payments.

```json Authorize request theme={null}
{
  "amount": {
    "value": "10.00",
    "currency": "AED"
  },
  "paymentComposition": [
    {
      "integrationType": "api",
      "paymentMethodCode": "dcb",
      "storeInstrument": true,
      "amount": {
        "value": "10.00",
        "currency": "AED"
      }
    }
  ],
  "meta": {
    "customer": {
      "phone": {
        "number": "971501234567"
      },
      "country": {
        "code": "AE"
      }
    },
    "order": {
      "description": "Example Streaming monthly plan"
    }
  },
  "returnInfo": {
    "success": "https://example.com/success",
    "error": "https://example.com/error"
  }
}
```

Boku sends an OTP to the customer's phone. The payment stays pending, and the response asks you to confirm it.

### Confirm with the OTP

Collect the OTP from the customer, then call [confirm a payment](https://docs.payrails.com/reference/confirmaction.md) on the same execution. Send the OTP as `data.otp`:

```json Confirm request theme={null}
{
  "data": {
    "otp": "123456"
  }
}
```

Payrails validates the OTP with Boku, confirms the opt-in and charges the payment amount. When the charge succeeds, the payment is complete and Payrails saves the opt-in as a payment instrument.

### Charge later payments

For a later payment, authorize with the saved instrument's ID as `paymentInstrumentId` and set `meta.order.processingType` to `Subscription` or `CardOnFile`. Payrails charges the Boku opt-in directly. The customer doesn't enter an OTP, and you don't send a confirm request.

```json Authorize request theme={null}
{
  "amount": {
    "value": "10.00",
    "currency": "AED"
  },
  "paymentComposition": [
    {
      "integrationType": "api",
      "paymentMethodCode": "dcb",
      "paymentInstrumentId": "4e2f7b1a-0c3d-4b8e-9f6a-2d5c8e1b7a90",
      "amount": {
        "value": "10.00",
        "currency": "AED"
      }
    }
  ],
  "meta": {
    "customer": {
      "country": {
        "code": "AE"
      }
    },
    "order": {
      "description": "Example Streaming monthly plan",
      "processingType": "Subscription"
    }
  }
}
```

Confirm the result of each payment through [webhook notifications](https://docs.payrails.com/docs/orchestration/payment-acceptance/receive-notifications.md) or the execution status before you grant access.

## How Boku handles DCB

* Boku identifies the customer's carrier during the opt-in. Payrails stores the carrier, the country and the mobile number on the saved instrument.
* A first payment with a zero amount only creates the opt-in. Payrails confirms it with the OTP and charges nothing. Use it to start a free trial, then charge the first real amount later.
* When you delete a saved DCB instrument, Payrails cancels the opt-in with Boku.
* To refund a DCB payment, send `meta.customer.country.code` on the refund request too. Payrails uses it to reach the Boku endpoint for the country.


## Related topics

- [Direct Carrier Billing](https://docs.payrails.com/docs/integrations/payment-methods/direct-carrier-billing.md)
- [Boku](https://docs.payrails.com/docs/integrations/payment-providers/boku.md)
- [SEPA Direct Debit via Stripe](https://docs.payrails.com/docs/integrations/payment-methods/sepa-direct-debit/stripe.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.