Create Order
This endpoint can be useful when you want to issue gift vouchers in your e-commerce shop. Please read this documentation for more information.
POST https://api.e-guma.ch/v1/voucher_orders.json?apikey={api-key}
Parameters
api-keyrequired |
POST Data
customer | Customer, see customer object below for details. If you omit the customer, then a default customer (passer-by) will be set. |
order_linesrequired | List of order lines, see order line object below for details |
deliveryrequired | Provide one of those values pdf|codes|mailing |
languagerequired | 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. |
payment_id | Optionally, you can pass a payment id. If this value is empty then a default payment will be used. |
Customer object
emailrequired | Email address |
titlerequired | Provide one of those two values Mr|Mrs |
first_namerequired | First name |
last_namerequired | Last name |
companyrequired | Company name |
streetrequired | Street |
ziprequired | Zip code |
cityrequired | City |
countryrequired | Country as two-letter code (ISO 3166-1 alpha-2) |
phonerequired | Phone number |
Order line object
product_idrequired | Id of the voucher template |
unit_price_in_centsrequired | Unit price For value vouchers: Normally, there is only one value voucher in e-guma. You can use the same product Id with different unit prices. For package vouchers (e.g. Brunch for 2): Use the same unit price as set in e-guma. |
quantityrequired | Quantity If you set delivery to codes, then it is required to set the quantity to 1. |
message | Personal message for the receiver of the voucher. The message will be printed on the voucher. If you set delivery to codes, then you don't need to pass the message. |
Return
order_id | Order Id Store it for further actions (e.g deleting the order) |
order_number | Order number |
pdf_url | Url of the pdf which contains the vouchers. For pdf You can provide this url in the confirmation e-mail. For mailing (printing) You can provide this url at the order details so it can easily get printed and shipped. For mailing (using depot vouchers) This value will be empty. For codes This value will be empty. |
vouchers | If delivery is set to codes, then a list of vouchers will be returned. Each voucher has the following properties: - code (e.g. QXKR2VRHPEG7): you can use this value for the barcode or 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. |
manage_order_url | Url to open the ordered vouchers in e-guma Backoffice. |
Example (delivery set to codes)
POST https://api.e-guma.ch/v1/voucher_orders.json?apikey=510e32c594d84816a4af9df1
{
"customer": {
"email": "[email protected]",
"title": "Mr",
"first_name": "John",
"last_name": "Doe",
"street": "Walchestrasse 15",
"zip": "8006",
"city": "Zürich",
"country": "CH",
"phone": "+41 44 500 54 00"
},
"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": "",
"manage_order_url": "http://www.e-guma.ch/Backend/Voucher/Voucher.aspx?search=param&tnr=GI1015&___mId=2",
"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"
}
]
}
Updated 3 months ago