const rewardsUserId = 'USER_REWARDS_ID';
const jwtToken = 'YOUR_JWT_TOKEN';
async function decreaseWithdrawalLimit(rewardsUserId, amount, currency) {
const response = await fetch(
`https://api.zbdpay.com/api/v1/rewards/user/${rewardsUserId}/deduct`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${jwtToken}`,
'z-client': 'developer-dashboard',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: amount,
currency: currency,
type: 'DEDUCT-TIME-BASED-REWARD'
})
}
);
const data = await response.json();
if (data.success) {
console.log('Withdrawal limit decreased successfully');
return data;
} else {
throw new Error(`Failed: ${data.message}`);
}
}
// Decrease limit by 500 MSATS
await decreaseWithdrawalLimit('b28e0306-2c06-4092-8d56-a1623d6b97fb', 500, 'MSATS');