---
title: "Create a refund"
method: POST
path: "/payment-intents/{paymentIntentId}/refunds"
tags: ["Refunds"]
---

# Create a refund

`POST /payment-intents/{paymentIntentId}/refunds`

## Request

- Base URL: `https://api.dojo.tech`
- URL: `https://api.dojo.tech/payment-intents/{paymentIntentId}/refunds`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/dojo/apis/dojo-api/docs/payment-intents/:paymentIntentId/refunds/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a refund. Refund allows you to return a payment that has previously been created as long as there have been no incremental payments or payment attempts, including unsuccessful payment attempts. You can refund the full amount or a partial amount.

## Path parameters

- `paymentIntentId` string, nullable, required

## Headers

- `version` string, date, required
- `idempotencyKey` string, nullable, required

## Request body

- CreateRefundRequest: The create refund request object.
  - `amount` integer, required: The refund amount.
  - `previousTransactionId` string, nullable: The unique identifier for the previous transaction.
  - `refundReason` string, nullable: The reason for the refund.
  - `notes` string, nullable: A description for the refund, if applicable.

## Response `200`

OK

- Refund: The refund response object.
  - `paymentIntentId` string, nullable: The unique identifier of the payment intent.
  - `refundId` string, nullable: A unique identifier for the refund. It will be used to reference this refund in all operations. It is recommended to use a UUID.
  - `refundReason` string, nullable: The reason for the refund.
  - `notes` string, nullable: A description for the refund, if applicable.

## Other responses

- `400`: Bad request
- `401`: Unauthorized

---

[API](https://skmtc.dev/dojo/apis/dojo-api.md) - [All operations](https://skmtc.dev/dojo/apis/dojo-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dojo/apis/dojo-api/revisions/29fc8900ba37?raw)
