Skip to main content
POST
/
v1
/
vouchers
/
{code}
/
balance
Adjust Voucher Balance
curl --request POST \
  --url https://{cluster}.voucherify.io/v1/vouchers/{code}/balance \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '{
  "amount": 10000
}'
{
  "amount": 10000,
  "total": 20100,
  "balance": 20100,
  "type": "gift_voucher",
  "object": "balance",
  "related_object": {
    "type": "voucher",
    "id": "v_abCdEfghI1JKLMNPqRS2Tu3vWXyza4bc"
  }
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

code
string
required

A code that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.

Example:

"2CpRCE2c"

Body

application/json

Provide the amount to be added to/subtracted from the voucher.

Request body schema for vouchers/{code}/balance.

amount
integer
required

The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. The value is multiplied by 100 to represent 2 decimal places. For example 10000 cents for $100.00. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000.

source_id
string

The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service.

reason
string

Reason why the transaction occurred.

Response

Returns a balance object if the operation succeeded.

Response body schema for vouchers/{code}/balance.

amount
integer
required

The incremental amount added (positive integer) or subtracted (negative integer) to the current balance on the gift card or loyalty card. The value is multiplied by 100 to represent 2 decimal places. For example 10000 cents for $100.00.

total
integer
required

Total income incurred over the lifespan of the gift card or loyalty card.

balance
integer
required

The balance after adding or subtracting a specified amount. The value is multiplied by 100 to represent 2 decimal places. For example 10000 cents for $100.00.

type
enum<string>
required

The type of voucher being modified.

Available options:
gift_voucher,
loyalty_card
operation_type
enum<string>
required

The type of the operation being performed.

Available options:
MANUAL
object
enum<string>
default:balance
required

The type of the object represented by JSON. Default is balance.

Available options:
balance

Defines the resource that is being modified with the values that are returned in the balance object.

I