Skip to main content

Refund Payment

Request a refund for a previously completed payment. Refund requests do not execute immediately — they are placed into an approval queue and processed after administrative approval.

POST/api/payment/{paymentId}/refund

Path Parameters

ParameterTypeDescription
paymentIdstringUUID of the original payment to refund.

Request Parameters

ParameterRequiredTypeDescription
amountYesnumberRefund amount. Must be less than or equal to the remaining refundable amount (e.g., 50.00).
currencyYesstringCurrency code (e.g., TRY).

Response

Returns an ApiPaymentResponse with status: PENDING_APPROVAL. The response includes a new paymentId for the refund transaction.

FieldTypeDescription
paymentIdstringUnique identifier for the refund transaction (UUID). Use this ID to query refund status.
parentPaymentIdstringUUID of the original payment being refunded.
orderIdstringClient's tracking number for the order.
amountnumberRefund amount.
installmentCountnumberNumber of installments.
currencystringCurrency code.
merchantCommissionnumberCommission charged to the merchant.
statusstringPayment status (PENDING_APPROVAL).
transactionTypestringTransaction type (REFUND).
paymentDatestringDate and time (ISO format, e.g., 2023-05-01T14:30:00Z).
cardHolderNamestringName of the card holder.
panstringMasked Primary Account Number (e.g., 411111******1111).
domIntstringDomestic or International transaction (DOM/INT).
cardSchemestringCard scheme (e.g., VISA, MASTERCARD).
cardTypestringType of card (e.g., CREDIT, DEBIT).
loyaltyCodestringLoyalty program code (if applicable).
externalTransactionIdstringTransaction ID from the payment provider.
authCodestringAuthorization code from the payment provider.
resultCodestringResult code from the payment provider.
resultMessagestringResult message from the payment provider.
customerIdstringUnique identifier for the customer (if provided).

Important Notes

Refunds are not instant

Refund requests are not processed immediately. They enter an approval queue and require administrative review before execution.

  • Only payments in SUCCESS or CAPTURED status can be refunded.
  • Partial refunds are supported — you can refund less than the original amount.
  • Multiple partial refunds are allowed as long as the total does not exceed the original payment amount (including pending refund requests).
  • Once approved or rejected, a webhook notification will be sent.
  • Use GET /api/payment/{refundPaymentId} to poll the refund status.

Refund Lifecycle

  1. Send refund request → response status: PENDING_APPROVAL
  2. Administrative review and approval/rejection
  3. On approval: refund is executed at the bank → final status: SUCCESS or FAILED
  4. On rejection: final status: REJECTED
  5. Webhook notification sent with final status

Example

const requestRefund = async (paymentId, amount, currency) => {
const response = await fetch(`https://api.example.com/api/payment/${paymentId}/refund`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': 'your_api_key_here',
'X-API-SECRET': 'your_api_secret_here'
},
body: JSON.stringify({ amount, currency })
});

const result = await response.json();
// result.status === 'PENDING_APPROVAL'
// result.paymentId → refund transaction ID (use to query refund status)
return result;
};

// Query refund status
const checkRefundStatus = async (refundPaymentId) => {
const response = await fetch(`https://api.example.com/api/payment/${refundPaymentId}`, {
method: 'GET',
headers: {
'X-API-KEY': 'your_api_key_here',
'X-API-SECRET': 'your_api_secret_here'
}
});
const result = await response.json();
// result.status: PENDING_APPROVAL | SUCCESS | FAILED | REJECTED
return result;
};