> 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/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/tokenization-api-2.0/ji-cheng-zhi-nan/payment-method.md).

# Payment Method

## Payment Method 对象

<table><thead><tr><th width="168">参数名称</th><th width="122">类型</th><th>描叙</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>Coda 生成的 Payment Method ID</td></tr><tr><td>shopper_id</td><td>String</td><td>由 Coda 生成的Shopper ID</td></tr><tr><td>type</td><td>String</td><td>支付方式类型</td></tr><tr><td><a href="/pages/Yzg3DupAnc0QUF9yg7oO">Object</a></td><td>String</td><td><strong>支付类型对象</strong>，其结构会根据具体的支付类型有所不同。请参考相应的 <strong>Payment Mehotd 对象</strong>以获取更多详细信息。</td></tr></tbody></table>

## 接口

{% tabs %}
{% tab title="接口" %}

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

{% endtab %}
{% endtabs %}

## 创建 Payment Method

### POST /payment-methods

{% tabs %}
{% tab title="Payment methods" %}

```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 %}

## 响应[Payment Method对象](#payment-method-dui-xiang)

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

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

{% endtab %}
{% endtabs %}

## 获取 Payment Method

### GET /payment-methods/{paymentmethod.id}

{% tabs %}
{% tab title="Payment method" %}

```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 %}

## 响应[Payment Method对象](#payment-method-dui-xiang)

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

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

{% endtab %}
{% endtabs %}

## 请求参数

<table><thead><tr><th width="149">参数名称</th><th width="83">类型</th><th width="77">必填？</th><th>描述</th><th>验证</th></tr></thead><tbody><tr><td>shopper_id</td><td>String</td><td>是</td><td>由 Coda 生成的购物者 ID</td><td><p>必须介于 20和 32 之间</p><p></p><p>必须符合<code>"[A-Za-z]+_[A-Za-z0-9]+</code></p></td></tr><tr><td>type</td><td>String</td><td>是</td><td>支付方式類型。可用类型：参见<a href="/pages/Yzg3DupAnc0QUF9yg7oO">支付方式</a></td><td><p>必须介于 3 和 64 之间</p><p></p><p>必须符合<code>"[a-zA-Z0-9_</code>]+"</p></td></tr><tr><td>Object</td><td>Object</td><td>是</td><td>购请参阅<a href="/pages/Yzg3DupAnc0QUF9yg7oO">支付方式详情</a>章节</td><td>数字不为空</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/https-coda-payments.gitbook.io-zhong-wen-coda-private-technical-documentation/codapay/tokenization-api-2.0/ji-cheng-zhi-nan/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.
