> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pushcash.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Issue refunds

<div className="Goal">
  ## Goal

  Return funds to a user by refunding an approved intent.
</div>

## Steps

***

## Step 1: Submit a refund

<div className="What">
  <p className="bold-header">What you need to do</p>

  Call the Push Cash API to create a refund with the `intent_id` of the original cash-in payment.
</div>

#### How to do it

* Call the [create-refund](./apireference/refund/create-a-refund) endpoint with the `intent_id` of the payment you want to refund.
* Optionally, add an `amount` to refund a portion of the intent. If `amount` is omitted, the full intent amount is refunded.
* Only one refund is allowed per intent. Subsequent refund attempts on the same intent will return a `200` with the already-created refund.

<Info>
  To check whether an intent has already been refunded, call [get-an-intent](./apireference/intent/get-an-intent) and inspect the `refund` field on the response.
</Info>

<Warning>
  A refund can be declined by the issuer if the user's bank rejects the transaction.
</Warning>

<RequestExample>
  ```bash Create Refund (full amount) theme={null}
  curl --request POST \
    --url https://sandbox.pushcash.com/refund \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '
  {
    "intent_id": "intent_R7xKpVwZ3mNqYtFh2sJcAe"
  }
  '
  ```

  ```bash Create Refund (partial amount) theme={null}
  curl --request POST \
    --url https://sandbox.pushcash.com/refund \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '
  {
    "intent_id": "intent_R7xKpVwZ3mNqYtFh2sJcAe",
    "amount": 500
  }
  '
  ```
</RequestExample>

## Step 2: Handle response

<div className="What">
  <p className="bold-header">What you need to do</p>

  Check whether the refund was approved or declined.
</div>

#### How to do it

* Check the HTTP status code. A non-`200` response means the refund could not be processed.
* A `401` response indicates the refund was declined by the payment network. The response body includes the `id` of the declined refund.
* A `400` response indicates a validation error (e.g. the refund amount is greater than the intent amount).

## Integration checklist

* Submit a refund in the sandbox environment using a sandbox intent
  * Test a partial refund by specifying an `amount` less than the original intent amount
* Test a refund decline by processing an intent with test card `5999 9619 6976 9301` and then submitting a refund
