A callback URL is a web address called when an event occurs.
Ex : when you close a sale (=event), Hiboutik can send the sale data to a specific Sales callback URL.
You can setup callback URLs in “Settings/General settings” of your account.
1/ Why do I need callbback URLs ?
A callback URL allows a dynamic behavior like invoking one or several scripts when an event occurs.
Here are some examples :
When you close a sale, you can sync the inventory of your website or send automatically a survey to your customer.
When you create a product, you can launch a script to add also the product into your website back-office.
When you update a customer form, you can automatically send him an email confirming the modification.
In general, you can initiate one or several actions when an event occurs, like sending an SMS as well as changing the light intensity in your shop.
2/ How does URL callbacks work in Hiboutik ?
Callback URLS are specific to each point of sale in a multi-stores account.
Events that can activate a callback URL are :
– Validate a sale,
– Select/add/delete a payment method in a sale,
– Click on the callback icon in the sale,
– Create/modify a customer form,
– Stop a timestamp line,
– Add/modify/delete a schedule event.
Data are sent in POST to you callback URLs, and are different from an event to another.
For example, data sent when you close a sale are the following :
– order_id : the sale ID
– unique_order_id : the close sale ID (continuous and chronological close sale number)
– shop_id : the store ID (for multi-stores accounts)
– customer_id : the customer ID
– vendor_id : the vendor ID
– date_time : the date and time when you sale is closed
You can then use the Hiboutik API to get more information, like recovering products sold in the sale.
3/ Case study : Callback URL and the loyatly program
In each product form, you can register loyalty points earned when the customer purchases the product. Loyalty points are invariable.
But if you are selling an open price product (price is entered directly in the sale and can change from a sale to another), it is not possible to link it to proportional loyalty points.
To solve this problem, we will use the Hiboutik API to recalculate loyalty points when a sale is closed.
a/ Download and install the script
Recover your API key in “Settings/Users/Users” in your Hiboutik account (click on the wrench icon in front of your name).
Download the following script and modify it with your account name, your email address and your API key (line 20, 21 & 22) :
Install the script on your hosting solution and make it executable.
b/ Setup your callback URL
In “Settings/General settings”, enter the URL address of your script in the “Sales URL callback” field.
Ex : http://mydomain.com/fidelite.php
Now, when a sale is closed, it will automatically recalculate your loyalty points according to the rule you enter into your script.