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:
The REST interface
Insert code on selected pages
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 store where the app is installed, you can choose whether you want write, read, or all permissions for that API token. |
| Monthly price | The monthly price of your app. The amount is split 80/20, with Shoporama keeping 20% and paying out the rest. Once an app has been switched to "active," you can no longer raise the price. You can only lower it. |
| Callback URL |
A single URL that can receive all callbacks and events. The arguments
Bruger din app felter, hvor brugeren selv kan indtaste oplysninger, vil disse komme med i feltet For events and webhooks, the call will contain the data included in our events and webhooks. This data varies depending on whether it involves events, products, orders, etc. To verify whether 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 can choose which webhooks you want to receive. You can receive webhooks when changes are made to orders (status, paid, created), products, or inventory. |
| Events |
Here, you can choose which events you want to receive. Events may be sent more frequently than webhooks. For example, when a user adds an item to their cart or proceeds to checkout. We offer 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 store, an API key is created for the app, and that key can be used to access our
REST interface for that store. The API key is sent to your callback URL as the
app_token field. Please note that the same usage rules apply to this API access as they do to regular API keys.
In addition to access to our standard rest interface, you can retrieve a list of online stores 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
Det er muligt at indsætte kode fire steder på de shops der installerer app'en:
<head>
<body>
</head>
</body>
You can insert code on all pages, or only on product pages, landing pages, categories, static pages, blog posts, or on /search, /basket, /address, /shipping, /approve, /thanks, /order, and /also.
You can use Smarty code in the inserted code, and you can access the values the user has entered
in fields such as <{$app_vars.var_name}>.
The above can be combined in any way you like, so it's possible to insert a piece of code into <head>
on all pages, but on /thanks you'll want to add something extra.
5 Meta data
Fields allow you to create input fields that your users can fill out 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.
Vi understøtter følgende felttyper:
text
integer
boolean
list
color
richtext
code
textarea
status
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.
Status Fields
A " status " field shows the user how your app is performing—for example, whether the connection is working and what has happened today. It appears as a status box with an icon and a few lines of text in the app's settings, and it is not saved. The content is fetched from the same URL as external fields every time the page is displayed:
{
"level": "ok",
"title": "Forbundet til Min Butik",
"lines": ["86 varer synkroniseres", "Kald i dag: 89"]
}
The level can be "ok," "warning," "error," or "info," and determines the icon and color. The text is displayed as plain text (HTML-escaped), with a maximum of 20 lines. If you enter a response in an external text field, the value is displayed as a heading.
If the user needs to take an action—such as logging in to a third-party service—the response may include a button. The URL must use "https" and be on the same domain as your callback URL; otherwise, the button will not appear:
{
"level": "warning",
"title": "Ikke forbundet",
"action": {"label": "Forbind", "url": "https://din-app.dk/connect?webshop_id=123&sig=..."}
}