Skip to main content

Voucher Resource

The Voucher resource represents a digital entitlement that can be redeemed for discounts or rewards within the Spaaza platform. Each voucher has properties for amount information, status tracking, campaign association, and redemption details.

Contents

Introduction

The Voucher resource represents a digital entitlement that can be redeemed for discounts or rewards within the Spaaza platform. Vouchers support multiple types through a discriminator mapping system:

  • basket - Fixed amount discount vouchers
  • basket_pct - Percentage-based discount vouchers
  • honour - Third-party honour code vouchers
  • basket_fixed_unit - Fixed unit basket vouchers

Vouchers have a comprehensive status tracking system with three possible states: generated, claimed, and redeemed. Once a voucher reaches redeemed status, it cannot be changed to any other status.

Available Paths

Single Resource Operations

  • GET /resources/voucher/{id} - Retrieve a voucher by ID
  • GET /resources/voucher?{identifier parameter}={value} - Retrieve a voucher (by identifier parameter)
  • POST /resources/voucher - Create a new voucher
  • PATCH /resources/voucher/{id} - Update a voucher by ID
  • PATCH /resources/voucher?{identifier parameter}={value} - Update a voucher (by identifier parameter)
  • PUT /resources/voucher/{id} - Replace a voucher by ID
  • PUT /resources/voucher?{identifier parameter}={value} - Replace a voucher (by identifier parameter)
  • DELETE /resources/voucher/{id} - Delete a voucher by ID
  • DELETE /resources/voucher?{identifier parameter}={value} - Delete a voucher (by identifier parameter)

Multiple Resource Operations

  • GET /resources/vouchers - Retrieve multiple vouchers with filtering, sorting, and pagination support

Properties

NameDescriptionStandard Attributes(details)Spaaza Vendor Attributes(details)
amountVoucher amounttype: float
nullable: true
recursionLevel: 1
operations: ["post", "put", "patch"]
amount_redeemedThe amount of the voucher which was redeemedtype: float
nullable: true
recursionLevel: 2
operations: ["post", "put", "patch"]
basketBasket which redeemed the vouchertype: object
nullable: true
required: id
recursionLevel: 2
immutable: true
basket_owner_code_exclusiveIf set, a locked voucher can only be redeemed using this retailer_basket_codetype: string
nullable: true
maxLength: 255
recursionLevel: 2
immutable: false
operations: ["post", "put", "patch"]
campaignCampaign with which the voucher is associatedtype: object
nullable: false
required: id
recursionLevel: 1
filter-property: true
sort-by-property: true
immutable: true
operations: ["post", "get"]
created_dateVoucher created datetype: date-time
nullable: false
readOnly: true
recursionLevel: 2
immutable: true
sort-by-property: true
creating_userUser to whom the voucher belongstype: object
nullable: true
required: id
recursionLevel: 2
filter-property: true
immutable: true
operations: ["get", "delete"]
currencyCurrency associated with the vouchertype: object
nullable: true
required: id
recursionLevel: 2
immutable: true
db_redeemed_dateVoucher redeemed date in the Spaaza databasetype: date-time
readOnly: true
recursionLevel: 2
immutable: true
deletedVoucher deleted. Once deleted, a voucher cannot be undeleted.type: boolean
nullable: false
recursionLevel: 1
operations: ["get"]
descriptionVoucher descriptiontype: string
nullable: true
maxLength: 4096
recursionLevel: 2
discount_ratioThe discount percentage associated with the vouchertype: float
nullable: true
readOnly: true
minimum: 0
maximum: 1
recursionLevel: 2
operations: ["post", "put", "patch"]
expiry_dateDate the voucher expirestype: date-time
nullable: true
readOnly: false
recursionLevel: 1
immutable: false
sort-by-property: true
operations: ["post", "put", "patch", "get"]
required-in: ["post"]
generating_return_transactionReturn transaction which caused the voucher to be createdtype: object
nullable: true
required: id
recursionLevel: 2
immutable: true
honour_codeVoucher honour codetype: string
nullable: true
maxLength: 255
recursionLevel: 2
immutable: false
operations: ["post", "put", "patch"]
idVoucher Spaaza IDtype: integer
readOnly: true
nullable: false
recursionLevel: 0
filter-property: true
sort-by-property: true
operations: ["get", "put", "patch", "delete"]
image_urlVoucher image URLtype: string
nullable: true
maxLength: 4096
recursionLevel: 2
keyVoucher keytype: string
readOnly: true
nullable: false
minLength: 64
maxLength: 64
recursionLevel: 1
filter-property: true
identifier: true
immutable: true
operations: ["get", "delete"]
last_modified_dateVoucher last modified datetype: date-time
nullable: false
readOnly: true
recursionLevel: 2
immutable: true
sort-by-property: true
locked_untilVoucher locked until datetype: date-time
nullable: false
readOnly: false
recursionLevel: 2
immutable: true
locking_codeVoucher locking codetype: string
nullable: true
maxLength: 255
recursionLevel: 2
immutable: false
operations: ["post", "put", "patch"]
notesVoucher notestype: string
nullable: true
maxLength: 4096
recursionLevel: 2
parent_voucherThe parent voucher, if this voucher was created to replace a previous one.type: object
nullable: true
recursionLevel: 2
filter-property: true
immutable: true
operations: ["get"]
redeemed_dateVoucher redeemed datetype: date-time
readOnly: true
recursionLevel: 2
immutable: true
redemption_exclusive_businessBusiness (branch) which the voucher can only be redeemed attype: object
nullable: true
required: id
recursionLevel: 2
shopify_discount_codeShopify Discount Code associated with the vouchertype: string
nullable: true
maxLength: 128
recursionLevel: 2
shopify_discount_code_idShopify Discount Code ID associated with the vouchertype: string
nullable: true
maxLength: 128
recursionLevel: 2
shopify_price_rule_idShopify Price Rule ID associated with the vouchertype: integer
format: int64
nullable: true
recursionLevel: 2
statusVoucher status: generated, claimed, redeemed. Once status is redeemed, it cannot be changed.type: string
enum: ["generated", "claimed", "redeemed"]
nullable: false
recursionLevel: 1
filter-property: true
sort-by-property: true
operations: ["post", "put", "patch", "get", "delete"]
required-in: ["post"]
taskTask which caused the voucher to be createdtype: object
nullable: true
required: id
recursionLevel: 2
immutable: true
textVoucher texttype: string
nullable: true
maxLength: 255
recursionLevel: 2
immutable: false
operations: ["post", "put", "patch"]
third_party_idThird party ID associated with the vouchertype: integer
format: int64
nullable: true
readOnly: true
recursionLevel: 2
titleVoucher titletype: string
nullable: true
maxLength: 255
recursionLevel: 2
immutable: false
operations: ["post", "put", "patch"]
typeVoucher typetype: string
nullable: false
minLength: 1
maxLength: 255
recursionLevel: 1
filter-property: true
immutable: true
operations: ["post", "get"]
userUser to whom the voucher belongstype: object
nullable: false
required: id
recursionLevel: 1
filter-property: true
sort-by-property: true
immutable: true
operations: ["post", "get", "delete"]

Property Notes

  • Voucher Types: Vouchers support four types through a discriminator mapping system: basket (fixed amount), basket_pct (percentage-based), honour (third-party honour codes), and basket_fixed_unit (fixed unit basket vouchers).
  • Status Values: Vouchers have three possible status values: generated (created and available), claimed (claimed but not redeemed), and redeemed (redeemed and immutable). Once redeemed, status cannot be changed.
  • Identifier Properties: The key property can be used as an identifier parameter for single resource operations instead of the numeric id. Properties marked with identifier: true can be used as identifier parameters.
  • Filter Properties: Properties marked with filter-property: true can be used to filter results when retrieving multiple vouchers.
  • Recursion Levels: The recursionLevel attribute controls at which API response detail levels each property is included.
  • Operations: The operations attribute indicates which HTTP methods can use each property as a parameter.

Sample Voucher JSON

{
"amount": 10.0,
"amount_redeemed": null,
"basket": null,
"basket_owner_code_exclusive": null,
"campaign": {
"id": 12345
},
"created_date": "2025-01-15T10:30:00Z",
"creating_user": null,
"currency": null,
"db_redeemed_date": null,
"deleted": false,
"description": null,
"discount_ratio": 0.0,
"expiry_date": "2025-02-15T23:59:59Z",
"generating_return_transaction": null,
"honour_code": null,
"id": 67890,
"image_url": null,
"key": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2",
"last_modified_date": "2025-01-15T10:30:00Z",
"locked_until": null,
"locking_code": null,
"notes": null,
"parent_voucher": null,
"redeemed_date": null,
"redemption_exclusive_business": null,
"shopify_discount_code": null,
"shopify_discount_code_id": null,
"shopify_price_rule_id": null,
"status": "generated",
"task": null,
"text": "€10 discount voucher",
"third_party_id": null,
"title": "Welcome Bonus",
"type": "basket",
"user": {
"id": 54321
}
}

This example shows a typical Voucher resource with amount, status, campaign association, and expiry details.