Endpoints

POST /payments/{id}/refund

Refund a captured payment in full or in part.

POST/payments/{id}/refundsecret key

Refund a captured payment in full or in part. Refunds are routed back through the original provider.

Body parameters
  • amountinteger
    Amount to refund. Defaults to the full remaining captured amount.
  • reasonstring
    duplicate | fraudulent | requested_by_customer | other.
Request
curl https://sandbox-api.key2pays.com/v1/payments/pay_3aB81…/refund \
  -H "Authorization: Bearer sk_test_51N8mP...exampleK3Y" \
  -H "Content-Type: application/json" \
  -d '{ "amount": 4500, "reason": "requested_by_customer" }'
Response
{
  "id": "rfd_2zQ88…",
  "payment_id": "pay_3aB81…",
  "amount": 4500,
  "currency": "MXN",
  "status": "succeeded",
  "created": 1714676890
}