Search the Community
Showing results for tags 'experimental'.
-
We've implemented a new (experimental) rapid order route which allows one to pass a single product config, with optional provision fields, and then direct the user straight on to the checkout step. This functionality can be especially useful when deep linking a user from an external site, social post or paid advert – and pre-populating a basket for them. This should be considered a power-user feature as it requires some advanced setup and exploration to ensure you are passing the correct configuration in a correctly encoded format. The new rapid order route exists under the path `/order/_` and it supports the following query parameters: product [required]: A product config object which can be used to pre-select a billing term, quantity and any available options and attributes. It can also pass through promotional codes if required. Behind the scenes, we're basically wrapping our 'Add product to order' endpoint, so you can feasibly pass any of the parameters listed here: https://demoapi.upmind.io/doc/#api-Client_Orders-PostOrdersOrder_idProducts. The simplest way to obtain a valid product config (rather than hunting down product IDs etc) is to go through the usual flow of adding an item to your basket and then via your browser's 'Network' tab, copy part of the payload object from the POST request. fields [optional]: An object containing provision field values for the given product (if applicable). Field names should be used as property keys – for example `{ domain_name: "example.com" }`. If the added product does not provision anything, this param must be omitted, otherwise the request will fail. currency [optional]: A supported/enabled ISO 4217 currency code (eg. USD). 🚧 Important: All `object` type parameters MUST first be `JSON.stringify`(ed) and then encoded. To help get this formatting right, you can run the following IIFE code snippet in your browser console. Just substitute `{ ... }` with your actual product and field objects, and it should correctly process and return a query string which can be used with the rapid route. ((params, host = "?") => { for (const key in params) { if (typeof params[key] === "object") params[key] = encodeURI(JSON.stringify(params[key])); } return host + new URLSearchParams(params).toString(); })({ product: { ... }, fields: { ... }, currency: "USD", }); An example link might end up looking like this: https://{ YOUR_UPMIND_INSTANCE }/order/_?product=%257B%2522product_id%2522%3A%252201e96d29-8537-d4e5-025c-54e120637085%2522%2C%2522quantity%2522%3A1%2C%2522billing_cycle_months%2522%3A12%257D&fields=%257B%2522domain_name%2522%3A%2522example.com%2522%257D 🚧 Other things to note: Using this route will always create a NEW basket. It will not add to an existing basket. If ANY error is encountered (incorrect config, malformed query etc) the rapid order attempt will fail silently and the user will be redirected to the main shop step. If things keep failing, and you're not sure why, we suggesting preserving your console and network logs to see what errors are being thrown or coming back from the API.