Boxo Platform and Boxo SDK
In this section we will look at some additional integration details (such as user’s locale) when working with Boxo Platform and Boxo SDK.Payment Payload
Here is the payload that Boxo will send via platform to host app backend.Local pricing
When the order has a local pricing snapshot,custom_attributes also includes:
original_price— the order total in the quote currency, before conversion.initial_converted_price— that total converted into the local currency, before rounding.rounding_rule— code of the rounding rule that produced the charged amount. Omitted when no rounding rule ran.
amount on original_price and initial_converted_price is a decimal string with trailing zeros removed. provider_net_price is not converted.
When the source charges in the local currency, currency, amount, subtotal_amount, discount_amount, and tax_amount are the local amounts. amount is the rounded snapshot taken when the order was created, not a fresh conversion. Tax and discount are converted with the snapshot rate, and subtotal_amount absorbs the rounding difference so that subtotal_amount - discount_amount + tax_amount equals amount.
When a snapshot exists but the source still charges in the quote currency, the top-level amounts stay in that currency and the three attributes are still sent. The attributes are omitted entirely when the order has no snapshot.
In this example a 88.13 USD total is converted at 400 and ceiled to the next 100, so the host is asked to charge 35300 AMD:
Locale
Host app can provide language during initial launch and miniapp will be able to retrieve latest language settings.Closing miniapp and landing on Home page on next launch
In order to land on Home page each time miniapp is closed and reopened, asaveState=false can be passed. This behavior is available in versions starting from v0.1.4.
For example:
Deeplinks
The deeplink URL should include miniapp id and the relevant URL route, if needed to land user on a specific page. User will first deeplink to host app, then in host app it parses the deeplink and obtains the miniapp ID and the path to the page. Open the homepage of the miniappHide About from Menu
Available from SDK versionv0.1.6 (Capacitor v5) and v0.2.4 (Capacitor v6).
Returning user who has NOT purchased an eSIM will launch into Explore page. Otherwise, will launch Homepage
Caching
Miniapp config is cached for 60 seconds. Logo and other related miniapp configuration changes should be reflected on next launch after 60 seconds have passed.Android compatibility check enhancement
Available from SDK versionv0.3.0 for Capacitor v6.
Instead of performing model check against a compatible device list, Android SDK will perform eSIM compatibility check using native method and pass on the result to eSIM miniapp.
The feature is supported inside the SDK, no code change needed on host app side.
iOS direct installation
Here is an example of implementation of eSIM direct installation, sample code is also available here.Capacitor plugin
Capacitor plugin can be downloaded here. Example code reference can be viewed here. Latest version:v0.1.1 (includes changes to support play instruction video on Install Now page).
Webhooks
Here are examples payloads for various webhooks that eSIM Miniapp BE will send, if you have provided use with the webhook URL. eSIM backend will usehostapp_client_id and hostapp_client_secret configured in Boxo Platform and they will be passed as basic auth in Authorization header along with all requests. You can use this implement authentication for your webhook endpoint.
The plan object in webhook payloads includes a location object (the country or region the plan covers) and title_translations. Translated titles (title_translations on both the plan and its location) are included for the languages configured for your miniapp’s webhooks; if no languages are configured, these objects are empty.
eSIM order success
This event is fired when user successfully purchases a new eSIM or tops up existing eSIM.eSIM order failed
This event is fired when we were unable to fulfill given eSIM order. Hostapp can use it to initiate refund if this event is received. Can happen if eSIM is currently unavailable or eSIM provider is not available at given moment.eSIM order expired
This event is fired when if order hasn’t been marked as completed / failed by the hostapp within 15 minutes of order creation. All orders in pending status get automatically cancelled after 15 minutes if no final status (paid or failed) received from the hostapp.eSIM activated
This event is fired when eSIM activates for the first time.eSIM expired
This event is fired when eSIM has expired (data run out or it reached expiry date).eSIM data zero
This event is fired when eSIM data remaining reaches 0.eSIM data running low
This event is fired when eSIM data has been used 75% or 90%.Webhook Simulator
This endpoint allows to simulate various webbhooks sent by eSIM backend. Webhook simulator is available at<esim-backend-url>/api/v1/sources/<hostapp_name>/webhook/simulator/.
Here as an example request to webhook simulator and it’s payload: