Skip to content

Refunds

A Refund represents a reversal of a previously captured payment.

POST/v1/refunds

Create a new refund

Create a Refund

Creates a refund for a captured payment.

Request Body

ParameterTypeRequiredDescription
payment_idstringID of the payment to refund
amountintegerAmount to refund in cents (default: full amount)
reasonstringReason for refund: duplicate, fraudulent, requested_by_customer
metadataobjectCustom key-value pairs

Example Request

bash
curl https://api.salamgateway.com/v1/refunds \
  -X POST \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "payment_id": "pay_abc123",
    "amount": 10000,
    "reason": "requested_by_customer"
  }'
typescript
const refund = await salam.refunds.create({
  payment_id: 'pay_abc123',
  amount: 10000,
  reason: 'requested_by_customer',
});

Response

json
{
  "id": "rfnd_xyz789",
  "object": "refund",
  "payment_id": "pay_abc123",
  "amount": 10000,
  "currency": "MYR",
  "reason": "requested_by_customer",
  "status": "pending",
  "metadata": {},
  "created_at": "2024-01-15T12:00:00Z"
}

GET/v1/refunds/:id

Retrieve a refund

Retrieve a Refund

Retrieves the details of an existing refund.

Path Parameters

ParameterDescription
idThe refund ID

Example

bash
curl https://api.salamgateway.com/v1/refunds/rfnd_xyz789 \
  -H "Authorization: Bearer sk_live_xxx"
typescript
const refund = await salam.refunds.retrieve('rfnd_xyz789');

GET/v1/refunds

List all refunds

List Refunds

Returns a paginated list of refunds.

Query Parameters

ParameterDescription
payment_idFilter by payment ID
statusFilter by status: pending, succeeded, failed
pagePage number (default: 1)
limitItems per page (default: 20, max: 100)

Example

bash
curl "https://api.salamgateway.com/v1/refunds?status=succeeded" \
  -H "Authorization: Bearer sk_live_xxx"
typescript
const refunds = await salam.refunds.list({
  status: 'succeeded',
});

Refund Object

Attributes

AttributeTypeDescription
idstringUnique refund identifier
objectstringAlways "refund"
payment_idstringID of the payment being refunded
amountintegerAmount refunded in cents
currencystringThree-letter ISO currency code
reasonstringReason for the refund
statusstringRefund status
metadataobjectCustom metadata
created_atstringCreation timestamp

Refund Status

StatusDescription
pendingRefund initiated, processing
succeededRefund completed successfully
failedRefund failed

Refund Processing Time

FPX refunds typically take 3-5 business days to appear in the customer's bank account.

Released under the MIT License.