Backend API

Arguments
amountcurrencyrequired

Amount to refund up to payment amount_refundable.

methodstring

Optionally refund the payment using a different method. Defaults to the original payment method.

reasonboolean

The reason of the refund.

reason_messagestring

A brief message describing the reason for the refund.

POST/payments/:id/refunds
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.post('/payments/{id}/refunds', {
  id: '5cae685b20a54174dd968afa',
  amount: 50,
});
Response
{
  "id": "5cae042722984c53002096ab",
  "amount": 50,
  "card": {
    "brand": "Visa",
    "last4": "4242",
    "exp_month": 10,
    "exp_year": 2029,
    "token": "card_XfqLq5nRdOdu7vTvoeKufafN",
    "cvc_check": "pass",
    "zip_check": "pass",
    "address_check": "pass"
  },
  "currency": "USD",
  "date_created": "2019-04-01T00:00:00.000Z",
  "gateway": "stripe",
  "method": "card",
  "number": "103352",
  "order_id": "5cae685b20a54174dd968077",
  "parent_id": "5cae685b20a54174dd968afa",
  "status": "success",
  "success": true,
  "transaction_id": "re_1XNhqtFAeoMUkt5CitcnPNAa"
}