Shoporama Apps
Below you will find information on how to develop Shoporama Apps.
Menu
1 Overview
Overall, a Shoporama app provides access to two things when a user installs it on their shop:
REST-interfacet
at indsætte kode på udvalgte sider
Everyone can create apps as a starting point, but in order for other shops to use your apps, it requires approval.
2 Settings
The settings options for apps are:
| Field | Content |
|---|---|
| Name | Short name. Used in overviews and emails. |
| Description | Extended description of what your app does. It is not possible to use HTML codes. Only a-tags for links. |
| Category | Optional category |
| Access | Because your app creates an api token in the shop that installs the app, you can choose whether you want write, read, or all rights to that api token. |
| Monthly price | A monthly price that your app costs. An 80/20 split is made, with Shoporama keeping 20% and paying out the rest. Once an app is switched to active, you can no longer increase the price. Only down. |
| Callback URL |
One URL that can receive all callbacks and events. The argument
If your app uses fields where the user can enter information, this will be included in the For events and webhooks, the call will contain the data contained in our events and webhooks. These vary whether they are events or products, orders, etc. To validate if a callback comes from Shoporama, we add the header |
| Only allow on the following shops | Option to only allow the app on a series of webshops. |
| Webhooks | Here you choose which webhooks you want to receive. You can receive webhooks when changes are made to orders (status, paid, created), products, or stock. |
| Events |
Here you choose which events you want to receive. Events have the option to be sent more frequently than webhooks, for example, when a user adds something to the basket or goes to checkout. We have the following events: add_to_basket
update_basket
view_basket
view_address
view_shipping
view_approve
view_thanks
approved
order_created
paid
add_label
remove_label
|
3 REST access
When an app is installed in a shop, an api key is created for the app and with that key you can access ourrest interface for the shop in question. Api keys are sent to your callback url as theapp_token field. Note that the same rules apply for api access as for regular api keys in terms of usage.
In addition to accessing our regular rest interface, it is possible to pull a list of webshops that have installed your app by calling:
GET /REST/app-status HTTP/2
Host: www.shoporama.dk
Authorization: App {din token}
Note that auth-scheme is App.
4 Add code
It is possible to insert code in four places on the shops that install the app:
<head>
<body>
</head>
</body>
It is possible to insert code on all pages, or only products, landing pages, categories, static pages, blog posts, or on /search, /basket, /address, /shipping, /approve, /thanks, /order, and /also.
It is possible to use Smarty code in the code that is inserted and it is possible to access the values entered by the user in fields like <{$app_vars.var_name}>.
The above can be combined in any way you want, so it is possible to insert a piece of code in <head>on all pages, but on /thanks you want to add something extra.
5 Meta data
Fields allows you to create some input fields for your users to fill in when they install the app. You can create as many fields as you want. The values are included in callbacks when the user updates the settings.
We support the following field types:
text
integer
boolean
list
color
richtext
code
Eksterne felter
For både text og list felter er det muligt at bruge eksterne værdier.
Eksterne lister
For lister trækkes værdierne fra https://example.com/callback?type=field&name={name}, og skal returnere json i key:value format:
{
"key1": "value1",
"key2": "value2"
}
Eksterne tekstfelter
For tekstfelter hentes værdien fra samme URL som lister. Værdien vises som read-only for brugeren. Formatet kan være enten en simpel tekststreng eller JSON:
{
"value": "tekst værdi"
}
Eller bare returner en simpel tekststreng direkte.