Palbase IAP · API
/iap/customers/{customer_id}/credits/forgiveForgive a debt
Takes what a customer owes in a credit off their debt — all of it, or amount of it — saying why: a refund took back credits they had already spent, and support lets it go. The next credits they get then count in full. Answers what it took off and the account it left; a customer who owes nothing is forgiven 0. A credit the catalog no longer defines can still be forgiven while the customer has an account in it. Emits the credits' events it crosses and iap.customer.changed.
Called by your server, with the project's secret key.
Path
customer_idstring · requiredThe customer: the user's id (a guest merged into an account names the account).Headers
Idempotency-Keystring · requiredRequired: a forgiveness of some of a debt applied twice would forgive twice. Makes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours. The answer commits with the forgiveness: a retry gets it back even when the first answer was lost.Request body
amountinteger · optionalHow much of the debt, at most all of it; absent or 0: all of it.creditsstring · requiredThe credit (a key of the catalog's credits).reasonstring · requiredWhy: the record.curl -X POST "https://<your-ref>.palbase.studio/iap/customers/<customer_id>/credits/forgive" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"credits":"string","reason":"string"}'Responses
200What was forgiven
400No reason, or one over 500 characters (`reason_required`), no Idempotency-Key (`idempotency_key_required`), or a field out of its bounds (`invalid_<field>`)
401No key, not a key of this project, or a token that is not valid (the edge's answer)
403Not the project's secret key (`secret_key_required`)
404A user never seen here (`customer_not_found`): they owe nothing
409A request with this Idempotency-Key is still running (`idempotency_key_in_use`, Retry-After)
410The user was deleted (`customer_erased`): their id is no customer's again
413The request body is too large (`request_too_large`)
422Neither the catalog nor the customer's accounts have this credit (`unknown_credit`); or the Idempotency-Key was sent with a different request (`idempotency_key_reused`)
429Over the project's request limit; Retry-After says when to try again
503Another change to this customer is in progress (`customer_busy`), or the platform could not answer now; retrying is safe after Retry-After
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation ForgiveCredits of iap's contract.