Skip to main content

Refunds

Refunds apply to captured or settled payments. Partial refunds specify amount in the same minor units as the original payment currency.
Use refunds when you need to return funds for an already processed payment.

Full refund or partial refund

const result = await client.refundPayment(paymentId, {
  amount: 10000, // amount in minor units
});

console.log(result.id, result.result);
amount is required and is sent as URL-encoded form data according to the GoPay endpoint expectations.

Refund history

const refunds = await client.getPaymentRefunds(paymentId);

for (const refund of refunds) {
  console.log(refund.id, refund.state, refund.amount, refund.currency);
}
RefundHistoryItem includes:
  • id
  • state
  • amount
  • currency
  • date_requested
  • date_last_change?

Refund best practices

  • Persist refund metadata in your database (refund ID, amount, request timestamp).
  • Keep refund amounts in minor units for consistency.
  • Build idempotent refund workflows to avoid duplicate requests from retries.