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.com", "contactpersoon.telefoon1": "050-2112212" // contact_person.phone1 } }
- JSON Parameters:
voucher_template_id (int) – Required The
idfield 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_urlrefers 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.
Voucher QR code¶
- GET /api2/vouchers/(int: id)/qrcode¶
Returns the contents of the QR code that redeems the voucher at the Recras Point-of-Sale. This is the same code as the QR code on the voucher PDF, so it can be shown to the customer, for example in a customer portal. Turning the text into a QR code image is up to you.
To find the
idof a voucher by its code, useGET /api2/vouchers/by_code/(code).Example request:
GET /api2/vouchers/12/qrcode HTTP/1.1 Host: demo.recras.nl Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "qr_code": "V:CXVQV-Q9AQ2-4J4FJ:0:e49ae450de64dd57ec659cfc61c04f175a0b6efd0dcc8c518f41ac4d4cf6fa82" }
- JSON Parameters:
qr_code (string) – The text to put in the QR code.
- Status Codes:
200 OK – no error
403 Forbidden – the user may not edit vouchers
404 Not Found – there is no voucher with this
id
List vouchers¶
- GET /api2/vouchers¶
Returns the vouchers, newest first, 1000 per page. Deactivated vouchers and vouchers whose online payment has not been completed are left out.
Example request:
GET /api2/vouchers?page=1&embed=Customer HTTP/1.1 Host: demo.recras.nl Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json [ { "id": 25, "created_by": 2, "updated_by": 2, "created_at": "2026-11-03T14:23:33+01:00", "updated_at": "2026-11-03T14:23:33+01:00", "version": 1, "code": "URDLA-66S54-EH6MA", "title": "Climbing", "product_amount": 1, "product_amount_per_booking": null, "product_amount_remaining": 1, "customer_id": 635, "expiration_date": "2027-11-03", "internal_reference": "online_voucher", "voucher_template_id": 1, "credit": null, "type": "PRODUCT", "productgroep_id": null, // (product_group_id) "is_deactivated": false, "deactivated_at": null, "deactivated_by": null, "deactivation_note": null, "DeactivatedBy": null, "Products": [ { "id": 104, "naam": "Climbing" // (name) } ], "Customer": { "id": 635, "name": "The Climbers", "display_name": "The Climbers", "address": "Dorpsstraat 1", "postcode": "1234 AB", "town": "Groningen", "MainContact": { "id": 474, "given_name": "Nemo", "family_name": "Nameson", "email": "api@recras.com" } } } ]
- Query Parameters:
page (int) – Required The page to return, starting at 1.
q (string) – Only vouchers whose code, title or internal reference contains this text. Dashes are ignored.
type (string) – Only vouchers of this type,
PRODUCTorCREDIT.customer_id (int) – Only vouchers of this customer, or with
0only vouchers without a customer.internal_reference (string) – Only vouchers with exactly this internal reference.
created_at> (datetime) – Only vouchers created on or after this moment.
created_at< (datetime) – Only vouchers created on or before this moment.
expiration_date> (date) – Only vouchers that expire on or after this date.
expiration_date< (date) – Only vouchers that expire on or before this date.
show_deactivated (boolean) – Also return deactivated vouchers.
embed (string) –
Customeradds the voucher’s customer (for a sold voucher, the buyer) with its main contact; this needs theviewContactpermission.Customerisnullfor a voucher without a customer,MainContactisnullfor a customer without a main contact.
- Status Codes:
200 OK – no error
403 Forbidden – the user may not view booking costs, or asks for
embed=Customerwithout theviewContactpermission406 Not Acceptable – a parameter is missing or invalid