> 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/hou-duan-api-ji-cheng.md).

# 后端API集成

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

本节解释了商家如何实现Codapay后端集成API。

**实现此API涉及商家与Coda之间的纯后端集成——客户将不会被重定向到Coda的支付页面**\
\
此集成选项适用于所有环境（无论是网站还是应用程序），并允许商家在整个支付流程中保持自定义品牌形象。

\
商家需要**设计自己的【支付页面】**&#x4EE5;便用户输入支付信息。然而，部分支付渠道不支持后端集成。使用后端集成的方式，商家可以有更多空间去设计支付页面，但相比于使用【支付页面接入】方式，集成成本较高。

后端集成允许商家在自己设计的收银台中选择支付渠道并输入支付信息。商家在获取用户信息后，会向Coda发送支付请求。Coda则返回支付指示，商家随后会在自己的支付页面上展示相应的支付提示。

## <mark style="color:purple;">API密钥</mark>

所有Codapay的API密钥都可以在[Coda后台](https://portal.coda.co/#/integration/codapay/publisher-settings)中获取 (集成 -> Codapay -> API keys tab)

{% hint style="info" %}
**沙盒环境与生产环境密钥的区别**<br>

更多关于密钥使用的详细信息，请参考：

**新商户：**

* 您将获得统一 API 密钥，这些密钥仅适用于 Codapay v2.0 API。详细信息请参考[此处](broken://pages/4QDq3jFWAMdcmqWYvGJu)。

**已有商户：**

* 每个集成的游戏或平台（称为“标题”）将有一组 API 密钥，每个国家的 API 密钥是独立的。
* 如果您需要在不同国家开设新账户，请通知 Coda Business 为该国家创建新的 API 密钥。
* 当前的 API 密钥仅适用于 Codapay v1.0 API。如果您希望使用统一 API 密钥以简化集成和密钥管理，请联系 Coda。此操作需要迁移到 Codapay v2.0 API，但核心结构与 v1.0 API 保持不变。
  {% endhint %}

## <mark style="color:purple;">接口 URLs</mark>

商家与Coda进行Codapay API集成的唯一方式是将JSON请求发送到以下URL： 请参考我们的示例消息获取更多信息。

### 沙盒环境

<table><thead><tr><th width="180">版本</th><th>接口 URL</th></tr></thead><tbody><tr><td>v2.0</td><td><a href="https://sandbox.codapayments.com/airtime/offline/charge/v3">https://sandbox.codapayments.com/airtime/offline/charge/v3</a></td></tr><tr><td>v1.0</td><td><a href="https://sandbox.codapayments.com/airtime/offline/charge/v2">https://sandbox.codapayments.com/airtime/offline/charge/v2</a></td></tr></tbody></table>

### 生产环境

<table><thead><tr><th width="180">环境</th><th>接口 URL</th></tr></thead><tbody><tr><td>v2.0</td><td><a href="https://airtime.codapayments.com/airtime/offline/charge/v3">https://airtime.codapayments.com/airtime/offline/charge/v3</a></td></tr><tr><td>v1.0</td><td><a href="https://airtime.codapayments.com/airtime/offline/charge/v2">https://airtime.codapayments.com/airtime/offline/charge/v2</a></td></tr></tbody></table>

{% hint style="warning" %}
🚧 <mark style="color:orange;">**请确保向Codapay API发送的请求必须通过**</mark>

1. HTTPS
2. TLS 1.2 或更高版本。
   {% endhint %}


---

# 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/hou-duan-api-ji-cheng.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.
