Redeeming KESC
Learn how to convert KESC back to KES for your users.
Overview
Redemption is the process of converting KESC stablecoins back to Kenyan Shillings (KES). KESC is burned and KES is sent to the user's M-Pesa account.
Redemption Flow
- User initiates a redeem request in your app
- Your backend calls the Pyramid API to create a redemption
- Pyramid burns the KESC
- KES is sent to user's M-Pesa account
- You receive a webhook notification
Implementation
const response = await fetch('https://api.pyramid.africa/v1/transactions/redeem', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: 'acc_xyz789',
amount: 500.00,
reference: 'redeem_' + Date.now()
})
});
const transaction = await response.json();
console.log(transaction.id); // txn_def456