Skip to main content
POST
/
refunds
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

const refund = await client.refunds.create({ payment_id: 'payment_id' });

console.log(refund.brand_id);
import os
from dodopayments import DodoPayments

client = DodoPayments(
bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
)
refund = client.refunds.create(
payment_id="payment_id",
)
print(refund.brand_id)
package main

import (
"context"
"fmt"

"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)

func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
refund, err := client.Refunds.New(context.TODO(), dodopayments.RefundNewParams{
PaymentID: dodopayments.F("payment_id"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", refund.BrandID)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.refunds.Refund;
import com.dodopayments.api.models.refunds.RefundCreateParams;

public final class Main {
private Main() {}

public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

RefundCreateParams params = RefundCreateParams.builder()
.paymentId("payment_id")
.build();
Refund refund = client.refunds().create(params);
}
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.refunds.Refund
import com.dodopayments.api.models.refunds.RefundCreateParams

fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

val params: RefundCreateParams = RefundCreateParams.builder()
.paymentId("payment_id")
.build()
val refund: Refund = client.refunds().create(params)
}
require "dodopayments"

dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)

refund = dodo_payments.refunds.create(payment_id: "payment_id")

puts(refund)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;

$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);

try {
$refund = $client->refunds->create(
paymentID: 'payment_id',
items: [['itemID' => 'item_id', 'amount' => 0, 'taxInclusive' => true]],
metadata: ['foo' => 'string'],
reason: 'reason',
);

var_dump($refund);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Refunds;

DodoPaymentsClient client = new();

RefundCreateParams parameters = new() { PaymentID = "payment_id" };

var refund = await client.Refunds.Create(parameters);

Console.WriteLine(refund);
use dodopayments::Client;

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let result = client
.refunds()
.create()
.body(dodopayments::models::RefundsCreateParams {
payment_id: Some("payment_id".to_string()),
..Default::default()
})
.await?;
println!("{result:?}");
Ok(())
}
curl --request POST \
--url https://test.dodopayments.com/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_id": "<string>",
"items": [
{
"item_id": "<string>",
"amount": 123,
"tax_inclusive": true
}
],
"metadata": {},
"reason": "<string>"
}
'
{
  "brand_id": "<string>",
  "business_id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "customer": {
    "customer_id": "<string>",
    "email": "<string>",
    "name": "<string>",
    "metadata": {},
    "phone_number": "<string>"
  },
  "is_partial": true,
  "metadata": {},
  "payment_id": "<string>",
  "refund_id": "<string>",
  "amount": 123,
  "reason": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
payment_id
string
required

The unique identifier of the payment to be refunded.

items
object[] | null

Partially Refund an Individual Item

metadata
Metadata · object

Additional metadata associated with the refund.

reason
string | null

The reason for the refund, if any. Maximum length is 3000 characters. Optional.

Response

Refund successfully initiated

brand_id
string
required

Brand id this refund belongs to

business_id
string
required

The unique identifier of the business issuing the refund.

created_at
string<date-time>
required

The timestamp of when the refund was created in UTC.

customer
object
required

Details about the customer for this refund (from the associated payment)

is_partial
boolean
required

If true the refund is a partial refund

metadata
Metadata · object
required

Additional metadata stored with the refund.

payment_id
string
required

The unique identifier of the payment associated with the refund.

refund_id
string
required

The unique identifier of the refund.

status
enum<string>
required

The current status of the refund.

Available options:
succeeded,
failed,
pending,
review
amount
integer<int32> | null

The refunded amount.

currency
null | enum<string>

The currency of the refund, represented as an ISO 4217 currency code.

Available options:
AED,
ALL,
AMD,
ANG,
AOA,
ARS,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
BMD,
BND,
BOB,
BRL,
BSD,
BWP,
BYN,
BZD,
CAD,
CHF,
CLP,
CNY,
COP,
CRC,
CUP,
CVE,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
ETB,
EUR,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MAD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRU,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
NGN,
NIO,
NOK,
NPR,
NZD,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SEK,
SGD,
SHP,
SLE,
SLL,
SOS,
SRD,
SSP,
STN,
SVC,
SZL,
THB,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
USD,
UYU,
UZS,
VES,
VND,
VUV,
WST,
XAF,
XCD,
XOF,
XPF,
YER,
ZAR,
ZMW
reason
string | null

The reason provided for the refund, if any. Optional.

Last modified on March 25, 2026