> 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/archived-tokenization-api-2.0/integration-guide/payment-method.md).

# Payment Method

## <mark style="color:purple;">Payment Method Object</mark>

| Parameter name                                                             | Type   | Description                                                                                                                        |
| -------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| id                                                                         | String | Payment Method ID generated by Coda                                                                                                |
| shopper\_id                                                                | String | Shopper ID generated by Coda                                                                                                       |
| type                                                                       | String | Type of the payment method                                                                                                         |
| [Object](/codapay/archived-tokenization-api-2.0/payment-method-details.md) | Object | Payment Type Object and it will vary depending on specific payment type and Refers to the relevant Payment Object for more details |

## <mark style="color:purple;">Base URL</mark>

<table><thead><tr><th width="107">Version</th><th>Base URL</th></tr></thead><tbody><tr><td>Sandbox</td><td>https://api-tc.codapayments-staging.com</td></tr><tr><td>Production</td><td>https://api-tc.codapayments.com</td></tr></tbody></table>

## <mark style="color:purple;">Endpoints</mark>

{% tabs %}
{% tab title="Unset" %}

```
POST {Base URL}/v1/payment-methods
GET  {Base URL}/v1/payment-methods/{paymentmethod.id}
```

{% endtab %}
{% endtabs %}

## <mark style="color:purple;">Create Payment Method</mark>

### <mark style="color:purple;">POST /payment-methods</mark>

{% tabs %}
{% tab title="Unset" %}

```json
curl --location '{baseUrl}/v1/payment-methods' \
--header 'X-Partner-Id: par_sg1882402279a0000' \
--header 'X-Api-Key: sdirugnvsiguhsirghsekjhgh' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXJ0bmVyX2lkIjoicGFyX3NnMTg4MjQwMjI3OWEwMDAwIiwiaWF0IjoxNzAxMjMzNTM0fQ.o_tcEJUEwEms49J0MXwvRuCGbsBx3rHugfgKsXVgj9I' \
--data '{
  "shopper_id": "shp_sg18c196c9bd50006",
  "type": "card",
  "card": {
    "country_code": "SA"
  }
}'
```

{% endtab %}
{% endtabs %}

### <mark style="color:purple;">Response</mark> [<mark style="color:purple;">Payment Method Object</mark>](#payment-method-object)

{% tabs %}
{% tab title="Unset" %}

```json
{
    "id": "pmt_sg18bfbbbcb680002",
    "shopper_id": "shp_sg18bfb6894ea0000",
    "type": "card",
    "card": {
        "id": "crd_sg18bfbbbcc4b0001",
        "country_code": "SA",
    "last_four": null
    }
}
```

{% endtab %}
{% endtabs %}

## <mark style="color:purple;">Retrieve Payment Method</mark>

### <mark style="color:purple;">GET /payment-methods/{paymentmethod.id}</mark>

{% tabs %}
{% tab title="Unset" %}

```json
curl --location '{baseUrl}/v1/payment-methods/pmt_sg18c19753ad70005' \
--header 'X-Partner-Id: par_sg1882402279a0000' \
--header 'X-Api-Key: sdirugnvsiguhsirghsekjhgh' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXJ0bmVyX2lkIjoicGFyX3NnMTg4MjQwMjI3OWEwMDAwIiwiaWF0IjoxNzAxMjMzNTM0fQ.o_tcEJUEwEms49J0MXwvRuCGbsBx3rHugfgKsXVgj9I' \
--data ''
```

{% endtab %}
{% endtabs %}

### <mark style="color:purple;">Response</mark> [<mark style="color:purple;">Payment Method Object</mark>](#payment-method-object)

{% tabs %}
{% tab title="Unset" %}

```json
{
    "id": "pmt_sg18bfbbbcb680002",
    "shopper_id": "shp_sg18bfb6894ea0000",
    "type": "card",
    "card": {
        "id": "crd_sg18bfbbbcc4b0001",
        "country_code": "SA",
    "last_four": xxxx
    }
}
```

{% endtab %}
{% endtabs %}

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

<table><thead><tr><th width="176">Parameter Name</th><th width="86">Type</th><th width="104">Required</th><th width="209">Description</th><th>Validation</th></tr></thead><tbody><tr><td>shopper_id</td><td>String</td><td>Yes</td><td>Shopper ID generated by Coda</td><td>Size must be between 20 and 32<br><br>Must match "[A-Za-z]+_[A-Za-z0-9]+</td></tr><tr><td>type</td><td>String</td><td>Yes</td><td>Type of the payment method.<br>Available types: Refer to <a href="/pages/Yxw6f9qRJLaeogAJaZ68">Payment Method</a></td><td>Size must be between 3 and 64<br><br>Must match "[a-zA-Z0-9_]+"</td></tr><tr><td>Object</td><td>Object</td><td>Yes</td><td>Refer to <a href="/pages/Yxw6f9qRJLaeogAJaZ68">Payment Method Details</a> Chapter</td><td>Numeric not null</td></tr></tbody></table>


---

# 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/archived-tokenization-api-2.0/integration-guide/payment-method.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.
