# Refund a Checkout Session

## Arguments <a href="#arguments" id="arguments"></a>

| Field       | Type   | Required | Description                                                                                                                                        |
| ----------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| session\_id | string | yes      | The ID of the Checkout Session                                                                                                                     |
| amount      | int    | no       | The amount to refund, in the smallest currency unit (e.g., cents). If omitted, the entire checkout session amount will be refunded.                |
| reason      | string | no       | The reason of the refund is either “requested\_by\_customer”, “duplicated”, or “fraudulent”.                                                       |
| metadata    | hash   | no       | A set of key-value pairs attached to a payout object. It can be useful for storing additional information about the payout in a structured format. |

<mark style="color:yellow;">**`POST`**</mark> `https://{provided url}/v1/refunds`

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

<pre><code>curl https://{provided url}/v1/refunds \
  -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
  -d amount=1000 \
  -d session_id=AW-kLcRRC5P8U68CYe0kVA \
<strong>  -d reason=requested_by_customer \
</strong></code></pre>

{% endtab %}
{% endtabs %}

The above command returns JSON structured like this:

```json
{
	"id": "kLcRRC5P8U68CYe0kVA",
	"amount": 1000,
	"status": "pending",
	"reason": "requested_by_customer",
	"created_at": 1534255857,
	"livemode": false
}
```


---

# 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://developer.convergegate.com/legacy/refund-a-checkout-session.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.
