Create Order

This endpoint is used to issue gift vouchers for the e-surprise platform.

POST https://api.e-guma.ch/v1/esurprise/voucher_orders.json?apikey={api-key}

Parameters

api-key
required

POST Data

order_lines
required
List of order lines, see order line object below for details
delivery
required
Provide one of those values pdf|codes
language
required
Language as a two-letter code (ISO 639-1). The pdf with the vouchers will be generated in the provided language. e-guma supports German, French, Italian, English, Spanish and Portuguese. However it is up to each client, which languages are used.

Order line object

product_id
required
Id of the voucher template
unit_price_in_cents
required
Unit price

For value vouchers:
Use a value between CHF 20 and CHF 3'000

For package vouchers (e.g. Brunch for 2):
Use the same unit price as set in e-guma.
quantity
required
Quantity
If you set delivery to codes, then it is required to set the quantity to 1.

Return

order_idOrder Id
Store it for further actions (e.g deleting the order)
order_numberOrder number
pdf_urlUrl of the pdf which contains the vouchers.

For pdf
You can provide this url in the confirmation e-mail.

For codes
This value will be empty.
vouchersList of the vouchers. Each voucher has the following properties:

- code (e.g. QXKR2VRHPEG7): you can use this value for the qr code

- code_formatted (e.g. QXKR-2VRH-PEG7): you can use this value to print on the voucher

- product_id: the same product_id as you passed in

- amount_in_cents: the same amount (unit_price_in_cents) you passed in

- expiry_date: After this date, the voucher will expire. The API returns this value in ISO 8601 format.

The order of the vouchers is the same as the passed in order_lines.

Example (delivery set to codes)

POST https://api.e-guma.ch/v1/esurprise/voucher_orders.json?apikey=510e32c594d84816a4af9df1
{
  "order_lines": [
    {
      "product_id": "c333c464-8676-4489-ae97-360236d7c999",
      "unit_price_in_cents": 1000,
      "quantity": 1
    },
    {
      "product_id": "c333c464-8676-4489-ae97-360236d7c999",
      "unit_price_in_cents": 5000,
      "quantity": 1
    }
  ],
  "language": "de",
  "delivery": "codes"
}
{
  "order_id": "50b6d149-49c4-4d2d-a96d-59d251de1edb",
  "order_number": "G10015",
  "pdf_url": "",
  "vouchers": [
    {
      "code": "LSFR5D2C5A65",
      "code_formatted": "LSFR-5D2C-5A65",
      "product_id": "c333c464-8676-4489-ae97-360236d7c999",
      "amount_in_cents": 1000,
      "expiry_date": "2019-12-31T00:00:00.0000000"
    },
    {
      "code": "CR7MFKRVH665",
      "code_formatted": "CR7M-FKRV-H665",
      "product_id": "c333c464-8676-4489-ae97-360236d7c999",
      "amount_in_cents": 5000,
      "expiry_date": "2019-12-31T00:00:00.0000000"
    }
  ]
}