Expiring vouchers
Returns an OK code and echoes the ID of the variable price voucher key supplied. A sample is shown below:
{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"result_type": "expire-voucher",
"voucher_key": "c4bc4a3115e21e228936f4223dd89b22c238847c935514e1fdcb96f3c75118ac"
}
}
Overview
- Call name: expire-voucher
- Endpoint URL: https://api0.spaaza.com/expire-voucher
- Request methods: POST, PUT
- Response Content-Type: application/json
- Auth required: yes
The expire-voucher API sets the expiry date of a voucher which has status “claimed” to the current time, hence expiring the voucher.
Permissions and Authentication
This API call requires a valid Spaaza session. The session can be as follows:
Parameter | Description |
---|---|
user | A session generated by an end-user login. |
or | |
admin | A session generated by administrative user login. |
or | |
privileged | An OAuth-based mechanism for trusted third-parties. |
Note that if admin authentication is used and the admin user does not have sufficient permissions to expire the voucher, an error will be generated.
HTTP Parameters
The following HTTP parameters can be passed to the API:
Parameter | Description |
---|---|
voucher_key (string, mandatory*) | The unique key of the voucher which is being expired. This is a string, for instance c4bc4a3115e21e228936f4223dd89b22c238847c935514e1fdcb96f3c75118ac . |
voucher_id (integer, mandatory*) | The ID of the voucher which is being expired. |
user_id (required with admin and privileged authentication) | The (Spaaza) id of the user/member/shopper to whom the voucher is assigned. |
chain_id (required with privileged authentication - see description) | The chain_id of the retailer with which the user/member/shopper is associated. This parameter is only required with privileged authentication, and is not required if the X-Spaaza-MyPrice-App-Hostname header is passed with the request (see Headers section). |
* At least one of the parameters voucher_key
or voucher_id
must be used.
Headers
The following headers can/must be passed to the API call:
Parameter | Description |
---|---|
X-Spaaza-MyPrice-App-Hostname required with privileged authentication (see description) | The hostname of the app for which the user is requesting the card. Only required with privileged authentication, and not required if the chain_id parameter is passed in the request (see HTTP Parameters section). |
Permissions
For user authentication this API call requires no specific permissions other than that the session should be for the user associated with the variable price voucher. For admin authentication this API requires that the admin user has DELETE permissions for their own retailer entity.