Charge Voucher

It charges a voucher with a specified amount. If free credit is set for a particular voucher, the free credit amount is automatically applied.

POST https://api.e-guma.ch/v1/vouchers/{code}/charge.json?apikey={api-key}

Parameters

code
required
The alphanumeric code of the voucher. The code has 12 characters. You can pass the code with (e.g. ABCD-ABCD-ABCD) or without (e.g. ABCDABCDABCD) dashes.

Please use url_encode for the code as it might contain special characters.
api-key
required

POST Data

amount_in_cents
required
The amount to recharge the voucher.
payment_id
optional
If no payment_id is provided, the default payment will be used.
free_credit_in_percentage
optional
This percentage of the amount_in_cents is credited as free credit. General settings for free credit are overruled with this value. This value can not be used if the client is using the legacy recharging procedure.
reference
optional
An optional alphanumeric reference can be transmitted. 256 characters max.

Return

charge_tokenUse this token to cancel a recharge. This token will only be returned if the client is using the new charging procedure.
codeThe same voucher code as you provided as parameter
balance_in_centsThe new balance
free_credit_amount_in_centsThe credited amount of free credit. Will only be returned if the new charging procedure is in use.

Example

https://api.e-guma.ch/v1/vouchers/JWCPP7QV25S4/charge.json?apikey=510e32c594d84816a4af9df1
{
  "amount_in_cents":5000
}
{
  "charge_token": "671a6539e3365417cc2ffbe6",
  "code":"JWCPP7QV25S4",
  "balance_in_cents":40000,
  "free_credit_amount_in_cents": 0
}