Refunds
Learn how to return money to customers when they return items, cancel orders, or when something goes wrong.
How Refunds Work
A refund sends money back to the customer using the same payment method they used to pay. If they paid with a credit card, the refund goes back to that card. If they paid with M-Pesa, it goes back to their M-Pesa account.
You can refund the full amount or just part of it. For example, if a customer paid $100 but wants to return one item worth $25, you can refund just $25.
Create a Refund
You can create refunds from the Dashboard or using the API.
From the Dashboard
- Go to Payments in your Dashboard
- Find the payment you want to refund and click on it
- Click the Refund button
- Enter the amount (or leave it as the full amount)
- Add a reason (optional but helpful for your records)
- Click Refund
Using the API
Full refund
const clappay = require('@clappay/sdk')('sk_live_...');
// Refund the entire payment
const refund = await clappay.refunds.create({
payment_intent: 'pi_abc123...',
reason: 'requested_by_customer',
});
console.log('Refund created:', refund.id);
console.log('Status:', refund.status);Partial refund
// Refund only part of the payment
const refund = await clappay.refunds.create({
payment_intent: 'pi_abc123...',
amount: 2500, // $25.00 in cents
reason: 'requested_by_customer',
});Refund Reasons
When creating a refund, you can specify a reason. This helps with reporting and understanding why customers ask for refunds.
| Reason Code | When to Use |
|---|---|
| requested_by_customer | Customer asked for a refund |
| duplicate | Customer was charged twice by mistake |
| fraudulent | Payment was made with a stolen card |
How Long Refunds Take
The time it takes for a refund to appear depends on the payment method:
| Payment Method | Time to Appear |
|---|---|
| Credit/Debit Cards | 5-10 business days |
| Mobile Money (M-Pesa, MTN) | 1-3 business days |
| Bank Transfers | 3-5 business days |
| Digital Wallets | 1-3 business days |
The refund shows as "pending" in your Dashboard until it reaches the customer. Some banks take longer than others to process refunds.
Refund Limits
- Time limit - You can refund payments made in the last 180 days. After that, you'll need to send money another way.
- Amount limit - You can't refund more than the original payment amount.
- Multiple refunds - You can issue multiple partial refunds, as long as the total doesn't exceed the original amount.
Note: Original transaction fees are not returned when you issue a refund. If you charged $100 and paid $3 in fees, refunding $100 means you lose the $3.
Refund Status
Refunds go through these statuses:
| Status | What It Means |
|---|---|
| pending | Refund is being processed |
| succeeded | Money was returned to customer |
| failed | Refund couldn't be completed (rare) |
Refund Webhooks
Set up webhooks to get notified when refund status changes:
app.post('/webhooks/clappay', async (req, res) => {
const event = req.body;
switch (event.type) {
case 'refund.created':
console.log('Refund started:', event.data.object.id);
break;
case 'refund.updated':
const refund = event.data.object;
if (refund.status === 'succeeded') {
console.log('Refund completed:', refund.id);
// Update your order status
await markOrderRefunded(refund.payment_intent);
}
break;
case 'refund.failed':
console.log('Refund failed, may need manual action');
break;
}
res.status(200).send('OK');
});Refund vs Chargeback
Refunds and chargebacks both return money to customers, but they work very differently:
| Refund | Chargeback |
|---|---|
| You start it | Customer starts it through their bank |
| No extra fees | $15-25 fee (even if you win) |
| Doesn't affect your account | Too many can get your account closed |
| Customer is usually happy | Customer may be frustrated |
Best practice: If a customer wants their money back, give them a refund before they file a chargeback. It's cheaper and keeps everyone happier.
Best Practices
- Have a clear refund policy - Tell customers upfront when refunds are allowed.
- Process refunds quickly - Don't make customers wait. Fast refunds prevent chargebacks.
- Send confirmation - Email customers when you process their refund so they know to expect it.
- Keep records - Track why refunds happen. If you see patterns, fix the underlying problem.
- Use partial refunds - If only part of an order has issues, refund just that part.