↩  Refund a payment

Refund a paid payment in whole or in part. Multiple partial refunds are allowed up to the original total. Triggers payment.refunded.

What to do

  1. First, run the Standard checkout scenario and complete the payment with 4111….
  2. Come back here. Recent payments (only ones created via this app, and only after they've cleared) appear below.
  3. Pick one and click Refund — the response shows up below.
  4. payment.refunded webhook arrives. Repeat with a partial-amount refund to verify multi-refund behaviour.

Recent payments

No payments yet. Run the Standard checkout scenario first, then come back here.

The code

// Node.js
const r = await fetch('https://app.sknpay.com/api/v1/refunds', {
  method: 'POST',
  headers: { Authorization: 'Bearer '+KEY, 'Content-Type':'application/json' },
  body: JSON.stringify({
    payment_id: 'plink_xxx',
    amount: 500,                      // optional — omit for full refund
  }),
})
// payment.refunded webhook fires
<?php
$ch = curl_init('https://app.sknpay.com/api/v1/refunds');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST           => true,
  CURLOPT_HTTPHEADER     => [
    'Authorization: Bearer ' . getenv('SKNPAY_API_KEY'),
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => json_encode([
    'payment_id' => 'plink_xxx',
    'amount'     => 500,           // optional
  ]),
]);
$refund = json_decode(curl_exec($ch), true);
# Python
r = requests.post('https://app.sknpay.com/api/v1/refunds', headers=H, json={
    'payment_id': 'plink_xxx',
    'amount': 500,                  # optional
})