Skip to main content

Delete vouchers

Deleting 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": "delete-voucher",
"voucher_key": "c4bc4a3115e21e228936f4223dd89b22c238847c935514e1fdcb96f3c75118ac"
}
}

Overview

The delete-voucher API allows a user to delete a variable price voucher or other type of voucher which has status "claimed" (i.e. which has not yet been set to "verified" when verified by the retailer).

Permissions and Authentication

This API call requires a valid Spaaza session. The session can be as follows:

ParameterDescription
userA session generated by an end-user login.
or
adminA session generated by administrative user login.
or
privilegedAn OAuth-based mechanism for trusted third-parties.

Note that if admin authentication is used and the admin user does not have sufficient permissions to delete the voucher, an error will be generated.

HTTP Parameters

The following HTTP parameters can be passed to the API:

ParameterDescription
voucher_key (string, mandatory*)The unique key of the voucher which is being deleted. This is a string, for instance c4bc4a3115e21e228936f4223dd89b22c238847c935514e1fdcb96f3c75118ac.
voucher_id (integer, mandatory*)The ID of the voucher which is being deleted.
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:

ParameterDescription
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.