You authenticate to the e-guma API by providing an API key in the request. Store that key in your system.
We recommend providing an input field for vouchers on the checkout page.
Use the Balance Endpoint to verify the entered voucher. The Balance Endpoint returns the voucher code. It’s very important to use the returned voucher code for further actions. The reason for that is the voucher2mobile - ShortCode, which is only temporarily available.
If the field is_redeemable is set to false, show an appropriate message. Don't use the returned message field.
If the voucher is fine, you can determine the amount which has to be redeemed. The user doesn't have to enter the amount. The amount can be calculated like that: min(remaining_amount_to_pay, voucher_balance). In order to redeem the voucher, call the Redeem Endpoint with the calculated amount. Save the voucher code and the redeem_token in your database.
If the order has to be canceled, then you also need to cancel the redemption. Use the Cancel Request with the redeemed code and amount for that case.
If you redeem a voucher don't reduce the VAT. Vouchers are not discount- / promo-codes.
Updated almost 2 years ago