# Payment methods

{% openapi src="/files/AM3SZZl8CySoEL2YMS4v" path="/V2022-03/payment\_methods" method="post" %}
[gitbook .json](https://1129616527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMb9UzyxGUyxHylm4UJSJ%2Fuploads%2FaSm0HICLvmjsHIG0gPX6%2Fgitbook%20.json?alt=media\&token=02baaaa5-1304-46b3-bba2-4dbae43ffa30)
{% endopenapi %}

### 创建支付方式接口请求报文示例

{% code title="createPaymentMethod.sh" %}

```
curl --request POST \
  --url https://{paymentApiUrl}/V2022-03/payment_methods \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
  --data '{
    "billingDetail": {
        "address": {
            "city": "NEWARK VALLEY",
            "country": "US",
            "line1": "4348  Calico Drive",
            "postalCode": "13811",
            "state": "NY"
        },
        "email": "indubio@gmail.com",
        "firstName": "Di Mo",
        "lastName": "Shi",
        "phone": "509-675-8948"
    },
    "card": {
        "cardNo": "5333302221254276",
        "cardExpireMonth": "12",
        "cardExpireYear": "2025",
        "cardSecurityCode": "123"
    },
    "customerId": "cus_1526760517237616640"
}'
```

{% endcode %}

{% openapi src="/files/AM3SZZl8CySoEL2YMS4v" path="/V2022-03/payment\_methods/update" method="post" %}
[gitbook .json](https://1129616527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMb9UzyxGUyxHylm4UJSJ%2Fuploads%2FaSm0HICLvmjsHIG0gPX6%2Fgitbook%20.json?alt=media\&token=02baaaa5-1304-46b3-bba2-4dbae43ffa30)
{% endopenapi %}

### 更新支付方式接口请求报文示例

{% code title="updatePaymentMethod.sh" %}

```
curl --request POST \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/update \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
  --data '{
    "billingDetail": {
        "address": {
            "city": "NEWARK VALLEY",
            "country": "US",
            "line1": "4349  Calico Drive",
            "postalCode": "13811",
            "state": "NY"
        },
        "email": "indubio@gmail.com",
        "firstName": "Di Ma",
        "lastName": "Shi",
        "phone": "509-675-8948"
    },
    "customerPaymentMethodId": "pm_1526760521989763072"
}'
```

{% endcode %}

### 获取支付方式接口请求报文示例

```
curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072 \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
```

{% openapi src="/files/AM3SZZl8CySoEL2YMS4v" path="/V2022-03/payment\_methods/{customerPaymentMethodId}" method="get" %}
[gitbook .json](https://1129616527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMb9UzyxGUyxHylm4UJSJ%2Fuploads%2FaSm0HICLvmjsHIG0gPX6%2Fgitbook%20.json?alt=media\&token=02baaaa5-1304-46b3-bba2-4dbae43ffa30)
{% endopenapi %}

### 获取支付方式接口请求报文示例

{% code title="getPaymentMethod" %}

```
curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072 \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
```

{% endcode %}

{% openapi src="/files/AM3SZZl8CySoEL2YMS4v" path="/V2022-03/payment\_methods/list/{customerId}" method="get" %}
[gitbook .json](https://1129616527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMb9UzyxGUyxHylm4UJSJ%2Fuploads%2FaSm0HICLvmjsHIG0gPX6%2Fgitbook%20.json?alt=media\&token=02baaaa5-1304-46b3-bba2-4dbae43ffa30)
{% endopenapi %}

### 根据客户获取所有支付方式接口请求报文示例

{% code title="getPaymentMethodListByCustomerId.sh" %}

```
curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/list/cus_1526760517237616640 \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
```

{% endcode %}

{% openapi src="/files/AM3SZZl8CySoEL2YMS4v" path="/V2022-03/payment\_methods/{customerPaymentMethodId}/{customerId}/attach" method="get" %}
[gitbook .json](https://1129616527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMb9UzyxGUyxHylm4UJSJ%2Fuploads%2FaSm0HICLvmjsHIG0gPX6%2Fgitbook%20.json?alt=media\&token=02baaaa5-1304-46b3-bba2-4dbae43ffa30)
{% endopenapi %}

### 客户附加支付方式接口请求报文示例

```
curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072/cus_1526760517237616640/attach \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
```

{% openapi src="/files/AM3SZZl8CySoEL2YMS4v" path="/V2022-03/payment\_methods/{customerPaymentMethodId}/detach" method="get" %}
[gitbook .json](https://1129616527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMb9UzyxGUyxHylm4UJSJ%2Fuploads%2FaSm0HICLvmjsHIG0gPX6%2Fgitbook%20.json?alt=media\&token=02baaaa5-1304-46b3-bba2-4dbae43ffa30)
{% endopenapi %}

### 解绑支付方式接口请求报文示例

```
curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072/detach \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
```

{% hint style="info" %}
以上接口，【根据客户获取所有支付方式】【解绑支付方式】返回结构差异外，其他均返回如下结构（由于数据字段并无差别所以不再展示）
{% endhint %}

#### 结果对象属性描述

<table><thead><tr><th width="279.3333333333333">property name</th><th>type</th><th>description</th></tr></thead><tbody><tr><td>code</td><td>String</td><td>返回码</td></tr><tr><td>message</td><td>String</td><td>返回信息</td></tr><tr><td>data</td><td>Object</td><td>数据对象</td></tr><tr><td>    customerPaymentMethodId</td><td>String</td><td><p>支付方式id；</p><p>如：pm_1671231231232</p></td></tr><tr><td>    card</td><td>Object</td><td>对象</td></tr><tr><td>        last4</td><td>String</td><td>卡后四位</td></tr><tr><td>        brand</td><td>String</td><td><p>卡组织；</p><p>如：Visa</p></td></tr><tr><td>    billingDetail</td><td>Object</td><td>对象</td></tr><tr><td>        email</td><td>String</td><td>邮箱</td></tr><tr><td>        firstName</td><td>String</td><td>firstName</td></tr><tr><td>        lastName</td><td>String</td><td>lastName</td></tr><tr><td>        phone</td><td>String</td><td>电话</td></tr><tr><td>        address</td><td>Object</td><td>对象</td></tr><tr><td>            city</td><td>String</td><td>城市</td></tr><tr><td>            country</td><td>String</td><td>国家代码，两位字母的ISO国家代码</td></tr><tr><td>            line1</td><td>String</td><td>地址1，该地址优先使用</td></tr><tr><td>            line2</td><td>String</td><td>地址2</td></tr><tr><td>            postalCode</td><td>String</td><td>邮编</td></tr><tr><td>            state</td><td>String</td><td>州；两位字母的ISO州代码</td></tr></tbody></table>


---

# Agent Instructions: 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:

```
GET https://asiabill.gitbook.io/api-explorer/api-reference/jiao-yi/payment-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
