Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| technical:api-voucher-add [2026/05/21 08:47] – system | technical:api-voucher-add [2026/05/21 09:03] (current) – system | ||
|---|---|---|---|
| Line 31: | Line 31: | ||
| ----------------- | ----------------- | ||
| - | ====== Add a single | + | ====== Add single |
| * When using the API to generate vouchers you have the option to create a single voucher or a batch of vouchers. | * When using the API to generate vouchers you have the option to create a single voucher or a batch of vouchers. | ||
| - | * Here we will cover the API call to create a single voucher. | + | <file php add_voucher.php> |
| - | <file php add_single_voucher.php> | + | |
| <?php | <?php | ||
| // Configuration | // Configuration | ||
| - | $api_url | + | $api_url |
| - | $token | + | $token |
| $cloud_id | $cloud_id | ||
| - | | + | $realm |
| - | $password | + | $profile |
| - | | + | |
| - | $profile | + | |
| - | + | ||
| // Set API payload | // Set API payload | ||
| $payload = [ | $payload = [ | ||
| - | | + | |
| //Required Fields | //Required Fields | ||
| - | 'username' | + | 'single_field' |
| - | | + | ' |
| - | ' | + | ' |
| - | ' | + | ' |
| - | ' | + | ' |
| - | ' | + | |
| - | | + | //To create a batch these are needed (leave out for single voucher creation) |
| - | + | 'quantity' | |
| - | / | + | 'batch' |
| - | //Optional Fields | + | |
| - | 'name' | + | |
| - | 'surname' | + | |
| - | 'phone' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | */ | + | |
| ]; | ]; | ||
| Line 88: | Line 68: | ||
| $response = curl_exec($ch); | $response = curl_exec($ch); | ||
| curl_close($ch); | curl_close($ch); | ||
| - | echo " | + | echo " |
| ?> | ?> | ||
| </ | </ | ||
| - | * Now that we have created a Permanent User, we will cover some common actions that can be done on the Permanent User via the API. | + | * The reply will be in JSON which can be used should there be a requirement |