> 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/shopper.md).

# Shopper

这代表正在购买的客户。Shopper 由一个 唯一标识符（Shopper ID） 表示，该标识符用于 保护支付信息的安全。

## Shopper 对象

<table><thead><tr><th width="250">参数名称</th><th width="153">类型</th><th>描述</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>由 Coda 生Shopper ID</td></tr><tr><td>partner_shopper_id</td><td>String</td><td>合作伙伴将用于识别其客户并链接token ID 的 ID</td></tr><tr><td>phone_number</td><td>String</td><td>Shopper 电话号码</td></tr><tr><td>email</td><td>String</td><td>Shopper 电子邮件地址</td></tr><tr><td>status_code</td><td>String</td><td>Shopper 状态可以是“活跃”或“不活跃”</td></tr></tbody></table>

## 接口

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

```
POST /v1/shoppers 
GET /v1/shoppers/{shopper.id}
```

{% endtab %}
{% endtabs %}

## 创建 Shopper

### POST /shoppers

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

```json
curl --location '{baseUrl}/v1/shoppers'
--header 'X-Partner-Id: par_sg1882402279a0000'
--header 'Content-Type: application/json'
--header 'X-Api-Key: sdirugnvsiguhsirghsekjhgh'
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXJ0bmVyX2lkIjoicGFyX3NnMTg4MjQwMjI3OWEwMDAwIiwiaWF0IjoxNzAxMjMzNTM0fQ.o_tcEJUEwEms49J0MXwvRuCGbsBx3rHugfgKsXVgj9I'
--data-raw '{ 
   "partner_shopper_id": "partner-shopper-287", 
   "phone_number": "+62846500522696", 
   "email": "abc@abc.com" 
}'
```

{% endtab %}
{% endtabs %}

## 响应 [Shopper 对象](#shopper-dui-xiang)

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

```json
{ 
   "id": "shp_sg18bfb6894ea0000", 
   "partner_shopper_id": "partner-shopper-345", 
   "phone_number": "+62123456789", 
   "email": "e@e.com", "status_code": "active" 
}
```

{% endtab %}
{% endtabs %}

## 获取 Shopper

{% hint style="info" %}
通过 Shopper ID 获取 Shopper
{% endhint %}

### GET /shoppers/{shopper.id}

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

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

{% endtab %}
{% endtabs %}

## 响应 [Shopper 对象](#shopper-dui-xiang)

{% tabs %}
{% tab title="取消设置" %}

```json
{ 
   "id": "shp_sg18bfb6894ea0000", 
   "partner_shopper_id": "partner-shopper-345", 
   "phone_number": "+62878269555000", 
   "email": "e@e.com", "status_code": "active"
 }
```

{% endtab %}
{% endtabs %}

## <mark style="color:purple;">请求参数</mark>

<table><thead><tr><th>参数名称</th><th width="81">类型</th><th width="75">必填？</th><th>描述</th><th>验证</th></tr></thead><tbody><tr><td>partner_shopper_id</td><td>String</td><td>是</td><td>合作伙伴将用于识别其客户并链接token ID 的 ID</td><td><p>必须介于 4 和 32 之间</p><p></p><p>必须符合 <code>“^[a-zA-Z0-9-_]+$”</code></p></td></tr><tr><td>phone_number</td><td>String</td><td>否</td><td>Shopper 电话号码</td><td><p>必须介于 12 和 16 之间</p><p></p><p>必须符合 <code>“+[0-9]+”</code></p></td></tr><tr><td>email</td><td>String</td><td>否</td><td>Shopper 电子邮件地址</td><td><p>必须介于 4 和 128 之间</p><p></p><p>必须符合<code>"^[^\"!#$%&#x26;'*+\-/=?^_{|]+[^\\\"]*[^\\\"!#$%&#x26;'*+\\-/=?^_{|]+@[a-zA-Z0-9-]+([\.][a-zA-Z0-9-]+){1,2}$"</code></p></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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
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/shopper.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
