How to use Order Templates

Order Templates allow you to automatically add an order to a client when they register. This can be used for creating custom registration forms that then add a product. For example

  • Quick order forms with simple client registration
  • Free trial signup

Creating the order Template

When creating an order template you specify an existing order or basket in the system which is used as a template. This can be one you create on a test account. This order can be as complicated as you like, and have multiple products, discount codes etc.

  1. Once that order is placed, go the Settings > Order templates.
  2. Click Create order template
  1. A modal will appear and you can select an Order or Basket to use as the template.
  2. Hit Save and you will be prompted to add more details
  • The template name is a unique name you want to refer to this template by
  • The 'code' is a string which you can use to create this order when creating an account via the api, or in the interface as described below.
  1. Pre-generating of recurring invoices allows you to automatically invoice for a number of cycles. This is useful if you are creating an order with a discount code that applies for a number of months. For example to create an order with a 90-day free trial, you would add a 100% discount for three months, then auto-generate three recurring invoices.

Calling the order template by default

There are two ways to trigger this order template.

First you can call it on the client registration api command. Simply pass order_template_code as a parameter when registering a new client.

$res = $client->request('post', 'https://api.upmind.io/api/clients/register', [
                'form_params' => [
                    'firstname' => $post['name'],
                    'lastname' => $post['lastname'],
                    'email' => $post['email'],
                    'order_template_code' => 'myexampleorder',
                ]
            ]);
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://api.upmind.io/api/clients/register", true);

//Send the proper header information along with the request
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function() { // Call a function when the state changes.
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
        // Request finished. Do processing here.
    }
}
xhr.send("firstname=First&lastname=Last&[email protected]&order_template_code=myexampleorder");

Second, you can have this order placed with every single new client by going to settings > order options.

Field name

Description

Signup order on

This defines when the order is placed in the client account.

Registration - when the client fills out the registration form.
Verification - once they have verified their email.

Sigup order default template ID

If you want to auto-create an order for every new client, the code of that order (e.g. myexampleorder)


Did this page help you?