Create Voucher
Creates a new SP voucher definition.
Example curl:
```bash
curl --request POST '{{base_url}}/sp/vouchers/create' \
--header 'Authorization: Bearer {{access_token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"idempotency_key": "{{$timestamp}}-voucher-create",
"campaign_name": "Birthday Voucher",
"coupon_name": "Birthday Voucher",
"coupon_code": "BIRTHDAY10",
"coupon_qty": 100,
"coupon_value": 10,
"location_ids": [{{location_id}}]
}'
```
Example success response shape:
```json
{
"success": true,
"message": "Voucher created successfully.",
"data": {
"voucher_id": 10,
"campaign_name": "Birthday Voucher",
"coupon_code": "BIRTHDAY10",
"coupon_value": 10,
"archived": false
},
"meta": {}
}
```
Example error response shape:
```json
{
"success": false,
"message": "The same idempotency_key cannot be reused with a different payload.",
"error": {
"code": "idempotency_key_reused_with_different_payload",
"details": {}
}
}
```
Common platform errors:
- `idempotency_key_required`
- `sp_scope_not_granted`
- `sp_token_scope_missing`
- `sp_location_not_allowed`
- `legacy_field_not_allowed`
- `query_parameters_not_allowed`
- `invalid_content_type`
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Headers
Authorization
Response
201 Created Example
success
message
data
meta
