Skip to main content
POST
/
v1
/
checkouts
/
{checkoutId}
/
refund
{
  "id": "refund_cs_123456789",
  "session_id": "cs_ci_123456789",
  "status": "pending",
  "amount": 123,
  "currency": "XOF",
  "reason": "<string>",
  "description": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "completed_at": "2023-11-07T05:31:56Z",
  "failure_reason": "<string>",
  "ussd_reference": "<string>"
}

Refund a Checkout Session

This endpoint allows you to issue a refund for a specific checkout session using its unique identifier.

Endpoint

  • Endpoint: POST /v1/checkouts/{checkoutId}/refund
  • Description: Issue a refund for a specific checkout session.
  • Path Parameters:
    • checkoutId (string, required): The unique identifier of the checkout session to refund.
  • Request Body:
    {
      "amount": 1000,
      "currency": "usd",
      "reason": "customer_request"
    }
    
  • Response:
    {
      "id": "cs_test_123",
      "amount": 1000,
      "currency": "usd",
      "status": "refunded",
      "created_at": "2024-01-01T12:00:00Z",
      "customer_id": "cus_456"
    }
    

Parameters

  • checkoutId (string, required): The unique identifier of the checkout session to refund.
  • amount (integer, required): The amount to refund in the smallest currency unit (e.g., cents for USD).
  • currency (string, required): The currency code (e.g., “usd”).
  • reason (string, optional): The reason for the refund (e.g., “customer_request”, “fraudulent”).

Example Request

curl -X POST https://api.example.com/v1/checkouts/cs_test_123/refund \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "usd",
    "reason": "customer_request"
  }'

Example Response

{
  "id": "cs_test_123",
  "amount": 1000,
  "currency": "usd",
  "status": "refunded",
  "created_at": "2024-01-01T12:00:00Z",
  "customer_id": "cus_456"
}

Notes

  • Ensure that the checkout session exists and is eligible for a refund before issuing the request.
  • The response includes the updated status of the checkout session after the refund is processed.

Errors

  • 404 Not Found: The specified checkout session does not exist.
  • 400 Bad Request: Invalid request parameters or refund amount exceeds the original payment.
  • 401 Unauthorized: Invalid or missing API key.

See Also

Authorizations

Authorization
string
header
required

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

Headers

idempotency-key
string
required

UUID

Maximum length: 1000

Path Parameters

checkoutId
string
required

Body

application/json
amount
integer

Montant à rembourser (optionnel, complet par défaut)

Example:

5000

reason
enum<string>
Available options:
requested_by_customer,
fraud,
duplicate,
other
Example:

"requested_by_customer"

description
string
Maximum length: 200
webhook_url
string<uri>

Response

201 - application/json

Checkout refunded

id
string
Example:

"refund_cs_123456789"

session_id
string
Example:

"cs_ci_123456789"

status
enum<string>
Available options:
pending,
processing,
completed,
failed
amount
integer
currency
string
Example:

"XOF"

reason
string
description
string
created_at
string<date-time>
completed_at
string<date-time> | null
failure_reason
string | null
ussd_reference
string | null