> For the complete documentation index, see [llms.txt](https://docs.coda.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coda.co/codapay/hosted-payment-page-integration/initiate-usd-transactions/request-flow.md).

# Request Flow

## <mark style="color:purple;">Call Flow of USD Transaction Initiation</mark>

<figure><img src="/files/PuzN9uwPLD5q7FoP1GLQ" alt=""><figcaption></figcaption></figure>

There are no changes to the Codapay API structure. Simply send the desired ISO 4217 currency code in the "currency" parameter of the Init request.

For USD, the ISO code is `840`.

## <mark style="color:purple;">**Request Flow**</mark>

1. When the partner needs to request US dollars, the request parameter currency must use 840.
2. When the user pays, Coda payment page will convert and display in local currency.
3. Coda payment page shows the price in local currency, based on the conversion rate of the day in the Coda system.

## <mark style="color:purple;">Sample Request and Response</mark>

{% tabs %}
{% tab title="v2.0 Request" %}

```json
{
    "initRequest": {
        "country": 158,
        "payType": 0,
        "apiKey": "live_****************************",
        "projectId": 21 //This field is only needed for v2.0 API
        "orderId": "12321312321314",
        "currency": 840, //Currency code (e.g., 840 = USD)
        "items": [
            {
                "code": "1",
                "price": 1000.00,
                "name": "Test Item"
            }
        ],
        "profile": {
            "entry": [
                {
                    "key": "user_id",
                    "value": "105"
                }
            ]
        }
    }
}
```

{% endtab %}

{% tab title="v1.0 Request " %}

```json
{
    "initRequest": {
        "country": 158,
        "payType": 82,
        "apiKey": "e944d4*****************",
        "orderId": "12321312321314",
        "currency": 840, //Currency code (e.g., 840 = USD)
        "items": [
            {
                "code": "1",
                "price": 1000.00,
                "name": "Test Item"
            }
        ],
        "profile": {
            "entry": [
                {
                    "key": "user_id",
                    "value": "105"
                }
            ]
        }
    }
}

```

{% endtab %}

{% tab title="Successful Response" %}

```json
{
    "initResult": {
        "redirectUrl": "https://airtime.codapayments.com/airtime/begin?txn_id=7714940366302672840",
        "resultCode": 0,
        "txnId": 7714940366302672840
    }
}
```

{% endtab %}

{% tab title="Failed Response" %}

```json
{
    "initResult": {
        "resultCode": 103,
        "resultDesc": "This transaction has been cancelled. No charges were made. (error:103)",
        "txnId": 0
    }
}
```

{% endtab %}
{% endtabs %}

An example is provided below, using Coda's channel selection page paytype=0. After requesting to pull up the page, users can see the channels they can choose from along with their respective local prices.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.coda.co/codapay/hosted-payment-page-integration/initiate-usd-transactions/request-flow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
