Widget SDK

Coming

Put a block on a store’s product page, cart, home page or order confirmation page, running from your own server.

Coming

This isn’t open yet. It’s planned, and details may change.

Where widgets show

whereThe page
product_pageA product’s page.
cartThe cart.
home_pageThe store’s home page.
order_confirmationThe page a shopper sees after paying.

There’s no mount on the payment step. You list your mounts in the app file.

How a widget loads

We load the page at your mount’s url in a walled-off frame on the store. Your page includes our script and talks to the store through it.

CallWhat it does
QC.widget.ready()Tells the store your widget is ready to show.
QC.widget.context()Returns { store, product, variant, currency: "NGN", theme }. theme is the store’s font and colours.
QC.widget.on("variant:change", fn)Calls fn when the shopper picks another option.
QC.widget.setSelection({ label, data })Saves the shopper’s choice. The label shows in the cart and on the order.
QC.widget.resize(height)Makes the frame fit your content.
A gift message widget
<!-- Your widget's page, at the url in your app file's mounts -->
<script src="https://qcom.ng/sdk/widget/v1.js"></script>
<script>
  const ctx = QC.widget.context();
  // { store, product, variant, currency: "NGN", theme }
  useStoreLook(ctx.theme); // your code: the store's font and colours

  QC.widget.on("variant:change", (variant) => {
    // the shopper picked another size or colour
  });

  document.querySelector("#message").addEventListener("input", (e) => {
    QC.widget.setSelection({
      label: "Gift message: " + e.target.value,
      data: { message: e.target.value },
    });
  });

  QC.widget.resize(document.body.scrollHeight);
  QC.widget.ready();
</script>

Prices

A widget can never set a price from the browser. Anyone can change what a browser sends.

  1. The shopper choosesYour widget saves their choice with setSelection.
  2. Our server asks yoursIf your app file has a price_quote_url, our server posts the choice to it, signed with your app’s secret.
  3. Your server answersIt sends back the amount for that choice.
  4. We charge thatWe use the amount from your server’s answer. Nothing from the browser counts.

This is how our own widgets work today, such as prescription lens pricing.

The rules that matter most

If anything fails, your widget hides itself. It must never stop a shopper buying.
  • Show in under 2 seconds on a 4G phone, with at most 250 KB of script, gzipped.
  • Work from 360px wide, with no sideways scroll.
  • Use the store’s font and colours from theme.
  • The rest is in the build standards.

Something unclear or missing? Email owodunnitech@gmail.com. We usually reply within 48 hours, but it can take up to 7 days.