> 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/tuo-guan-zu-jian-ji-cheng/ka-pian/fen-bie-shou-quan-he-shou-qu-kuan-xiang/qu-xiao-fu-kuan-qing-qiu.md).

# 取消付款请求

本文档介绍了用于取消支付请求的服务器端 API。使用此接口可以终止尚未完成的交易。

#### 端点 <a href="#endpoint" id="endpoint"></a>

方法：`POST`

| 沙盒 | `https://sandbox.codapayments.com/airtime/api/restful/v2.0/Payment/cancelURL` |
| -- | ----------------------------------------------------------------------------- |
| 生产 | `https://airtime.codapayments.com/airtime/api/restful/v2.0/Payment/cancel`    |

#### 请求正文

请求体必须以 JSON 格式发送，并包含以下参数：

| `cancelPaymentRequest.apiKey`    | string | Yes | 您的 Coda API 身份验证密钥。 |
| -------------------------------- | ------ | --- | ------------------- |
| `cancelPaymentRequest.projectId` | string | Yes | 项目的唯一标识符。           |
| `cancelPaymentRequest.txnId`     | string | Yes | 需要捕获的与该笔付款相关的交易 ID。 |

**示例请求**

```
{
  "cancelPaymentRequest": {
    "apiKey": "your_api_key_here",
    "projectId": "your_project_id",
    "txnId": "123456789"
  }
}
```

#### 回复 <a href="#response" id="response"></a>

请求成功后，会返回确认信息，表明捕获请求已被确认。

**示例回复**

```
{
  "cancelPaymentRequest": {
    "status": "received",
    "txnId": "123456789"
  }
}
```

[<br>](https://coda-payments.gitbook.io/coda-public-technical-documentation/codapay/hosted-component-integration/cards/authorize-and-capture-a-payment-separately/capture-a-payment-request)


---

# 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/tuo-guan-zu-jian-ji-cheng/ka-pian/fen-bie-shou-quan-he-shou-qu-kuan-xiang/qu-xiao-fu-kuan-qing-qiu.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.
