Vouchers¶
Current version: 0.2.0
Global Overview¶
Vouchers can be redeemed when a customer books online. This documentation describes the online purchase of vouchers.
To quickly integrate the sale of vouchers, it is advised to use Book processes. Use of our Javascript library is considered deprecated.
Voucher templates¶
- GET /api2/voucher_templates¶
Via this endpoint, the “Voucher templates” that can be purchased online can be requested. A voucher is created based on a Voucher template.
Example request:
GET /api2/voucher_templates HTTP/1.1 Host: demo.recras.nl Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json [ { "id": 1, "name": "Climbing", "description": "Climbing for 1 hour", "product_amount": 1, "price": 10, "expire_days": 365, "internal_reference": "online_voucher", "pdf_template_id": 12, "confirmation_mail_subject": "Your voucher", "confirmation_mail_body": "<p>Your voucher is attached.</p>", "contactform_id": 2, "company_id": 5, "products": [ 104, 105 ] } ]
- Status Codes:
200 OK – no error
Buy Voucher¶
- POST /api2/vouchers/buy¶
With this endpoint, it is possible to buy a voucher
Example request:
POST /api2/vouchers/buy HTTP/1.1 Host: demo.recras.nl Content-Type: application/json { "voucher_template_id":1, "number_of_vouchers":3, "contact_form": { "contactpersoon.voornaam": "Nemo", // contact_person.first_name "contactpersoon.achternaam": "Nameson", // contact_person.last_name "contactpersoon.email1": "api@recras.nl", "contactpersoon.telefoon1": "050-2112212" // contact_person.phone1 } }
- JSON Parameters:
voucher_template_id (int) – Required The
id
field of the Voucher template to buy.number_of_vouchers (int) – Required The number of vouchers to buy. Maximum is 100.
producten (array) – Required A list of booking lines (boekingsregels) to book, each element is a combination of an
arrangementsregel_id
(package_line_id) and a quantity (aantal).contact_form (object) – Required Completed contact form (contactformulier) belonging to this voucher template. For more information, see the documentation for _ContactformulierenSubmit <Contactformulieren opslaan> (Save Contact Forms).
redirect_url (URL) – A URL to which the customer is redirected after payment, regardless of the payment status. It is therefore up to the server to which
redirect_url
refers to check the status of the booking.
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "payment_url":"https://mollie.com/some_payment_url", "transaction_id":"tr_189481", "redirect_url":"https://mywebsite.nl/voucher_thankyou.html" }
- JSON Parameters:
payment_url (uri) – The URL where the voucher can be paid; the user must be sent to this page.
redirect_url (uri) – The URL where the user will be sent after the payment is completed.
transaction_id (string) – A unique transaction ID.