Referência de APIWallet
Redeem wallet balance
Redeem available wallet balance to a supported destination (Guru subscription discount or Yampi coupon). Amount is in R$ (not cents).
Redeem available wallet balance to a supported destination (Guru subscription discount or Yampi coupon). Amount is in R$ (not cents).
Authorization
ApiKeyAuth X-API-Key<token>
API key authentication. Pass your API key via the X-API-Key header. Alternatively, you can use Authorization: Bearer {key}.
In: header
Request Body
application/json
email*string
Member email address
Format
emailamount*number
Amount to redeem in R$ (not cents)
destination*string
Where to apply the redemption
Value in
"guru_subscription" | "yampi_coupon"subscriptionId?string
Guru subscription ID. Required when destination is guru_subscription.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://api-base.rafo.work/api/v1/wallet/redeem" \ -H "Content-Type: application/json" \ -d '{ "email": "customer@example.com", "amount": 2000, "destination": "guru_subscription", "subscriptionId": "sub_xxxxx" }'{
"success": true,
"data": {
"memberId": "550e8400-e29b-41d4-a716-446655440000",
"amountRedeemed": 2000,
"destination": "guru_subscription",
"newBalance": {
"totalEarned": 5000,
"totalRedeemed": 4000,
"available": 1000,
"pending": 0,
"cancelled": 0
},
"integration": {
"provider": "guru",
"subscriptionId": "sub_xxxxx",
"appliedCycles": 1
}
}
}{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient available balance"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}{
"error": {
"code": "MEMBER_NOT_FOUND",
"message": "Member not found"
}
}