Skip to Content

Refund Payment

POST/payments/:paymentId/refund

Description

Refund a payment, returning funds to the customer’s original wallet address. This endpoint is only available for payments created with payment_mode: "two_step".

Requires a signed request to authorize the fund movement. The destination address is determined automatically based on the original payer.

🔐

The API validates the request fields and verifies your signature before executing the refund.

Headers

HeaderDescriptionRequired
AuthorizationBearer token with your API keyyes
Content-Typeapplication/jsonyes
X-SignatureECDSA signature of the JSON-serialized request body, signed with your signing key.yes

Path Parameters

NameTypeDescriptionRequired
paymentIdstringThe unique identifier of the payment to refund.yes

Request Body

The request body is signed with your signing key and the signature is sent in the X-Signature header.

NameTypeDescriptionRequired
actionstringMust be "refund".yes
payment_idstringThe ID of the payment to refund. Must match the path parameter.yes

Example Request

const body = {
  action: 'refund',
  payment_id: 'pay_0987654321fedcba',
};
 
const signature = signRequest(body, process.env.SIGNING_PRIVATE_KEY);
 
const response = await fetch(
  'https://checkout.exodus.com/payments/pay_0987654321fedcba/refund',
  {
    method: 'POST',
    headers: {
      Authorization: 'Bearer sk_live_xxxxxxxxxxxxxxxx',
      'Content-Type': 'application/json',
      'X-Signature': signature,
    },
    body: JSON.stringify(body),
  }
);

Response

SUCCESSFUL REFUND
{
  "id": "ref_1234567890abcdef",
  "object": "refund",
  "payment_id": "pay_0987654321fedcba",
  "amount": 5000,
  "currency": "USD",
  "status": "pending",
  "stablecoin": "USDC",
  "network": "ethereum",
  "destination_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f8fE21",
  "created_at": "2024-01-20T15:30:00Z"
}

Error Responses

INVALID PAYMENT MODE
{
  "error": {
    "type": "invalid_request",
    "message": "Refund via signed request is only available for two-step payments"
  }
}
INVALID SIGNATURE
{
  "error": {
    "type": "authorization_error",
    "message": "Invalid signature"
  }
}

Start building

XO

Request Demo

Schedule a call with our team

Select a product
Arrow right

Start building
Grateful

Contact Us

We're here to help