Skip to main content
Applies a redeem code (for example, a promotional code or a top-up voucher) to your client’s wallet. On success, returns the credits granted by the code, the wallet’s new total balance, and the expiry date of the newly funded bucket (if any). Pair with credits.get_balance. Checking warning_low is a good place to prompt the operator for a code.

Parameters

string
required
The redeem code to apply, in its canonical format (for example "SYN-XXXX-XXXX-XXXX-X"). Codes are case-sensitive.

Returns

RedeemResult with the outcome of the redemption.
string
Stable identifier for this redemption. Use it to correlate with the matching ledger entry from credits.get_ledger.
float
Number of credits added to the wallet by this code.
float
Total wallet balance after the redemption, in credits.
datetime | None
When the newly funded bucket expires, if the code carries an expiry. None means the granted credits do not expire.

Example

Raises

  • InvalidInputError: when the code is malformed or unknown.
  • InsufficientCreditsError: when the code has already been redeemed, has expired, or has been exhausted. The exception’s balance_credits field is None for these cases, so you can surface the error message directly.
  • SynapAuthError: when the API key is missing or invalid.

See also