NAV
Axios Fetch jQuery

INTRODUCTION

About the Theme Engine

The customer portal is powered by a theme engine which allows you to customize the views to your needs. It is composed of a set of endpoints that provide specific functionality. Each endpoint is associated with a required asset that you can customize to your liking. The endpoint also has a set of objects that can be used to customize the user experience.

The Theme Engine will be an update to the Customer Portal which will allow you to completely customize the pages their customers use to manage their subscription beyond simply adding HTML, CSS and JavaScript.

You'll have access to use Jinja code and an array of objects and filters like Shopify and create a truly unique, personal, and branded experience.

A visual overview of the Recharge object hierarchy

Token Security

Recharge supports the usage of a special, expiring token as a way to strengthen a customer's account security.

How does it work?

When a user signs in to manage their account, a token will be generated, assigned to their account, and appened to the URL. This token will be used while they navigate through pages and make requests. If an attempt is made to access an account without either a token or using an unauthorized-token, the request will be denied and a redirect will occur to the login/token request page.

Recharge will handle generating a token, emailing it, and verifying authorized tokens against the customer account. It will even perform redirects if an incorrect token is used.

Request objects

Example querying a customer from a store

(async () => {
  let schema = '{ "customer": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "customer": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "customer": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Example querying payment sources for a customer

(async () => {
  let schema = '{ "payment_sources": [] }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "payment_sources": [] }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "payment_sources": [] }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Example querying all addresses for a customer

(async () => {
  let schema = '{ "addresses": [] }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "addresses": [] }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "addresses": [] }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Example querying specific address

(async () => {
  let schema = '{ "address": { "id": <int:address_id> } }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "address": { "id": <int:address_id> } }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "address": { "id": <int:address_id> } }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Example querying all subscriptions for a customer

(async () => {
  let schema = '{ "subscriptions": [] }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "subscriptions": [] }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "subscriptions": [] }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Example querying specific subscription

(async () => {
  let schema = '{ "subscription": { "id": <int:subscription_id> } }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "subscription": { "id": <int:subscription_id> } }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "subscription": { "id": <int:subscription_id> } }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Example querying all orders for a customer

(async () => {
  let schema = '{ "orders": [] }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "orders": [] }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "orders": [] }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Example querying specific order

(async () => {
  let schema = '{ "order": { "id": <int:order_id> } }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "order": { "id": <int:order_id> } }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "order": { "id": <int:order_id> } }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

Main purpose of Request objects feature is that Theme Editor developers can request API objects through the json. Any structure can be pulled and it will use Recharge API.

Property Schema Definition
Customer { schema: '{ "customer": {} }' } Example of querying a customer.
Payment sources { schema: '{ "payment_sources": [] }' } Example of querying all payment sources for a customer.
Addresses { schema: '{ "addresses": [] }' } Example of querying all addresses for a customer.
Address { schema: '{ "address": { "id": <int:address_id> } }' } Example of querying a specific address by address id for a customer.
Subscriptions { schema: '{ "subscriptions": [] }' } Example of querying all subscriptions for a customer.
Subscription { schema: '{ "subscription": { "id": <int:subscription_id> } }' } Example of querying subscription by subscription id for a customer.
Orders { schema: '{ "orders": [] }' } Example of querying all orders for a customer.
Order { schema: '{ "order": { "id": <int:order_id> } }' } Example of querying order by order id for a customer.

Customer endpoint

Filter Schema
show_customer_url { schema: '{ "customer": {}, "payment_sources": [] }' }
update_customer_url { schema: '{ "customer": {} }' }
update_card_url { schema: '{ "customer": {} }' }
update_customer_card_form { schema: '{ "customer": {} }' }

Delivery schedule endpoints

Filter Schema
delivery_schedule_url { schema: '{ "customer": {}, "delivery_schedule": [] }' }

Addresses endpoints

Filter Schema
list_addresses_url { schema: '{ "customer": {} }, "addresses": [] }' }
create_address_url { schema: '{ "customer": {} }' }
show_address_url { schema: '{ "customer": {}, "address": { "id": <int:address_id> } }' }
update_address_url { schema: '{ "customer": {}, "address": { "id": <int:address_id> } }' }

Subscriptions endpoints

Filter Schema
list_subscriptions_url { schema: '{ "customer": {}, "addresses": [], "subscriptions": [] }' }
create_subscription_url { schema: '{ "customer": {}, "addresses": [] }' }
show_subscription_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }
update_subscription_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }

Subscription action endpoints

Filter Schema
activate_subscription_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }
skip_subscription_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }
unskip_subscription_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }
subscription_charge_date_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }
delay_subscription_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }

Subscription cancel endpoints

Filter Schema
retention_strategy_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> }, "retention_strategies": [] }' }
cancel_subscription_url { schema: '{ "customer": {}, "subscription": { "id": <int:subscription_id> } }' }

Product search endpoints

Filter Schema
product_search_url { schema: '{ "customer": {}, "products": [] }' }

Discount endpoints

Filter Schema
apply_discount_url { schema: '{ "customer": {}, "address": { "id": <int:address_id> } }' }
apply_discount_to_address_url { schema: '{ "customer": {}, "address": { "id": <int:address_id> } }' }
remove_discount_from_address_url { schema: '{ "customer": {}, "address": { "id": <int:address_id> } }' }

Order endpoints

Filter Schema
list_orders_url { schema: '{ "customer": {}, "orders": [] }' }
show_order_url { schema: '{ "customer": {}, "order": { "id": <int:order_id> } }' }

One-time endpoints

Filter Schema
delete_one_time_product_url { schema: '{ "customer": {}, "onetime": { "id": <int:onetime_id> } }' }

CORE RESOURCES

Addresses

EXAMPLE USING PROPERTIES

{{ address.first_name }} {{ address.last_name }} <br>
{{ address.company }} <br>
{{ address.address1 }} {{ address.address2 }} <br>
{{ address.zip }} {{ address.city }} {{ address.province }} <br>
{{ address.country }} <br>
{{ address.phone }}

EXAMPLE OUTPUT

Johnny Charge
Recharge Payments
6024 St. Michaels 204
90105 Los Sngeles California
United States
0123123210

Addresses represent one of the many shipping locations a customer may have. Subscriptions are tied to a given address, and each customer can have multiple address objects (many-to-one) in the relationship.

Getting an address

EXAMPLE INPUT

{% for address in addresses %}
  {{ address.address1 }}
{% endfor %}

{{ subscription.address.first_name }}

EXAMPLE OUTPUT

6048 Manning Avenue
101 Dunlap Crossing Road
14 Main Street #10

Jimmy

You can access all address objects by looping over the addresses parent object, or individually through a associative objects, such as Subscriptions.

Address routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/addresses

This endpoint renders a template with a list of addresses for customer. route details

GET /tools/recurring/portal/<string:customer_hash>/addresses/new

This endpoint renders a template with a form for creating new address for customer. route details

POST /tools/recurring/portal/<string:customer_hash>/addresses

This enpoint creates a new address for customer. route details

GET /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>

This endpoint renders a template with form for updating customer's address. route details

POST /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>

This enpoint updates an existing address for customer. route details

Address object

Object contains the different variables of information you may want to access when rendering an object. Some objects will even contain child properties, such as address.discount.code.

Property Definition
address.address1
string
"address.address1": "101 Washington Street"
The street associated with the address.
address.address2
string
"address.address2": "Suite 101"
Any additional information associated with the address.
address.cart_note
string
"address.cart_note": ""
The note that that will be passed to the “note” field of orders made within the address.
address.city
string
"address.city": "Los Angeles"
The city associated with the address.
address.company
string
"address.company": "Recharge"
The company associated with the address.
address.country
string
"address.country": "United States"
The country associated with the address.
address.created_at
string
"address.created_at": "2018-02-21T11:46:01"
The date and time when the address was created.
address.customer_id
number
"address.customer_id": 8187626
Unique numeric identifier for the customer associated with the address.
address.discount_id
number
"address.discount_id": null
Unique numeric identifier for the discount.
address.discount
object
"applies_to": null,
"applies_to_id": null,
"applies_to_product_type": "SUBSCRIPTION",
"applies_to_resource": null,
"channel_settings": {
"api": {can_apply: true},
"checkout_page": {can_apply: true},
"customer_portal": {can_apply: true},
"merchant_portal": {can_apply: true}
},
"code": "test123",
"created_at": "2019-07-03T10:06:47",
"discount_type": "percentage",
"duration": "single_use",
"duration_usage_limit": null,
"ends_at": null,
"first_time_customer_restriction": null,
"id": 13350570,
"once_per_customer": true,
"prerequisite_subtotal_min": null,
"starts_at": "2019-07-04T00:00:00",
"status": "enabled",
"times_used": 0,
"updated_at": "2019-07-03T10:06:47",
"usage_limit": null,
"value": 10.0
address.first_name
string
"address.first_name": "John"
The customer’s first name associated with the address.
address.id
number
"address.id": 7976732
Unique numeric identifier for the address.
address.include
object
"address.include": {"payment_methods": []}
Includes payment methods.
address.last_name
string
"address.last_name": "Doe"
The customer’s last name associated with the address.
address.note_attributes
string
"address.note_attributes": []
Extra information that is added to the address. Each array entry must contain a hash with “name” and “value” keys.
address.phone
string
"address.phone": "3103103101"
The phone number associated with the address.
address.province
string
"address.province": "California"
The state or province associated with the address.
address.shipping_lines_override
string
"address.shipping_lines_override": null
If shipping rates need to be overridden no matter what settings are in Shopify, then desired shipping rate values needs to be set in this parameter. If this parameter has value null, charge will pull shipping rates from Shopify.
address.updated_at
string
"address.updated_at": "2019-04-22T09:35:39"
The date and time when the address was last updated.
address.zip
string
"address.zip": "90025"
The zip or postal code associated with the address.

[GET] - List of addresses

GET /request_objects

(async () => {
  let schema = '{ "addresses": { "discount": { "id": "parent.discount_id" }}, "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
    try {
      const response = await axios(url);
      // Successful request made
      console.log(response.data);           
    } catch (error) {
      // Request failed
      console.error(error);
    }
})();
let schema = '{ "addresses": { "discount": { "id": "parent.discount_id" }}, "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "addresses": { "discount": { "id": "parent.discount_id" }}, "customer": {}, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "addresses":[
      {  
         "address1":"101 Washington Street",
         "address2":"Suite 101",
         "cart_note":"",
         "city":"Los Angeles",
         "company":"",
         "country":"United States",
         "created_at":"2018-10-09T08:38:33",
         "customer_id":8187626,
         "discount": {
            "applies_to": null, 
            "applies_to_id": null, 
            "applies_to_product_type": "SUBSCRIPTION", 
            "applies_to_resource": null,
            "channel_settings": {
               "api": {
                  "can_apply": true
                  },
               "checkout_page": {
                  "can_apply": true
                  },
               "customer_portal": {
                  "can_apply": true
                  },
               "merchant_portal": {
                  "can_apply": true
                  }
            },
            "code": "test123",
            "created_at": "2019-07-03T10:06:47",
            "discount_type": "percentage",
            "duration": "single_use", 
            "duration_usage_limit": null,
            "ends_at": null,
            "first_time_customer_restriction": null,
            "id": 13350570, 
            "once_per_customer": true,
            "prerequisite_subtotal_min": null,
            "starts_at": "2019-07-04T00:00:00", 
            "status": "enabled", 
            "times_used": 0, 
            "updated_at": "2019-07-03T10:06:47", 
            "usage_limit": null, 
            "value": 10.0 
         },
         "discount_id":13350570,
         "first_name":"John",
         "id":18586680,
         "include": {
            "payment_methods": []
         },
         "last_name":"Doe",
         "note_attributes":[],
         "phone":"5551231234",
         "province":"California",
         "shipping_lines_override":null,
         "updated_at":"2019-03-22T16:23:33",
         "zip":"90025"
      },
      {  
         "address1":"987 Bluebird Street",
         "address2":"APT 9",
         "cart_note":"",
         "city":"Los Angeles",
         "company":"Recharge",
         "country":"United States",
         "created_at":"2018-02-21T11:46:01",
         "customer_id":8187626,
         "discount": {},
         "discount_id":null,
         "first_name":"John",
         "id":7976732,
         "include": {
            "payment_methods": []
         },
         "last_name":"Doe",
         "note_attributes":[],
         "phone":"5551231234",
         "province":"California",
         "shipping_lines_override":null,
         "updated_at":"2019-04-22T09:35:39",
         "zip":"90025"
      }
   ],
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      }, 
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"johndoe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":3,
      "number_subscriptions":14,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-04-30T15:11:43"
   },
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a list of addresses for customer.

URL: {{ address_list_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/addresses?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/addresses?token=${window.customerToken}

Template file: addresses.html

Schema: '{ "addresses": { "discount": { "id": "parent.discount_id" }}, "customer": {}, "settings": {}, "store": {} }'

Available template objects:

[GET] - New address form

GET /request_objects

(async () => {
  let schema = '{ "shipping_countries": [], "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
    try {
      const response = await axios(url);
      // Successful request made
      console.log(response.data);           
    } catch (error) {
      // Request failed
      console.error(error);
    }
})();
let schema = '{ "shipping_countries": [], "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "shipping_countries": [], "customer": {}, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{  
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"johndoe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":3,
      "number_subscriptions":14,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-04-30T15:11:43"
   },
   "shipping_countries":[  
      {  
         "code":"CA",
         "country_id":37,
         "id":null,
         "name":"Canada",
         "provinces":[  
            {  
               "code":"PE",
               "id":1940,
               "name":"Prince Edward Island"
            },
            {  
               "code":"BC",
               "id":1941,
               "name":"British Columbia"
            },
            ...
         ]
      },
      {  
         "code":"SA",
         "country_id":186,
         "id":null,
         "name":"Saudi Arabia",
         "provinces":[  

         ]
      },
      ...
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",            
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a form for creating new address for customer.

URL: {{ address_new_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/addresses/new?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/addresses/new?token=${window.customerToken}

Template file: address_new.html

Schema: '{ "shipping_countries": [], "customer": {}, "settings": {}, "store": {} }'

Available template objects:

[POST] - Create new address

POST /addresses

(async () => {
  let url = '{{ address_list_url }}' + '?token=' + window.customerToken;
  let data = {
    "address1":"101 Washington Street",
    "address2":"Suite 101",
    "city":"Los Angeles",
    "company":"Bootstrap",
    "country":"United States",
    "first_name":"John",
    "last_name":"Doe",
    "phone":"5551231234",
    "province":"California",
    "zip":"90025"
   }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ address_list_url }}';
let data = {
  "address1":"101 Washington Street",
  "address2":"Suite 101",
  "city":"Los Angeles",
  "company":"Bootstrap",
  "country":"United States",
  "first_name":"John",
  "last_name":"Doe",
  "phone":"5551231234",
  "province":"California",
  "zip":"90025"
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ address_list_url }}',
  type: 'post',
  dataType: 'json',
  data: {
    "address1":"101 Washington Street",
    "address2":"Suite 101",
    "city":"Los Angeles",
    "company":"Bootstrap",
    "country":"United States",
    "first_name":"John",
    "last_name":"Doe",
    "phone":"5551231234",
    "province":"California",
    "zip":"90025"
   }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "address":{  
      "address1":"101 Washington Street",
      "address2":"Suite 101",
      "cart_attributes":null,
      "cart_note":null,
      "city":"Los Angeles",
      "company":"Recharge",
      "country":"United States",
      "created_at":"2019-04-30T15:25:20",
      "customer_id":8187626,
      "discount_id":null,
      "first_name":"John",
      "id":32172754,
      "last_name":"Doe",
      "note_attributes":null,
      "original_shipping_lines":null,
      "phone":"5551231234",
      "province":"California",
      "shipping_lines_override":null,
      "updated_at":"2019-04-30T15:25:20",
      "zip":"90025"
   }
}

This enpoint creates a new address for customer.

URL: {{ address_list_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/addresses?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/addresses?token=${window.customerToken}

Template file: addresses_new.html

Available template objects:

Arguments accepted:

Property Type
first_name * string
last_name * string
company string
address1 * string
address2 string
city * string
country * string
province * string
zip * string
phone string

* = required

[GET] - Retrieve an address

GET /request_objects

(async () => {
  let schema = '{ "addresses": { "id": <int:address_id>, "discount": {"id": "parent.discount_id"} }, "shipping_countries": [], "customer": {}, "settings": {}, 
    "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "addresses": { "id": <int:address_id>, "discount": {"id": "parent.discount_id"} }, "shipping_countries": [], "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "addresses": { "id": <int:address_id>, "discount": {"id": "parent.discount_id"} }, "shipping_countries": [], "customer": {}, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "addresses":{  
      "address1":"101 Washington Street",
      "address2":"Suite 101",
      "cart_attributes":null,
      "cart_note":null,
      "city":"Los Angeles",
      "company":"Recharge",
      "country":"United States",
      "created_at":"2019-04-30T15:25:20",
      "customer_id":8187626,
      "discount": {
         "applies_to": null, 
         "applies_to_id": null, 
         "applies_to_product_type": "SUBSCRIPTION", 
         "applies_to_resource": null,
         "channel_settings": {
            "api": {
               "can_apply": true
               },
            "checkout_page": {
               "can_apply": true
               },
            "customer_portal": {
               "can_apply": true
               },
            "merchant_portal": {
               "can_apply": true
               }
         },
         "code": "test123",
         "created_at": "2019-07-03T10:06:47",
         "discount_type": "percentage",
         "duration": "single_use", 
         "duration_usage_limit": null, 
         "ends_at": null,
         "first_time_customer_restriction": null, 
         "id": 13350570, 
         "once_per_customer": true,
         "prerequisite_subtotal_min": null,
         "starts_at": "2019-07-04T00:00:00", 
         "status": "enabled", 
         "times_used": 0, 
         "updated_at": "2019-07-03T10:06:47", 
         "usage_limit": null, 
         "value": 10.0 
      },
      "discount_id":null,
      "first_name":"John",
      "id":32172754,
      "last_name":"Doe",
      "note_attributes":null,
      "original_shipping_lines":null,
      "phone":"5551231234",
      "province":"California",
      "shipping_lines_override":null,
      "updated_at":"2019-04-30T15:25:20",
      "zip":"90025"
   },
   "customer":{  
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"johndoe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":3,
      "number_subscriptions":14,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-04-30T15:11:43"
   },
   "shipping_countries":[  
      {  
         "code":"CA",
         "country_id":37,
         "id":null,
         "name":"Canada",
         "provinces":[  
            {  
               "code":"PE",
               "id":1940,
               "name":"Prince Edward Island"
            },
            {  
               "code":"BC",
               "id":1941,
               "name":"British Columbia"
            },
            ...
         ]
      },
      {  
         "code":"LY",
         "country_id":123,
         "id":null,
         "name":"Libyan Arab Jamahiriya",
         "provinces":[  

         ]
      },
      ...
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}
SHELL CODE HERE

This endpoint renders a template with form for updating customer's address.

URL: {{ address_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/addresses/<int:address_id>?token=${window.customerToken}

Template file: address.html

Available template objects:

[POST] - Update an address

POST /addresses/<int:address_id>

(async () => {
  let url = '{{ address_url }}' + '?token=' + window.customerToken;
  let data = {
    "address1":"101 Washington Street",
    "address2":"204",
    "cart_note":null,
    "city":"Los Angeles",
    "company":"Recharge",
    "country":"United States",
    "first_name":"John",
    "last_name":"Doe",
    "phone":"5551231234",
    "province":"California",
    "zip":"90025"
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ address_url }}';
let data = {
  "address1":"101 Washington Street",
  "address2":"204",
  "cart_note":null,
  "city":"Los Angeles",
  "company":"Recharge",
  "country":"United States",
  "first_name":"John",
  "last_name":"Doe",
  "phone":"5551231234",
  "province":"California",
  "zip":"90025"
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ address_url }}',
  type: 'post',
  dataType: 'json',
  data: {
    "address1":"101 Washington Street",
    "address2":"204",
    "cart_note":null,
    "city":"Los Angeles",
    "company":"Recharge",
    "country":"United States",
    "first_name":"John",
    "last_name":"Doe",
    "phone":"5551231234",
    "province":"California",
    "zip":"90025"
   }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "address":{  
      "address1":"101 Washington Street",
      "address2":"204",
      "cart_attributes":null,
      "cart_note":"Updated phone",
      "city":"Los Angeles",
      "company":"Recharge",
      "country":"United States",
      "created_at":"2019-04-30T15:25:20",
      "customer_id":8187626,
      "discount_id":null,
      "first_name":"John",
      "id":32172754,
      "last_name":"Doe",
      "note_attributes":null,
      "original_shipping_lines":null,
      "phone":"5551231234",
      "province":"California",
      "shipping_lines_override":null,
      "updated_at":"2019-05-02T14:07:16",
      "zip":"90025"
   }
}

This enpoint updates an existing address for customer.

URL: {{ address_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/addresses/<int:address_id>?token=${window.customerToken}

Template file: address.html

Available template objects:

Arguments accepted:

Property Type
address1 * string
address2 string
cart note string
city * string
company string
country * string
first_name * string
last_name * string
phone string
province * string
zip * string

* = required

Shipping Country object

Object contains the different variables of information you may want to access when rendering an object.

Property Definition
shipping_country.code
string
"shipping_country.code": "AU"
The code of the shipping country.
shipping_country.country_id
number
"shipping_country.country_id": 12
Id of the shipping country.
shipping_country.id
string
"shipping_country.id": "null"
Id of the shipping country.
shipping_country.name
string
"shipping_country.name": "Australia"
Name of the shipping country.
shipping_country.provinces
array of objects
"shipping_country.provinces": [
"code": "ACT",
"id": 2289,
"name": "Australian Capital Territory"
]

Country provinces.

Charge

A charge is a placeholder for an upcoming charge once the charge is processed successfully. The corresponding order or orders in the case of prepaid will be created and the 1st order will be submitted to shopify.

Charge routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/request_objects
This endpoint retrieves a list of charges for customer.

POST /tools/recurring/portal/<string:customer_hash>/charges/<int:charge_id>/process
This enpoint updates/processes an existing charge for customer.

Charge object


Property Definition
charge.address_id
number
"charge.address_id": 32172754
The id of the customer shipping address that this order is tied to.
charge.utm_params
array
"charge.utm_params": []
charge.billing_address "address1": "101 Washington Street"
"address2": "204"
"city": "Los Angeles"
"company": "Recharge"
"country": "United States"
"first_name": "John"
"last_name": "Doe"
"phone": 5551231234
"province": "California"
"zip": 90025

This is all of the billing information related to the order:
  • [string] address1: The street address of the billing address.
  • [string] address2: An optional additional field for the street address of the billing address.
  • [string] city: The city of the billing address.
  • [string] company: The company of the person associated with the billing address.
  • [string] country: The name of the country of the billing address.
  • [string] first_name: The first name of the person associated with the payment method.
  • [string] last_name: The last name of the person associated with the payment method.
  • [string] phone: The phone number associated with the billing address.
  • [string] province: The name of the state or province of the billing address.
  • [string] zip:The zip or postal code of the billing address.
charge.client_details "browser_ip": null
"user_agent": null
The client details, this attribute can be used to see from which device subscription is created.
charge.created_at
string
"charge.created_at": "2019-05-06T15:08:49"
The date and time when the charge was created.
charge.customer_hash
string
"charge.customer_hash": "818762670d14f56b6f39fd7"
The unique string identifier used in a customers portal link.
charge.customer_id
number
"charge.customer_id": 8187626
Shopify's unique identifier for the customer.
charge.discount_codes
string
"charge.discount_codes": []
The discount codes from store settings.
charge.email
string
"charge.email": "John@test.com"
The email address of the customer.
charge.error
string
"charge.error": "no Variant found on shopify"
Error message of the charge.
charge.error_type
string
"charge.error_type": "VARIANT_DOES_NOT_EXIST"
Error type of charge.
charge.first_name
string
"charge.first_name": "John"
The first name of the customer.
charge.has_uncommited_changes
boolean
"charge.has_uncommited_changes": false
Specifies whether the charge is scheduled for a regeneration (if the subscription related to the charge was updated in the last 5-30s with “commit_update”:false)
charge.id
number
"charge.id": 158825571
The unique numeric identifier for the charge.
charge.last_charge_attempt_date
string
"charge.last_charge_attempt_date": "2020-03-02T15:29:56"
Date of the last cherge attempt for charge with stauts: "ERROR".
charge.last_name
string
"charge.last_name": "Doe"
The last name of the customer.
charge.line_items
array
"grams": 1814
"images": {}
"price": "70.00"
"properties": []
"quantity": 1
"shopify_product_id": "506020921408"
"shopify_variant_id": "5424189177920"
"sku": ""
"subscription_id": 42603951
"tax_lines": []
"title": "Bare Box - 3 Month Plan"
"variant_title": "x-small"

A list of line item objects, each one containing information about an item in the charge:
  • [number] grams: The grams of the product.
  • [object] images: The images of the product.
  • [string] price: The price of the product.
  • [array] properties: The properties of the product.
  • [number] quantity: The quantity of the product.
  • [string] shopify_product_id: The id of the Shopify product.
  • [number] shopify_variant_id: The id of the Shopify product variant.
  • [string] sku: The sku of the Shopify product.
  • [array] tax_lines: Tax lines array
  • [number] subscription_id: The unique numeric identifier for a subscription.
  • [string] title: The title of the product.
  • [string] variant_title: The title of the product variant.
charge.note
string
"charge.note": "Updated phone"
Note attribute used to store custom notes.
charge.note_attributes
array
"charge.note_attributes": null
Custom key value pairs can be stored here.
charge.number_times_tried
number
"charge.number_times_tried": 6
Number of times charge processing was attempted.
charge.processed_at
string
"charge.processed_at": "2020-03-08T00:00:00"
The date and time when the charge is processed.
charge.processor_name
string
"charge.processor_name": "stripe"
It identifies payment processor. It could have stripe, braintree or authorize value.
charge.retry_date
string
"charge.retry_date": "2020-03-08T00:00:00"
Next charge attempt date for charge with status "ERROR".
charge.scheduled_at
string
"charge.scheduled_at": "2019-07-07T00:00:00"
The date and time when the charge is scheduled.
charge.shipments_count
number
"charge.shipments_count": 10
A number of successfully sent orders for the specific charge.
charge.shipping_address "address1": "101 Washington Street"
"address2": "204"
"city": "Los Angeles"
"company": "Recharge"
"country": "United States"
"first_name": "John"
"last_name": "Doe"
"phone": 5551231234
"province": "California"
"zip": 90025

The mailing address where the order will be shipped to:
  • [string] address1: The street address of the shipping address.
  • [string] address2: An optional additional field for the street address of the shipping address.
  • [string] city: The city of the shipping address.
  • [string] company: The company of the person associated with the shipping address.
  • [string] country: The name of the country of the shipping address.
  • [string] first_name: The first name of the person associated with the shipping address.
  • [string] last_name: The last name of the person associated with the shipping address.
  • [string] phone: The phone number associated with the shipping address.
  • [string] province: The name of the state or province of the shipping address.
  • [number] zip: The zip or postal code of the shipping address.
charge.shipping_lines
array
"code": "Priority"
"price": "7.81"
"tax_lines": "[]"
"title": "Priority Mail"

The shipping lines:
  • [string] code: The code of shipping lines.
  • [string] price: The price of shipping lines.
  • [array] tax_lines: Tax lines array.
  • [string] title: The title of shipping lines.
charge.shopify_order_id
string
"charge.shopify_order_id": null
The unique numeric identifier within Shopify for the charge.
charge.shopify_variant_id_not_found
"charge.shopify_variant_id_not_found": null
charge.status
string
"charge.status": "SUCCESS", "QUEUED", "ERROR", "SKIPPED"
The status of creating the charge within Shopify.
charge.subtotal_price
string
"charge.subtotal_price": "70.0"
The item price without taxes and discounts.
charge.tags
string
"charge.tags": "Subscription, Subscription Recurring Order"
The custom tags for the charge.
charge.tax_lines
number
"charge.tax_lines": 0
The tax lines for the charge.
charge.total_discounts
string
"charge.total_discounts": "0.0"
The sum of the discounts applied to the product.
charge.total_line_items_price
string
"charge.total_line_items_price": "70.00"
The total price of line items.
charge.total_price
string
"charge.total_price": "77.81"
The sum of all the prices of all the items in the charge, taxes and discounts included (must be positive).
charge.total_refunds
string
"charge.total_refunds": null
The sum of all refunds that were made on specific charge.
charge.total_tax
number
"charge.total_tax": 0
The total tax of an order.
charge.total_weight
number
"charge.total_weight": 1814
Total weight of the product.
charge.transaction_id
string
"charge.transaction_id": null
The unique alphanumeric identifier of the transaction.
charge.type
string
"charge.type": "RECURRING"
Shows if order was made from checkout or a recurring charge. Inputs: “CHECKOUT” or “RECURRING”.
charge.updated_at
string
"charge.updated_at": "2019-05-14T12:32:24"
The date and time when the charge was updated.

[GET] - List of charges

GET /request_objects

(async () => {
  let schema = '{ "charges": [] }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "charges": [] }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}`,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "charges": [] }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE


{
"charges":

    [
        "address_id": 18586680,
        "analytics_data": {
            "utm_params": []
        },
        "billing_address": {
            "address1":"101 Washington Street",
            "address2":"204",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name": "John"
            "last_name": "Doe"
            "phone": "122211121212"
            "province": ""
            "zip": "11070"
        },
        "client_details": {
            "browser_ip": null,
            "user_agent": null,
        },
        "created_at": "2020-02-05T08:45:41",
        "customer_hash": "818762670d14f56b6f39fd7",
        "customer_id": 8187626,
        "discount_codes": [],
        "email": "john.doe@test.com",
        "first_name": "John",
        "has_uncommited_changes": false,
        "id": 32172457,
        "last_name": "Doe",
        "line_items": [
            {
            "images": {
                "large": "",
                "medium": "",
                "original": "",
                "small": "",
                },
            "price": "100.00",
            "properties": [],
            "quantity": 3,
            "shopify_product_id": "4441899073674",
            "shopify_variant_id": "31666207588490",
            "sku": "",
            "subscription_id": 6187834,
            "tax_lines": [],
            "title": "Optimum Nutrition Gold Standard Whey Auto renew",
            "type": "SUBSCRIPTION",
            "variant_title": "",
            "vendor""recharge-test-store"
            }
        ],
        "note": "next order in sequence 1",
        "note_attributes": [],
        "processed_at": "2020-02-05T08:55:39",
        "processor_name": "stripe",
        "scheduled_at": "2020-02-05T00:00:00",
        "shipments_count": 1,
        "shipping_address": {
            "address1": "Bulevar Mihajla Pupina 10",
            "address2": "",
            "city": "Belgrade",
            "company": "BG",
            "country": "Serbia",
            "first_name": "Uros",
            "last_name": "Bijelic",
            "phone": "122211121212",
            "province": "",
            "zip": "11070",
        },
        "shipping_lines": {
            "code": "Standard",
            "price": "0.00",
            "title": "Standard",
        },
        "shopify_order_id": "197852934323",
        "status": "SUCCESS",
        "subtotal_price": "300.0",
        "tags": "Subscription, Subscription Recurring Order",
        "tax_lines": 0,
        "total_discounts": "0.0",
        "total_line_items_price": "300.00",
        "total_price": "300.00",
        "total_refunds": null,
        "total_tax": 0,
        "total_weight": 2724,
        "transaction_id": "ch_1G8oLuJ2zqasdfd1owLGogae",
        "type": "RECURRING",
        "updated_at": "2020-02-05T09:55:41",
    ],
    [
        "address_id": 18586680,
        "analytics_data": "{utm_params: []}",
        "billing_address": {
            "address1":"101 Washington Street",
            "address2":"204",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name": "John"
            "last_name": "Doe"
            "phone": "122211121212"
            "province": ""
            "zip": "11070"
        },
        "client_details": {
            "browser_ip": null,
            "user_agent": null,
        },
        "created_at": "2020-02-05T08:45:41",
        "customer_hash": "818762670d14f56b6f39fd7",
        "customer_id": 8187626,
        "discount_codes": [],
        "email": "john.doe@test.com",
        "first_name": "John",
        "has_uncommited_changes": false,
        "id": 32172457,
        "last_name": "Doe",
        "line_items": [
            {
            "images": {
                "large": "",
                "medium": "",
                "original": "",
                "small": "",
                },
            "price": "100.00",
            "properties": [],
            "quantity": 3,
            "shopify_product_id": "4441899073674",
            "shopify_variant_id": "31666207588490",
            "sku": "",
            "subscription_id": 6187834,
            "tax_lines": [],
            "title": "Optimum Nutrition Gold Standard Whey Auto renew",
            "type": "SUBSCRIPTION",
            "variant_title": "",
            "vendor""recharge-test-store"   
            }
        ],
        "note": "next order in sequence 1",
        "note_attributes": [],
        "processor_name": "stripe",
        "scheduled_at": "2020-02-05T00:00:00",
        "shipments_count": null,
        "shipping_address": {
            "address1": "Bulevar Mihajla Pupina 10",
            "address2": "",
            "city": "Belgrade",
            "company": "BG",
            "country": "Serbia",
            "first_name": "Uros",
            "last_name": "Bijelic",
            "phone": "122211121212",
            "province": "",
            "zip": "11070",
        },
        "shipping_lines": {
            "code": "Standard",
            "price": "0.00",
            "title": "Standard",
        },
        "shopify_order_id": "null",
        "status": "QUEUED",
        "subtotal_price": "300.0",
        "tags": "Subscription, Subscription Recurring Order",
        "tax_lines": 0,
        "total_discounts": "0.0",
        "total_line_items_price": "300.00",
        "total_price": "300.00",
        "total_refunds": null,
        "total_tax": 0,
        "total_weight": 2724,
        "transaction_id": null,
        "type": "RECURRING",
        "updated_at": "2020-02-05T09:55:41"

    ],
    [
        "address_id": 18586680,
        "analytics_data": {utm_params: []},
        "billing_address": {
            "address1":"101 Washington Street",
            "address2":"204",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name": "John"
            "last_name": "Doe"
            "phone": "122211121212"
            "province": ""
            "zip": "11070"
        },
        "client_details": {
            "browser_ip": null,
            "user_agent": null,
        },
        "created_at": "2020-02-05T08:45:41",
        "customer_hash": "818762670d14f56b6f39fd7",
        "customer_id": 8187626,
        "discount_codes": [],
        "email": "john.doe@test.com",
        "error": "Request req_VwzvfensElCeD: Your card was declined. decline_code = generic_decline",
        "error_type": "CLOSED_MAX_RETRIES_REACHED",
        "first_name": "John",
        "has_uncommited_changes": false,
        "id": 32172457,
        "last_charge_attempt_date": "2020-03-02T15:29:59",
        "last_name": "Doe",
        "line_items": [
            {
            "images": {
                "large": "",
                "medium": "",
                "original": "",
                "small": "",
                },
            "price": "100.00",
            "properties": [],
            "quantity": 3,
            "shopify_product_id": "4441899073674",
            "shopify_variant_id": "31666207588490",
            "sku": "",
            "subscription_id": 6187834,
            "tax_lines": [],
            "title": "Optimum Nutrition Gold Standard Whey Auto renew",
            "type": "SUBSCRIPTION",
            "variant_title": "",
            "vendor""recharge-test-store"
            }
        ],
        "note": "next order in sequence 1",
        "note_attributes": [],
        "number_times_tried": 6,
        "processor_name": "stripe",
        "retry_date": "2020-03-08T00:00:00",
        "scheduled_at": "2020-02-06T00:00:00",
        "shipments_count": null,
        "shipping_address": {
            "address1": "Bulevar Mihajla Pupina 10",
            "address2": "",
            "city": "Belgrade",
            "company": "BG",
            "country": "Serbia",
            "first_name": "Uros",
            "last_name": "Bijelic",
            "phone": "122211121212",
            "province": "",
            "zip": "11070",
        },
        "shipping_lines": {
            "code": "Standard",
            "price": "0.00",
            "tax_lines": [],
            "title": "Standard",
        },
        "shopify_order_id": null,
        "shopify_variant_id_not_found": null,
        "status": "ERROR",
        "subtotal_price": "300.0",
        "tags": "Subscription, Subscription Recurring Order",
        "tax_lines": 0,
        "total_discounts": "0.0",
        "total_line_items_price": "300.00",
        "total_price": "300.00",
        "total_refunds": null,
        "total_tax": 0,
        "total_weight": 2724,
        "transaction_id": null,
        "type": "RECURRING",
        "updated_at": "2020-02-05T09:55:41",
    ]

}

List all charges for the current customer.

Methods accepted: GET

Schema: '{ "charges": [] }'

Embedded Route: /tools/recurring/portal/<string:customer_hash>/request_objects?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/request_objects?token=${window.customerToken}

[POST] - Process a charge

POST /charges/<int:charge_id>

(async () => {
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/<int:charge_id>/process?token=${window.customerToken}`;

  try {
    const response = await axios.post(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/<int:charge_id>/process?token=${window.customerToken}`;
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  }
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/<int:charge_id>/process?token=${window.customerToken}`,
  type: 'post',
  }).done(function(response) {
    // Successful request made
    console.log(response);
  }).fail(function(response) {
    // Request failed
    console.log(response);
  });

CLICK HERE TO SEE RESPONSE


{
"charges":

    [
        "address_id": 18586680,
        "analytics_data": {
            "utm_params": []
        },
        "billing_address": {
            "address1":"101 Washington Street",
            "address2":"204",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name": "John"
            "last_name": "Doe"
            "phone": "122211121212"
            "province": ""
            "zip": "11070"
        },
        "client_details": {
            "browser_ip": null,
            "user_agent": null,
        },
        "created_at": "2020-02-05T08:45:41",
        "customer_hash": "818762670d14f56b6f39fd7",
        "customer_id": 8187626,
        "discount_codes": [],
        "email": "john.doe@test.com",
        "first_name": "John",
        "has_uncommited_changes": false,
        "id": 32172457,
        "last_name": "Doe",
        "line_items": [
            {
            "images": {
                "large": "",
                "medium": "",
                "original": "",
                "small": "",
                },
            "price": "100.00",
            "properties": [],
            "quantity": 3,
            "shopify_product_id": "4441899073674",
            "shopify_variant_id": "31666207588490",
            "sku": "",
            "subscription_id": 6187834,
            "tax_lines": [],
            "title": "Optimum Nutrition Gold Standard Whey Auto renew",
            "type": "SUBSCRIPTION",
            "variant_title": "",
            "vendor""recharge-test-store"
            }
        ],
        "note": "next order in sequence 1",
        "note_attributes": [],
        "processed_at": "2020-02-05T08:55:39",
        "processor_name": "stripe",
        "scheduled_at": "2020-02-05T00:00:00",
        "shipments_count": 1,
        "shipping_address": {
            "address1": "Bulevar Mihajla Pupina 10",
            "address2": "",
            "city": "Belgrade",
            "company": "BG",
            "country": "Serbia",
            "first_name": "Uros",
            "last_name": "Bijelic",
            "phone": "122211121212",
            "province": "",
            "zip": "11070",
        },
        "shipping_lines": {
            "code": "Standard",
            "price": "0.00",
            "title": "Standard",
        },
        "shopify_order_id": "197852934323",
        "status": "SUCCESS",
        "sub_total": null, 
        "subtotal_price": "300.0",
        "tags": "Subscription, Subscription Recurring Order",
        "tax_lines": 0,
        "total_discounts": "0.0",
        "total_line_items_price": "300.00",
        "total_price": "300.00",
        "total_refunds": null,
        "total_tax": 0,
        "total_weight": 2724,
        "transaction_id": "ch_1G8oLuJ2zqasdfd1owLGogae",
        "type": "RECURRING",
        "updated_at": "2020-02-05T09:55:41",
    ],
}

The charge processing route can be used to process charges that are in queued status. Processing a queued charge can be accomplished by a POST request to the charge processing endpoint with the respective charge_id.

Methods accepted: POST

Embedded Route: /tools/recurring/portal/{{ customer.hash }}/charges/<int:charge_id>/process?token=${window.customerToken}

Hosted Route: /portal/{{ customer.hash }}/charges/<int:charge_id>/process?token=${window.customerToken}

Customer

EXAMPLE USING PROPERTIES

{{ customer.first_name }} {{ customer.last_name }}<br>
{{ customer.email }}

EXAMPLE OUTPUT

John Doe
john.doe@test.com

Customer represents a customer account with a shop.

Customer routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/customer

This endpoint renders a template with form that contains current customer information. route details

POST /tools/recurring/portal/<string:customer_hash>/customer

This enpoint updates customers information. route details

Customer object

Property Definition
customer.accepts_marketing
boolean
"customer.accepts_marketing": "null"
Does the buyer accept marketing, newsletters etc.
customer.analytics_data
object
"customer.analytics_data": {"utm_params": []}
utm_params will be added to subscription, customer and charge objects after successful processing of the checkout. (utm_params optional)
customer.can_add_payment_method
boolean
"customer.can_add_payment_method": false
Add a payment method.
customer.created_at
string
"customer.created_at": "2018-02-21T11:45:58"
The date and time when the customer was created.
customer.email
string
"customer.email": "john.doe@test.com"
The email address of the customer.
customer.first_charge_processed_at
string
"customer.first_charge_processed_at": "2018-02-21T11:46:02"
Date when first charge is processed for customer.
customer.first_name
string
"customer.first_name": "John"
The customer's first name.
customer.has_card_error_in_dunning
boolean
"customer.has_card_error_in_dunning": false
Does have credit card in dunning, can be true and false.
customer.hash
string
"customer.hash": "818762670d14f56b6f39fd7"
The unique string identifier used in a customers portal link.
customer.id
number
"customer.id": 8187626
Unique numeric identifier for the customer.
customer.include
object
"customer.include": {"payment_methods": []}
Includes payment methods for the customer.
customer.last_name
string
"customer.last_name": "Doe"
The customer's last name.
customer.number_active_subscriptions
number
"customer.number_active_subscriptions": 8
Numer of active subscriptions for customer.
customer.number_subscriptions
number
"customer.number_subscriptions": 19
Numer of subscriptions for customer.
customer.shopify_customer_id
string
"customer.shopify_customer_id": "391100760128"
Shopify’s unique identifier for the customer.
customer.updated_at
string
"customer.updated_at": "2019-05-13T14:19:01"
The date and time when the customer was last updated.

[GET] - Retrieve customer

GET /request_objects

(async () => {
  let schema = '{ "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}`,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "customer": {}, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },   
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"johndoe@gmail.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-13T14:19:01"
   },
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with form that contains current customer information.

URL: {{ customer_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/customer?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/customer?token=${window.customerToken}

Template file: customer.html

Schema: '{ "customer": {}, "settings": {}, "store": {} }'

Available objects

[POST] - Update customer

POST /customer

(async () => {
  let url = '{{ customer_url }}' + '?token=' + window.customerToken;
  let data = {
    "first_name":"John",
    "last_name":"Doe",
    "email":"john.Doe@gmail.com"
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();

let url = '{{ customer_url }}';
let data = {
  "first_name":"John",
  "last_name":"Doe",
  "email":"john.Doe@gmail.com"
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ customer_url }}',
  type: 'post',
  dataType: 'json',
  data: {
    "first_name":"John",
    "last_name":"Doe",
    "email":"john.Doe@gmail.com"
  }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      }, 
      "billing_address1":"101 Washington Street",
      "billing_address2":"",
      "billing_city":"Los Angeles",
      "billing_company":"Recharge",
      "billing_country":"United States",
      "billing_phone":"5623095450",
      "billing_province":"California",
      "billing_zip":"90024",
      "created_at":"2018-02-21T11:45:58",
      "email":"John@rechargeapps.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "has_valid_payment_method":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "processor_type":null,
      "reason_payment_method_not_valid":"NO_PAYMENT_METHOD",
      "shopify_customer_id":"391100760128",
      "status":"ACTIVE",
      "updated_at":"2019-05-13T14:19:01"
   }
}

This enpoint updates customer's first name, last name and email address.

URL: {{ customer_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/customer?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/customer?token=${window.customerToken}

Template file: customer.html

Available objects

Arguments accepted:

Property Type
First Name sting
Last name string
Email string

Discounts

EXAMPLE USING PROPERTIES

{% if address.discount_id %}
  <p>
    Applied discount: {{ address.discount.code }}<br>
    <a href="#" onclick="ReCharge.Discount.remove({{ address.id }}, {{ address.discount_id }});" class="btn">Remove discount</a>
  </p>
{% else %}
  <p>
    <a href="#" onclick="ReCharge.Helpers.toggle('ReChargeForm_applyDiscount_{{ address.id }}'); return false;" class="btn">Add discount</a>
  </p>
  <form method="post" action="{{ address.id | discount_apply_url }}" id="ReChargeForm_applyDiscount_{{ address.id }}" style="display: none;">
    <input type="hidden" name="redirect_url" value="{{ subscription_list_url }}">
    <fieldset>
      <label for="discount_code">Discount code</label>
      <input type="text" name="discount_code" id="discount_code" placeholder="Enter discount code">
      <button type="submit" class="btn"><span>Apply</span></button>
    </fieldset>
  </form>
{% endif %}

EXAMPLE OUTPUT

Applied discount: 20 % to all product
Remove discount

Discount represents a discount object on a shop. Discount are being applied to an address.

Discount routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


POST /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/apply_discount

This endpoint applies discount to current address. route details

POST /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/remove_discount

This endpoint removes discount applied to current address. route details

Discount object

Discounts are a child object, a property associated with an Address. Discounts are available by default in subscriptions.html template.

[POST] - Apply discount

POST /addresses/<int:address_id>/apply_discount

(async () => {
  let url = '{{ discount_apply_url }}' + '?token=' + window.customerToken;
  let data = {
    "discount_code":"20 % to all product"
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ discount_apply_url }}';
let data = {
  "discount_code":"20 % to all product"
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ discount_apply_url }}',
  type: 'post',
  dataType: 'json',
  data: {
  "discount_code":"20 % to all product"
}
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "address":{  
      "address1":"101 Washington Street",
      "address2":"Suite 404",
      "cart_attributes":[  

      ],
      "cart_note":"",
      "city":"Los Angeles",
      "company":"Recharge",
      "country":"United States",
      "created_at":"2018-02-21T11:46:01",
      "customer_id":8187626,
      "discount_id":10986334,
      "first_name":"John",
      "id":7976732,
      "last_name":"Doe",
      "note_attributes":[  

      ],
      "original_shipping_lines":[  
         {  
            "code":"Priority",
            "price":"7.80",
            "title":"Priority Mail"
         }
      ],
      "phone":"3103103101",
      "province":"California",
      "shipping_lines_override":null,
      "updated_at":"2019-05-16T09:32:16",
      "zip":"90025"
   }
}

This endpoint applies discount to the current address that is related to an active subscription.

URL: {{ discount_apply_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/apply_discount?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/addresses/<int:address_id>/apply_discount?token=${window.customerToken}

Template file: subscriptions.html

Available objects:

Arguments accepted:

Input Type
Discount Code * string

* = required

[POST] - Remove discount

POST /addresses/<int:address_id>/remove_discount

(async () => {
  let url = '{{ discount_remove_url }}' + '?token=' + window.customerToken;

  try {
    const response = await axios.post(url);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ discount_remove_url }}';
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  }
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ discount_remove_url }}',
  type: 'post',
  dataType: 'json'
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "address":{  
      "address1":"101 Washington Street",
      "address2":"Suite 204",
      "cart_attributes":[  

      ],
      "cart_note":"",
      "city":"Los Angeles",
      "company":"Recharge",
      "country":"United States",
      "created_at":"2018-02-21T11:46:01",
      "customer_id":8187626,
      "discount_id":31231231,
      "first_name":"John",
      "id":7976732,
      "last_name":"Doe",
      "note_attributes":[  

      ],
      "original_shipping_lines":[  
         {  
            "code":"Priority",
            "price":"7.80",
            "title":"Priority Mail"
         }
      ],
      "phone":"5553103101",
      "province":"California",
      "shipping_lines_override":null,
      "updated_at":"2019-05-16T09:35:06",
      "zip":"90025"
   }
}

This endpoint removes discount applied to the current address that is related to an active subscription.

URL: {{ discount_remove_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/remove_discount?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/addresses/<int:address_id>/remove_discount?token=${window.customerToken}

Template file: subscriptions.html

Available objects:

[GET] - List of discounts

GET /request_objects

(async () => {
  let schema = '{ "discounts": [], "customer": {} , "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "discounts": [], "customer": {} , "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });

$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash}}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
}).done(function(response) {
  data: { schema: '{ "discounts": [], "customer": {} , "settings": {}, "store": {} }' }
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

  {
    "discounts": [
      {
        "applies_to": null,
        "applies_to_id": null,
        "applies_to_product_type": "ALL",
        "applies_to_resource": null,
        "channel_settings": {
          "api": {"can_apply": true},
          "checkout_page": {"can_apply": true},
          "customer_portal": {"can_apply": true},
          "merchant_portal": {"can_apply": true},
        },
        "code": "TIMESUSED",
        "created_at": "2020-05-27T08:32:43",
        "discount_type": "percentage",
        "duration": "forever",
        "duration_usage_limit": null,
        "ends_at": null,
        "external_discount_id": null,
        "external_discount_source": null,
        "first_time_customer_restriction": null,
        "id": 281878231,
        "once_per_customer": false,
        "prerequisite_subtotal_min": null,
        "starts_at": "2020-05-26T00:00:00",
        "status": "enabled",
        "times_used": 0,
        "updated_at": "2020-05-27T08:32:43",
        "usage_limit": null,
        "value": 10
      },
      {
        "applies_to: null",
        "applies_to_id: null",
        "applies_to_product_type": "SUBSCRIPTION",
        "applies_to_resource": null,
        "channel_settings": {
          "api": {"can_apply": true},
          "checkout_page": {"can_apply": true},
          "customer_portal": {"can_apply": true},
          "merchant_portal": {"can_apply": true},
        },
        "code": "10% off",
        "created_at": "2020-01-09T13:02:29",
        "discount_type": "percentage",
        "duration": "single_use",
        "duration_usage_limit": null,
        "ends_at": null,
        "first_time_customer_restriction": null,
        "id": 22116424123,
        "once_per_customer": true,
        "prerequisite_subtotal_min": null,
        "starts_at": "2020-01-08T00:00:00",
        "status": "disabled",
        "times_used": 0,
        "updated_at": "2020-01-09T14:02:29"
        "usage_limit": null,
        "value": 10,
      },
      {
        "applies_to: null",
        "applies_to_id: null",
        "applies_to_product_type": "ALL",
        "applies_to_resource": null,
        "channel_settings": {
          "api": {"can_apply": true},
          "checkout_page": {"can_apply": true},
          "customer_portal": {"can_apply": true},
          "merchant_portal": {"can_apply": true},
        },
        "code": "checkout",
        "created_at": "2020-04-15T09:45:13",
        "discount_type": "fixed_amount",
        "duration": "single_use",
        "duration_usage_limit": null,
        "ends_at": null,
        "first_time_customer_restriction": null,
        "id": 3212527315,
        "once_per_customer": false,
        "prerequisite_subtotal_min": null,
        "starts_at": "2020-04-14T00:00:00",
        "status": "enabled",
        "times_used": 0,
        "updated_at": "2020-04-15T09:45:13",
        "usage_limit": null,
        "value": 5,
      },
      {
        "applies_to": "shopify_product"
        "applies_to_id": 47751111222312,
        "applies_to_product_type": "ALL",
        "applies_to_resource": "shopify_product",
        "channel_settings": {
          "api": {"can_apply": true},
          "checkout_page": {"can_apply": true},
          "customer_portal": {"can_apply": true},
          "merchant_portal": {"can_apply": true},
        },
        "code": "testing",
        "created_at": "2020-05-20T10:51:15",
        "discount_type": "percentage",
        "duration": "forever",
        "duration_usage_limit": null,
        "ends_at": null,
        "external_discount_id": null,
        "external_discount_source": null,
        "first_time_customer_restriction": null,
        "id": 28019689,
        "once_per_customer": false,
        "prerequisite_subtotal_min": null,
        "starts_at": "2020-05-19T00:00:00",
        "status": "enabled",
        "times_used": 0,
        "updated_at": "2020-05-20T10:51:15",
        "usage_limit": null,
        "value": 10,
      }
    ]
  },
  "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },   
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"johndoe@gmail.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-13T14:19:01"
  },
  "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }

List all discounts for the current customer.

Methods accepted: GET

Schema: '{ "discounts": [], "customer": {} , "settings": {}, "store": {} }'

One time products

EXAMPLE USING PROPERTIES

{% if onetime.next_charge_scheduled_at %}
    {{ onetime.next_charge_scheduled_at | date('%m/%d/%Y') }}
    <a href="#" onclick="ReCharge.Helpers.toggle('ReChargeForm_date'); return false;">Edit</a>
{% else %}
    Error
{% endif %}

EXAMPLE OUTPUT

12/12/2019 Edit

One time products routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


POST /tools/recurring/portal/<string:customer_hash>/onetimes

This endpoint creates a new one time product for customer. route details

GET /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>

This endpoint renders a template with form for updating onetime product object. route details

POST /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>

This enpoint updates current onetime product for the customer. route details

POST /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>/set_next_charge_date

This endpoint renders a template with form for upating next charge date of current onetime product. route details

POST /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>/cancel

This endpoint cancels onetime product. route details

One time product object

Property Definition
onetime.address_id
number
"onetime.address_id": 32172754
Unique numeric identifier for the address the One Time Product is associated with.
onetime.created_at
string
"onetime.created_at": "2019-05-24T13:17:45"
The time One Time Product was first created.
onetime.customer_id
number
"onetime.customer_id": 8187626
Unique numeric identifier for the customer the One Time Product is tied to.
onetime.id
number
"onetime.id": 43482259
One Time id.
onetime.next_charge_scheduled_at
string
"onetime.next_charge_scheduled_at": "2019-08-08T00:00:00"
Date of the One Time Product execution.
onetime.price
number
"onetime.price": 120
The price of the item before discounts, taxes, or shipping have been applied.
onetime.product_title
string
"onetime.product_title": "Bare Box - 6 Month Plan"
The name of the product in a shop’s catalog.
onetime.properties
string
"name": "grind"
"value": "drip"

A list of line item objects, each one containing information about the onetime product. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself.
onetime.quantity
number
"onetime.quantity": 1
The number of items on the subscription.
onetime.recharge_product_id
number
"onetime.recharge_product_id": 1222682
Unique number identifier of the product in Recharge.
onetime.shopify_product_id
number
"onetime.shopify_product_id": 506021216320
Unique number identifier of the product in Shopify.
onetime.shopify_variant_id
number
"onetime.shopify_variant_id": 5424189866048
Unique number identifier of the product variant in Shopify.
onetime.sku
string
"onetime.sku": null
A unique identifier of the item in the fulfillment.
onetime.status
string
"onetime.status": "ONETIME"
The status of the One Time Product.
onetime.updated_at
string
"onetime.updated_at": "2019-05-24T15:30:52"
The time One Time Product was last updated.
onetime.variant_title
string
"onetime.variant_title": "x-small"
The name of the variant in a shop’s catalog.

[POST] - Create one time product

POST /onetimes

(async () => {
  let url = '{{ onetime_list_url }}' + '?token=' + window.customerToken;
  let data = {
    shopify_variant_id: 5424189866048,
    address_id: 32172754,
    quantity: 1,
    next_charge_scheduled_at: "2019-12-12"
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ onetime_list_url }}';
let data = {
  shopify_variant_id: 5424189866048,
  address_id: 32172754,
  quantity: 1,
  next_charge_scheduled_at: "2019-12-12"
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ onetime_list_url }}',
  type: 'post',
  dataType: 'json',
  data: {
    shopify_variant_id: 5424189866048,
    address_id: 32172754,
      quantity: 1,
    next_charge_scheduled_at: "2019-12-12"
  }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "onetime":{  
      "address_id":32172754,
      "created_at":"2019-05-24T13:54:47",
      "customer_id":8187626,
      "id":43483770,
      "next_charge_scheduled_at":"2019-12-12T00:00:00",
      "price": 5,
      "product_title":"Bare Box - 6 Month Plan",
      "properties":[  

      ],
      "quantity":1,
      "recharge_product_id":1222682,
      "shopify_product_id":506021216320,
      "shopify_variant_id":5424189866048,
      "sku":null,
      "status":"ONETIME",
      "updated_at":"2019-05-24T13:54:47",
      "variant_title":"x-small"
   }
}

This endpoint creates a new one time product for the customer.

URL: {{ onetime_list_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/onetimes?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/onetimes?token=${window.customerToken}

Template file: No template file

Available template objects: No available template objects

Arguments accepted:

|Property| Type| |-|-| |shopify_variant_id *| number | |address_id *| number | |quantity *| number | |next_charge_scheduled_at *| string |

* = required

[GET] - Retrieve one time product

GET /request_objects

(async () => {
  let schema = '{ "customer": {}, "payment_sources": { "customer_id": <int:customer_id> }, "onetime":{ "id": <int:onetime_id>, "products": {"base_source":"shopify"}, "address": {"id": <int:address_id>} }, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "customer": {}, "payment_sources": { "customer_id": <int:customer_id> }, "onetime":{ "id": <int:onetime_id>, "products": {"base_source":"shopify"}, "address": {"id": <int:address_id>} }, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });

$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "customer": {}, "payment_sources": { "customer_id": <int:customer_id> }, "onetime":{ "id": <int:onetime_id>, "products": {"base_source":"shopify"}, "address": {"id": <int:address_id>} }, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"corey@rechargeapps.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":12,
      "number_subscriptions":23,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-24T12:59:21"
   },
   "onetime":{  
      "address":{  
         "address1":"1933 Manning",
         "address2":"204",
         "cart_note":"Updated phone",
         "city":"Los Angeles",
         "company":"Recharge",
         "country":"United States",
         "created_at":"2019-04-30T15:25:20",
         "customer_id":8187626,
         "discount_id":null,
         "first_name":"Recharge",
         "id":32172754,
         "last_name":"Test",
         "note_attributes": [

         ],
         "phone":"3103102221",
         "province":"California",
         "shipping_lines_override":null,
         "updated_at":"2019-05-20T17:12:56",
         "zip":"90025"
      },
      "address_id":32172754,
      "created_at":"2019-05-24T13:54:47",
      "customer_id":8187626,
      "id":43483770,
      "next_charge_scheduled_at":"2019-10-10T00:00:00",
      "price":120.0,
      "product":{  
         "collection_id":106921,
         "created_at":"2019-05-24T12:45:09",
         "discount_amount":0.0,
         "discount_type":"percentage",
         "handle":"bare-box-6-month-plan",
         "id":1222682,
         "images":{  
            "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a_large.jpg",
            "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a_medium.jpg",
            "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a.jpg",
            "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a_small.jpg"
         },
         "inventory_policy":{  
            "one_time":"1",
            "subscription":"1"
         },
         "product_id":506021216320,
         "shopify_details":{  
            "body_html":"<meta charset=\"utf-8\"><span>Looking to mix things up? Every month we'll send you a surprise box filled with all kinds of natural and organic goodies. Each box will contain speciality supplements, beauty supplies,\u00a0clothes and accessories, and many more products\u00a0to help you live your best life. All products are ethically and humanely sourced.</span>",
            "created_at":"2018-02-16T11:02:15-05:00",
            "handle":"bare-box-6-month-plan",
            "image":{  
               "alt":null,
               "created_at":"2018-02-16T11:02:18-05:00",
               "height":1060,
               "position":1,
               "shopify_id":1555303825472,
               "shopify_product_id":506021216320,
               "shopify_variant_ids":[  

               ],
               "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a.jpg?v=1518796938",
               "updated_at":"2018-02-16T11:02:18-05:00",
               "width":1060
            },
            "images":[  
               {  
                  "alt":null,
                  "created_at":"2018-02-16T11:02:18-05:00",
                  "height":1060,
                  "position":1,
                  "shopify_id":1555303825472,
                  "shopify_product_id":506021216320,
                  "shopify_variant_ids":[  

                  ],
                  "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a.jpg?v=1518796938",
                  "updated_at":"2018-02-16T11:02:18-05:00",
                  "width":1060
               }
            ],
            "options":[  
               {  
                  "name":"T-Shirt Size",
                  "position":1,
                  "shopify_id":651242405952,
                  "shopify_product_id":506021216320,
                  "values":[  
                     "x-small",
                     "small",
                     "medium",
                     "large",
                     "x-large"
                  ]
               }
            ],
            "product_type":"",
            "published_at":"2018-02-16T11:01:42-05:00",
            "shopify_id":506021216320,
            "tags":"",
            "title":"Bare Box - 6 Month Plan",
            "updated_at":"2019-05-24T12:45:33-04:00",
            "variants":[  
               {  
                  "barcode":"",
                  "compare_at_price":null,
                  "created_at":"2018-02-16T11:02:16-05:00",
                  "fulfillment_service":"manual",
                  "grams":1814,
                  "inventory_management":null,
                  "inventory_policy":"deny",
                  "inventory_quantity":-1,
                  "option1":"x-small",
                  "option2":null,
                  "option3":null,
                  "position":1,
                  "presentment_prices":null,
                  "price":"120.00",
                  "requires_shipping":true,
                  "shopify_id":5424189866048,
                  "shopify_image_id":null,
                  "shopify_product_id":506021216320,
                  "sku":"001",
                  "taxable":true,
                  "title":"x-small",
                  "updated_at":"2019-05-24T12:45:29-04:00",
                  "weight":4.0,
                  "weight_unit":"lb"
               },
               ...
            ],
            "vendor":"bare-supplements"
         },
         "shopify_product_id":506021216320,
         "subscription_defaults":{  
            "charge_interval_frequency":1,
            "cutoff_day_of_month":null,
            "cutoff_day_of_week":null,
            "expire_after_specific_number_of_charges":null,
            "modifiable_properties": [

            ],
            "number_charges_until_expiration":null,
            "order_day_of_month":0,
            "order_day_of_week":null,
            "order_interval_frequency_options":[  
               "1", "2", "3", "4", "5"
            ],
            "order_interval_unit":"Months",
            "storefront_purchase_options":"subscription_and_onetime"
         },
         "title":"Bare Box - 6 Month Plan",
         "updated_at":"2019-05-24T12:45:33"
      },
      "product_title":"Bare Box - 6 Month Plan",
      "properties":[  

      ],
      "quantity":1,
      "recharge_product_id":1222682,
      "shopify_product_id":506021216320,
      "shopify_variant_id":5424189866048,
      "sku":null,
      "status":"ONETIME",
      "updated_at":"2019-05-24T13:54:47",
      "variant_title":"x-small"
   },
   "payment_sources":[  
      {  
         "billing_address":{  
            "address1":"607 Midvale Ave",
            "address2":"",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name":"Corey",
            "last_name":"Capetillo",
            "phone":"5623095450",
            "province":"California",
            "zip":"90024"
         },
         "card_brand":"visa",
         "card_exp_month":1,
         "card_exp_year":2023,
         "card_last4":"4242",
         "cardholder_name": "Recharge Test"
         "customer_id":8187626,
         "has_card_error_in_dunning":false,
         "id": 1,
         "payment_token": null,
         "payment_type":"credit",
         "processor_name":"stripe",
         "status":"active",
         "status_reason":null
      }
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with form for updating onetime product object.

URL: {{ onetime_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/onetimes/<int:onetime_id>?token=${window.customerToken}

Template file: onetime.html

Schema: '{ "customer": {}, "payment_sources": { "customer_id": <int:customer_id> }, "onetime":{ "id": <int:onetime_id>, "products": {"base_source":"shopify"}, "address": {"id": <int:address_id>} }, "settings": {}, "store": {} }'

Available template objects:

[POST] - Update one time product

POST /onetimes/<int:onetime_id>

(async () => {
  let url = '{{ onetime_url }}' + '?token=' + window.customerToken;
  let data = {
    quantity: 2,
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ onetime_url }}';
let data = {
  quantity: 2,
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ onetime_url }}',
  type: 'post',
  dataType: 'json',
  data: {
    quantity: 2,
  }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "onetime":{  
      "address_id":32172754,
      "created_at":"2019-05-24T13:54:47",
      "customer_id":8187626,
      "id":43483770,
      "next_charge_scheduled_at":"2020-03-03T00:00:00",
      "price":120.0,
      "product_title":"Bare Box - 6 Month Plan",
      "properties":[  

      ],
      "quantity":2,
      "recharge_product_id":1222682,
      "shopify_product_id":506021216320,
      "shopify_variant_id":5424189866048,
      "sku":null,
      "status":"ONETIME",
      "updated_at":"2019-05-24T14:55:20",
      "variant_title":"Bare Box - One Time purchase - x-small"
   }
}

This enpoint updates current onetime product for the customer.

URL: {{ onetime_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/onetimes/<int:onetime_id>?token=${window.customerToken}

Template file: onetime.html

Available template objects:

Arguments accepted:

|Property| Type| |-|-| |next_charge_scheduled_at | string | |quantity | number | |shopify_variant_id | number | |sku | string | |properties | array of dictionary objects |

* = required

[POST] - Set next charge date for one time product

POST /onetimes/<int:onetime_id>/set_next_charge_date

(async () => {
  let url = '{{ onetime_set_next_charge_date_url }}' + '?token=' + window.customerToken;
  let data = {
    next_charge_scheduled_at: "2019-12-12"
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ onetime_set_next_charge_date_url }}';
let data = {
  next_charge_scheduled_at: "2019-12-12"
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ onetime_set_next_charge_date_url }}',
  type: 'post',
  dataType: 'json',
  data: {
    next_charge_scheduled_at: "2019-12-12"
  }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "onetime":{  
      "address_id":32172754,
      "created_at":"2019-05-24T13:17:45",
      "customer_id":8187626,
      "id":43482259,
      "next_charge_scheduled_at":"2019-12-12T00:00:00",
      "price":120.0,
      "product_title":"Bare Box - 6 Month Plan",
      "properties":[  

      ],
      "quantity":1,
      "recharge_product_id":1222682,
      "shopify_product_id":506021216320,
      "shopify_variant_id":5424189866048,
      "sku":null,
      "status":"ONETIME",
      "updated_at":"2019-05-24T15:30:52",
      "variant_title":"x-small"
   }
}

This endpoint renders a template with form for upating next charge date of current onetime product.

URL: {{ onetime_set_next_charge_date_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>/set_next_charge_date?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/onetimes/<int:onetime_id>/set_next_charge_date?token=${window.customerToken}

Template file: onetime.html

Available template objects:

Arguments accepted:

|Property| Type| |-|-| |next_charge_scheduled_at *| string |

* = required

[POST] - Cancel one time product

POST /onetimes/<int:onetime_id>/cancel

(async () => {
  let url = '{{ onetime_cancel_url }}' + '?token=' + window.customerToken;

  try {
    const response = await axios.post(url);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ onetime_cancel_url }}';
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  }
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ onetime_cancel_url }}',
  type: 'post',
  dataType: 'json'
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{ }

This endpoint cancels onetime product.

URL: {{ onetime_cancel_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>/cancel?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/onetimes/<int:onetime_id>/cancel?token=${window.customerToken}

Template file: No template file

Available template objects: No available template objects

Orders

EXAMPLE USING PROPERTIES

{% for order in orders | sort(attribute='shopify_order_number', reverse=True) %}

   {{ order.processed_at | date('%b %-d, %Y') }}

   <a href="{{ order.id | order_url }}">{{ order.shopify_order_number }}</a>

   {{ order.total_price | money }}

{% endfor %}

EXAMPLE OUTPUT

February 21, 2019
1002
$41.57

An order is created after a charge is successfully processed.

Getting an order

EXAMPLE INPUT

{% for order in orders %}
  {{ order.id }}
{% endfor %}

EXAMPLE OUTPUT

1001
1002
1003

You can access all order objects by looping over the orders parent object.

Order routes

Routes are used to retrieve data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/orders

This endpoint renders a template with a list of orders placed by the current customer. route details

GET /tools/recurring/portal/<string:customer_hash>/orders/<int:order_id>

This endpoint renders a template with order details for the current order. route details

Order object

Object contains the different variables of information you may want to access when rendering an object.

Property Definition
order.address_id
number
"order.address_id": 7976732
The id of the customer shipping address that this order is tied to.
order.billing_address object "address1": "101 Washington Street"
"address2": "Suite 404"
"city": "Los Angeles"
"company": "bootstrap"
"country": "United States"
"first_name": "John"
"last_name": "Doe"
"phone": 5553103101
"province": "California"
"zip": 90025

This is all of the billing information related to the order:
  • [string] address1: The street address of the billing address.
  • [string] address2: An optional additional field for the street address of the billing address.
  • [string] city: The city of the billing address.
  • [string] company: The company of the person associated with the billing address.
  • [string] country: The name of the country of the billing address.
  • [string] first_name: The first name of the person associated with the payment method.
  • [string] last_name: The last name of the person associated with the payment method.
  • [string] phone: The phone number associated with the billing address.
  • [string] province: The name of the state or province of the billing address.
  • [string] zip:The zip or postal code of the billing address.
order.browser_ip
string
"order.browser_ip": null
The client details.
order.charge_id
number
"order.charge_id": 41955283
The unique numeric identifier of the charge.
order.charge_status
string
"order.charge_status": "SUCCESS"
The valid values are “SUCCESS”, “REFUNDED”, “PARTIALLY_REFUNDED”.
order.created_at
string
"order.created_at": "2018-02-21T11:46:02"
The date when the order was created.
order.currency
string
"order.currency": "USD"
Order currency.
order.customer
object
"email": "john.Doe@gmail.com"
"first_name": "John"
"last_name": "Doe"
order.customer_id
number
"order.customer_id": 8059036
The unique numeric identifier of the customer.
order.discount_codes
string
"order.discount_codes": []
Discount codes applied on an order.
order.email
string
"order.email": "teststore.myshopify.com"
The email address of the customer.
order.first_name
string
"order.first_name": "Recharge"
The first name of the customer.
order.hash
string
"order.hash": "818762670d14f56b6f39fd7"
The unique string identifier used in a customers portal link.
order.id
integer
"order.id": 30999220
The unique numeric identifier for the order.
order.is_prepaid
number
"order.is_prepaid": 0
The order that has been paid for a pre-determined number of days / weeks / months. 0 = No, 1 = Yes.
order.last_name
string
"order.last_name": "Test"
The last name of the customer.
order.line_items
array
"grams": 0,
"images": { large: "", medium: "", original: "", small: ""},
"price": 4.5,
"product_title": "Bricks 10.00% Off Auto renew",
"properties": [],
"quantity": 1,
"shopify_product_id": 505472712768,
"shopify_variant_id": 5420805816384,
"sku": 13579,
"subscription_id": 11770822,
"tax_lines": [],
"title": "Bricks 10.00% Off Auto renew (Ships every 30 days)",
"variant_title": "1",

A list of line item objects, each one containing information about an item in the order:
  • [number] grams: The weight of the product.
  • [object] images: Object that contains images.
  • [string] price: The price of the product.
  • [string] product_title: The title of the product.
  • [number] quantity: The quantity of the product.
  • [string] shopify_product_id: The id of the Shopify product.
  • [string] shopify_variant_id: The id of the Shopify variant.
  • [string] sku: Stock keeping unit of the product.
  • [number] subscription_id: The unique numeric identifier for a subscription.
  • [string] title: The title of the product.
  • [string] variant_title: The title of the product variant.
order.note
string
"order.note": null
The note that that will be passed to the “note” field of orders made within the address.
order.note_attributes
string
"order.note_attributes": []
Extra information that is added to the address. Each array entry must contain a hash with “name” and “value” keys.
order.processed_at
string
"order.processed_at": "2018-02-15T11:57:19"
The date when the order was submitted.
order.scheduled_at
string
"order.scheduled_at": "2018-02-15T00:00:00"
The date when the order will ship.
order.shipping_address object "address1": "101 Washington Street"
"address2": "Suite 404"
"city": "Los Angeles"
"province": "California"
"first_name": "John"
"last_name": "Doe"
"zip": 90025
"company": "bootstrap"
"phone": 3103103101
"country": "United States"

The mailing address where the order will be shipped to:
  • [string] address1: The street address of the shipping address.
  • [string] address2: An optional additional field for the street address of the shipping address.
  • [string] city: The city of the shipping address.
  • [string] company: The company of the person associated with the shipping address.
  • [string] country: The name of the country of the shipping address.
  • [string] first_name: The first name of the person associated with the shipping address.
  • [string] last_name: The last name of the person associated with the shipping address.
  • [string] phone: The phone number associated with the shipping address.
  • [string] province: The name of the state or province of the shipping address.
  • [string] zip: The zip or postal code of the shipping address.
order.shipping_lines
array
"code": "Priority"
"price": "7.80"
"title": "Priority Mail"

The original shipping used for the address when the store has fixed shipping rates.
  • [string] code: A reference to the shipping used.
  • [string] price: The price of this shipping used.
  • [string] title: The title of the shipping used.
order.shopify_cart_token
string
"order.shopify_cart_token": "02a2d4408ce577f8d0362791fb42ba2e"
Shopify cart token for an order.
order.shopify_customer_id
string
"order.shopify_customer_id": "123227119987"
The unique numeric identifier for Shopify customer.
order.shopify_order_id
string
"order.shopify_order_id": 359467483200
The unique numeric identifier within Shopify for the order.
order.shopify_order_number
number
"order.shopify_order_number": 1001
The unique order number within Shopify.
order.status
string
"order.status": "SUCCESS"
The status of creating the order within Shopify. The valid values are “SUCCESS”, “QUEUED”, “ERROR”, “REFUNDED”, “SKIPPED”.
order.subtotal_price
string
"order.subtotal_price": "33.77"
Subtotal price for an order.
order.tags
string
"order.tags": "Subscription, Subscription First Order"
Custom tags for an order.
order.tax_lines
array
"order.tax_lines": []
Tax lines for an order.
order.total_discounts
string
"order.total_discounts": null
Total discount applied on order.
order.total_line_items_price
string
"order.total_line_items_price": null
Total line items price for an order.
order.total_price
string
"order.total_price": "11"
The sum of all of the prices of the items in the order with taxes and discounts included (must be positive).
order.total_refunds
string
"order.total_refunds": null
Total order refunds.
order.total_tax
number
"order.total_tax": 0
Taxes calculated for order.
order.total_weight
number
"order.total_weight": 2721
Total weight of product.
order.transaction_id
string
"order.transaction_id": "ch_1By0jCJ2zqHvZRd1OOT2qHOx"
The unique alphanumeric identifier of transaction.
order.type
string
"order.type": "CHECKOUT"
Shows if order was made from checkout or a recurring charge. The valid values are “CHECKOUT” or “RECURRING”. In the event that only a onetime product is on the order and the value is "RECURRING" then the order was processed as an off-session transaction and not through checkout.
order.updated_at
string
"order.updated_at": "2018-02-21T12:46:02"
The date when the order was last updated.

[GET] - List of orders

GET /request_objects

(async () => {
  let schema = '{ "orders": { "status": "SUCCESS", "sort_by": "shipped_date-desc" }, "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "orders": { "status": "SUCCESS", "sort_by": "shipped_date-desc" }, "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "orders": { "status": "SUCCESS", "sort_by": "shipped_date-desc" }, "customer": {}, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{  
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      }, 
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":3,
      "number_subscriptions":14,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-04-30T15:11:43"
   },
   "orders":[  
      {  
         "address_id":7976732,
         "billing_address":{  
            "address1":"101 Washington Street",
            "address2":"204",
            "city":"los angeles",
            "company":"bootstrap",
            "country":"United States",
            "first_name":"John",
            "last_name":"Doe",
            "phone":"5553103101",
            "province":"California",
            "zip":"90025"
         },
         "browser_ip": null,
         "charge_id":42723497,
         "charge_status":"SUCCESS",
         "created_at":"2018-02-21T11:46:02",
         "currency": "USD",
         "customer_id":8187626,
         "customer": {
            "accepts_marketing": false,
            "email": "john.Doe@gmail.com",
            "first_name": "John",
            "last_name": "Doe",
            "phone": null,
            "send_email_welcome": false,
            "verified_email": true
         },
         "discount_codes":[  
            "amount": "10.00",
            "code": "summerDiscount",
            "type": "percentage"
         ],
         "email":"john.doe@test.com",
         "error": "",
         "first_name":"John",
         "hash":"818762670d14f56b6f39fd7",
         "id":31541603,
         "is_prepaid":0,
         "last_name":"Doe",
         "line_items":[  
            {  
               "external_inventory_policy": "bypass",
               "images":{  
                  "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_large.jpg",
                  "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_medium.jpg",
                  "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg",
                  "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_small.jpg"
               },
               "price":12.99,
               "product_title":"Bare Sleep",
               "properties":[  

               ],
               "quantity":1,
               "shopify_product_id":"505545949248",
               "shopify_variant_id":"5421270171712",
               "sku":"12347",
               "subscription_id":11959568,
               "tax_lines": [],
               "title":"Bare Sleep",
               "variant_title":""
            },
            {  
               "grams":907,
               "images":{  
                  "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_large.jpg",
                  "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_medium.jpg",
                  "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg",
                  "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_small.jpg"
               },
               "price":10.39,
               "product_title":"Bare Sleep  20.00% Off Auto renew",
               "properties":[  
                  {  
                     "name":"shipping_interval_frequency",
                     "value":"1"
                  },
                  {  
                     "name":"shipping_interval_unit_type",
                     "value":"Months"
                  }
               ],
               "quantity":2,
               "shopify_product_id":"505545949248",
               "shopify_variant_id":"5421270171712",
               "sku":"12347",
               "subscription_id":11959568,
               "tax_lines": [],
               "title":"Bare Sleep  20.00% Off Auto renew (Ships every 1 Months)",
               "variant_title":""
            }
         ],
         "note":null,
         "note_attributes":[  

         ],
         "processed_at":"2018-02-21T11:46:02",
         "scheduled_at":"2018-02-21T00:00:00",
         "shipping_address":{  
            "address1":"101 Washington Street",
            "address2":"204",
            "city":"los angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name":"John",
            "last_name":"Doe",
            "phone":"5553103101",
            "province":"California",
            "zip":"90025"
         },
         "shipping_lines":[  
            {  
               "code":"Priority",
               "price":"7.80",
               "title":"Priority Mail"
            }
         ],
         "shopify_cart_token":"02a2d4408ce577f8d0362791fb42ba2e",
         "shopify_customer_id": "123227119987",
         "shopify_order_id":"363227119680",
         "shopify_order_number":1002,
         "status":"SUCCESS",
         "subtotal_price":"33.77",
         "tags":"Subscription, Subscription First Order",
         "tax_lines":[  

         ],
         "total_discounts":null,
         "total_line_items_price":null,
         "total_price":"41.57",
         "total_refunds":null,
         "total_tax":0.0,
         "total_weight":2721,
         "transaction_id":"ch_1By0jCJ2zqHvZRd1OOT2qHOx",
         "type":"CHECKOUT",
         "updated_at":"2018-02-21T12:46:02"
      }
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a list of orders placed by the current customer.

URL: {{ order_list_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/orders?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/orders?token=${window.customerToken}

Template file: orders.html

Schema: '{ "orders": { "status": "SUCCESS", "sort_by": "shipped_date-desc" }, "customer": {}, "settings": {}, "store": {} }'

Available template objects:

[GET] - Retrieve an order

GET /request_objects

(async () => {
  let schema = '{ "orders": { "id": <int:order_id> }, "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "orders": { "id": <int:order_id> }, "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "orders": { "id": <int:order_id> }, "customer": {}, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      }, 
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"John@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":3,
      "number_subscriptions":14,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-04-30T15:11:43"
   },
   "orders":{  
      "address_id":7976732,
      "address_is_active": 1,
      "billing_address":{  
         "address1":"101 Washington Street",
         "address2":"204",
         "city":"los angeles",
         "company":"bootstrap",
         "country":"United States",
         "first_name":"John",
         "last_name":"Doe",
         "phone":"5553103101",
         "province":"California",
         "zip":"90025"
      },
      "browser_ip": null,
      "charge_id":42723497,
      "charge_status":"SUCCESS",
      "created_at":"2018-02-21T11:46:02",
      "currency": "USD",
      "customer": {
         "email": "john.Doe@gmail.com",
         "first_name": "John",
         "last_name": "Doe"
      }
      "customer_id":8187626,
      "discount_codes":[  
         "amount": "10.00",
         "code": "summerDiscount",
         "type": "percentage"
      ],
      "email":"john.doe@test.com",
      "first_name":"John",
      "hash":"818762670d14f56b6f39fd7",
      "id":31541603,
      "is_prepaid":0,
      "last_name":"Doe",
      "line_items":[  
         {  
            "grams":907,
            "images":{  
               "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_large.jpg",
               "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_medium.jpg",
               "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg",
               "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_small.jpg"
            },
            "price":12.99,
            "product_title":"Bare Sleep",
            "properties":[  

            ],
            "quantity":1,
            "shopify_product_id":"505545949248",
            "shopify_variant_id":"5421270171712",
            "sku":"12347",
            "subscription_id":11959568,
            "tax_lines": [],
            "title":"Bare Sleep",
            "variant_title":""
         },
         {  
            "grams":907,
            "images":{  
               "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_large.jpg",
               "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_medium.jpg",
               "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg",
               "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_small.jpg"
            },
            "price":10.39,
            "product_title":"Bare Sleep  20.00% Off Auto renew",
            "properties":[  
               {  
                  "name":"shipping_interval_frequency",
                  "value":"1"
               },
               {  
                  "name":"shipping_interval_unit_type",
                  "value":"Months"
               }
            ],
            "quantity":2,
            "shopify_product_id":"505545949248",
            "shopify_variant_id":"5421270171712",
            "sku":"12347",
            "subscription_id":11959568,
            "tax_lines": [],
            "title":"Bare Sleep  20.00% Off Auto renew (Ships every 1 Months)",
            "variant_title":""
         }
      ],
      "note":null,
      "note_attributes":[  

      ],
      "payment_processor": "stripe",
      "processed_at":"2018-02-21T11:46:02",
      "scheduled_at":"2018-02-21T00:00:00",
      "shipped_date": "2018-06-01T09:38:21",
      "shipping_address":{  
         "address1":"101 Washington Street",
         "address2":"204",
         "city":"los angeles",
         "company":"bootstrap",
         "country":"United States",
         "first_name":"John",
         "last_name":"Doe",
         "phone":"5553103101",
         "province":"California",
         "zip":"90025"
      },
      "shipping_date": "2018-12-26T00:00:00",
      "shipping_lines":[  
         {  
            "code":"Priority",
            "price":"7.80",
            "title":"Priority Mail"
         }
      ],
      "shopify_cart_token":"02a2d4408ce577f8d0362791fb42ba2e",
      "shopify_customer_id": "123227119987",
      "shopify_id": "1233312321323",
      "shopify_order_id":"363227119680",
      "shopify_order_number":1002,
      "status":"SUCCESS",
      "subtotal_price":"33.77",
      "tags":"Subscription, Subscription First Order",
      "tax_lines":[  

      ],
      "total_discounts":null,
      "total_line_items_price":null,
      "total_price":"41.57",
      "total_refunds":null,
      "total_tax":0.0,
      "total_weight":2721,
      "transaction_id":"ch_1By0jCJ2zqHvZRd1OOT2qHOx",
      "type":"CHECKOUT",
      "updated_at":"2018-02-21T12:46:02"
   },
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with order details for the current order.

URL: {{ order_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/orders/<int:order_id>?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/orders/<int:order_id>?token=${window.customerToken}

Template file: order.html

Schema: '{ "orders": { "id": <int:order_id> }, "customer": {}, "settings":{}, "store": {} }'

Available template objects

Payment sources

Retrieve payment sources for a customer. Payment sources include billing address and credit card informations.

Payment sources routes


GET /tools/recurring/portal/<string:customer_hash>/payment_sources

This endpoint renders a template with a customer's billing information. route details

GET /tools/recurring/portal/<string:customer_hash>/payment_source

This endpoint renders a template with a form for updating payment details for the customer. route details

GET /tools/recurring/portal/<string:customer_hash>/payment_source/1/address

This endpoint renders a template with a form for updating billing address for the customer customer. route details

POST /tools/recurring/portal/<string:customer_hash>/payment_source/1/address

This endpoint updates customer's billing address information. route details

Payment sources object

Object contains the different variables of information you may want to access when rendering an object.

Property Definition
payment_source.billing_address
"address1": "101 Washington Street"
"address2": ""
"city": "Los Angeles"
"company": "Recharge"
"country": "United States"
"first_name": "John"
"last_name": "Doe"
"phone": "5551231234"
"province": "California"
"zip": "90024"

Returns billing address information.
  • [string] address1: The street address of the billing address.
  • [string] address2: An optional additional field for the street address of the billing address.
  • [string] city: The city of the billing address.
  • [string] company: The company of the person associated with the billing address.
  • [string] country: The name of the country of the billing address.
  • [string] first_name: The first name of the person associated with the payment method.
  • [string] last_name: The last name of the person associated with the payment method.
  • [string] phone: The phone number associated with the billing address.
  • [string] province: The name of the state or province of the billing address.
  • [string] zip:The zip or postal code of the billing address.
payment_source.card_brand
string
"payment_source.card_brand": "visa"
It identifies the brand of credit card.
payment_source.card_exp_month
number
"payment_source.card_exp_month": 9
The month when card expires.
payment_source.card_exp_year
number
"payment_source.card_exp_year": 2020
The year when card expires.
payment_source.card_last4
string
"payment_source.card_last4": 4242
The last four digits of card.
payment_source.cardholder_name
string
"payment_source.cardholder_name": Recharge Test
Card owner name information.
payment_source.customer_id
number
"payment_source.customer_id": 8187626
Unique customer identifier.
payment_source.has_card_error_in_dunning
boolean
"payment_source.has_card_error_in_dunning": false
If it has true value, then there was an error in dunning process. There was not error in dunning process if it has false value.
payment_source.id
number
"payment_source.id": "1"
Payment source unique numeric identifier
payment_source.payment_token
string
"payment_source.payment_token": "1"
Payment source unique token.
payment_source.payment_type
string
"payment_source.payment_type": "credit"
It identifies the payment type. It can have credit, debit, paypal or apple_pay values.
payment_source.processor_name
string
"payment_source.processor_name": "stripe"
It identifies payment processor. It can have stripe, braintree or authorize value.
payment_source.status
string
"payment_source.status": "failed"
It identifies status of payment method. It can have active or failed value.
payment_source.status_reason
string
"payment_source.status_reason": "NO_PAYMENT_METHOD"
It provides more information why payment method is not valid if status has failed value.

[GET] - List of payment sources

GET /request_objects

(async () => {
  let schema = '{ "customer": {}, "payment_sources": [], "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "customer": {}, "payment_sources": [], "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "customer": {}, "payment_sources": [], "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },  
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-08T10:22:17"
   },
   "payment_sources":[  
      {  
         "billing_address":{  
            "address1":"101 Washington Street",
            "address2":"",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name":"John",
            "last_name":"Doe",
            "phone":"5551231234",
            "province":"California",
            "zip":"90024"
         },
         "card_brand":'visa',
         "card_exp_month":10,
         "card_exp_year":2022,
         "card_last4":4242,
         "cardholder_name": "Recharge Test",
         "customer_id":8187626,
         "has_card_error_in_dunning":false,
         "id": 1,
         "payment_token": null,
         "payment_type":"credit",
         "processor_name":"stripe",
         "status":"failed",
         "status_reason":"NO_PAYMENT_METHOD"
      }
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a customer's billing information.

URL: {{ payment_source_list_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/payment_sources?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/payment_sources?token=${window.customerToken}

Template file: payment_sources.html

Schema: '{ "customer": {}, "payment_sources": [], "store": {} }'

Available template objects:

[GET] - Retrieve a form to update credit card details

This endpoint renders a template with a form for updating payment details for the customer.

This endpoint is special because we do not allow the customization of the credit card form, only allow an embedded iFrame. You’ll need to use CSS to style the containing window. You can provide CSS in the Credit Card CSS editor in the Settings > Customer Portal settings area.

GET /request_objects

(async () => {
  let schema = '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },  
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-08T10:22:17"
   },
   "payment_sources":[  
      {  
         "billing_address":{  
            "address1":"101 Washington Street",
            "address2":"",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name":"John",
            "last_name":"Doe",
            "phone":"5551231234",
            "province":"California",
            "zip":"90024"
         },
         "card_brand":'visa',
         "card_exp_month":10,
         "card_exp_year":2022,
         "card_last4":4242,
         "cardholder_name": "Recharge Test",
         "customer_id":8187626,
         "has_card_error_in_dunning":false,
         "id": 1,
         "payment_token": null,
         "payment_type":"credit",
         "processor_name":"stripe",
         "status":"failed",
         "status_reason":"NO_PAYMENT_METHOD"
      }
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a form for updating payment details for the customer.

URL: {{ payment_source_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/payment_source?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/payment_source?token=${window.customerToken}

Template file: payment_source.html

Schema: '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "settings": {}, "store": {} }'

Available template objects:

[GET] - Retrieve a form to update billing address details

GET /request_objects

(async () => {
  let schema = '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "billing_countries": [], "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "billing_countries": [], "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "billing_countries": [], "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },  
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-08T10:22:17"
   },
   "payment_sources":[  
      {  
         "billing_address":{  
            "address1":"101 Washington Street",
            "address2":"",
            "city":"Los Angeles",
            "company":"Recharge",
            "country":"United States",
            "first_name":"John",
            "last_name":"Doe",
            "phone":"5551231234",
            "province":"California",
            "zip":"90024"
         },
         "card_brand":'visa',
         "card_exp_month":10,
         "card_exp_year":2022,
         "card_last4":4242,
         "cardholder_name": "Recharge Test",
         "customer_id":8187626,
         "has_card_error_in_dunning":false,
         "id": 1,
         "payment_token": null,
         "payment_type":"credit",
         "processor_name":"stripe",
         "status":"failed",
         "status_reason":"NO_PAYMENT_METHOD"
      }
   ]
   "billing_countries":[  
      {  
         "code":"AF",
         "country_id":1,
         "id":null,
         "name":"Afghanistan",
         "provinces":[  

         ]
      },
      {  
         "code":"AR",
         "country_id":9,
         "id":null,
         "name":"Argentina",
         "provinces":[  
            {  
               "code":"B",
               "id":1964,
               "name":"Buenos Aires"
            },
            {  
               "code":"C",
               "id":1970,
               "name":"Buenos Aires City"
            }
            ...
         ]
      },
      ...
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a form for updating billing address for the customer customer.

URL: {{ payment_source_address_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/payment_source/1/address?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/payment_source/1/address?token=${window.customerToken}

Template file: payment_source_address.html

Schema: '{ "customer": {}, "payment_sources": { "customer_id": <int:customer.id> }, "billing_countries": [], "settings": {}, "store": {} }'

Available template objects:

[POST] - Update billing address details

POST /payment_source/1/address

(async () => {
  let url = '{{ payment_source_address_url }}' + '?token=' + window.customerToken;
  let data = {
    "billing_address1":"101 Washington Street",
    "billing_address2":"",
    "billing_city":"Los Angeles",
    "billing_company":"Recharge",
    "billing_country":"United States",
    "billing_first_name":"John",
    "billing_last_name":"Doe",
    "billing_phone":"5551231234",
    "billing_province":"California",
    "billing_zip":"90024"
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ payment_source_address_url }}' + '?token=' + window.customerToken;
let data = {
  "billing_address1":"101 Washington Street",
  "billing_address2":"",
  "billing_city":"Los Angeles",
  "billing_company":"Recharge",
  "billing_country":"United States",
  "billing_first_name":"John",
  "billing_last_name":"Doe",
  "billing_phone":"5551231234",
  "billing_province":"California",
  "billing_zip":"90024"
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ payment_source_address_url }}' + '?token=' + window.customerToken,
  type: 'post',
  dataType: 'json',
  data: {
    "billing_address1":"101 Washington Street",
    "billing_address2":"",
    "billing_city":"Los Angeles",
    "billing_company":"Recharge",
    "billing_country":"United States",
    "billing_first_name":"John",
    "billing_last_name":"Doe",
    "billing_phone":"5551231234",
    "billing_province":"California",
    "billing_zip":"90024"
  }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      }, 
      "billing_address1":"101 Washington Street",
      "billing_address2":"",
      "billing_city":"Los Angeles",
      "billing_company":"Recharge",
      "billing_country":"United States",
      "billing_phone":"5551231234",
      "billing_province":"California",
      "billing_zip":"90024",
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "has_valid_payment_method":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "processor_type":null,
      "reason_payment_method_not_valid":"NO_PAYMENT_METHOD",
      "shopify_customer_id":"391100760128",
      "status":"ACTIVE",
      "updated_at":"2019-05-13T13:05:29"
   }
}

This endpoint updates customer's billing address information.

URL: {{ payment_source_address_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/payment_source/1/address?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/payment_source/1/address?token=${window.customerToken}

Template file: payment_source_address.html

Available template objects:

Arguments accepted:

Property Type
billing_address1 * string
billing_address2 string
billing_city * string
billing_company string
billing_country * string
billing_first_name * string
billing_last_name * string
billing_phone * string
billing_province * string
billing_zip * string

* = required

Billing Country object

Object contains the different variables of information you may want to access when rendering an object.

Property Definition
billing_country.code
string
"billing_country.code": "AU"
The code of the billing country.
billing_country.country_id
number
"billing_country.country_id": 12
Id of the billing country.
billing_country.id
string
"billing_country.id": "null"
Id of the billing country.
billing_country.name
string
"billing_country.name": "Australia"
Name of the billing country.
billing_country.provinces
array of objects
"billing_country.provinces": [
"code": "ACT",
"id": 2289,
"name": "Australian Capital Territory"
]

Country provinces.

Products

EXAMPLE USING PROPERTIES

{% if product.discount_amount %}
    {% if product.discount_type == 'percentage' %}
      {% set product_price = product_price | float %}
      {% set calculate_discounted = product_price * (1 - product.discount_amount / 100) %}
      {{ calculate_discounted | money }}
    {% else %}
      {{ product_price - product.discount_amount | money }}
    {% endif %}
{% else %}
    {{ product_price | money }}
{% endif %}

EXAMPLE OUTPUT

$70.00

Products are used during the Add Product or Swap Product flow. Consider product a template for which a customer uses to create a subscription from or swap a product in a subscription. A set of products, including subscription type and variants, and price.

Search for products

Page that returns a list of all products available to be subscribed to.

Product routes

Routes are used to retrieve data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/products/search

This endpoint renders a template with a list of all products available cusomter could be subscribed to. route details

Product object

Object contains the different variables of information you may want to access when rendering an object.

Property Definition
product.collection_id
number
"product.collection_id":106920
Unique numeric identifier for the ruleset created in Recharge.
product.created_at
string
"product.created_at":"2018-02-16T11:05:55"
Date and time when ruleset is created.
product.discount_amount
number
"product.discount_amount":0
Discount amount applied on ruleset.
product.discount_type
string
"product.discount_type":"percentage"
The type of discount. Either percentage or fixed_amount.
product.handle
string
"product.handle":"bare-box-3-month-plan"
Handle value for product in Shopify. Used in product edit page.
product.id
number
"product.id":659929
Unique numeric identifier of the product in Recharge.
product.images
object
"large": "https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_large.jpg"
"medium": "https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_medium.jpg"
"original": "https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg"
"small": "https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_small.jpg"

Returns images of the product.
product.inventory_policy
object
"one_time": "1"
"subscription": "1"

Returns inventory policy of the product.
product.shopify_details
object
"body_html": Perfect for hot weather. If you want to cool yourself and find some peace, then Brain freeze is the perfect choice.
"created_at": "2019-07-09T10:25:17"
"handle": "brain-freeze"
"image": {
"alt": null
"created_at": "2019-07-09T10:25:17"
"height": 720
"position": 1
"shopify_id": 1234567890
"shopify_product_id": 1999358560003
"shopify_variant_ids": []
"src": ""https://cdn.shopify.com/s/files/1/0092/3765/9699/products/1_f4b108dbf.jpg?v=1563684188""
"updated_at": "2019-07-09T10:23:08-04:00"
"width": 1280
}
"images": [
"alt": null
"created_at": "2019-07-09T10:25:17"
"height": 720
"position": 1
"shopify_id": 1234567890
"shopify_product_id": 1999358560003
"shopify_variant_ids": []
"src": ""https://cdn.shopify.com/s/files/1/0092/3765/9699/products/1_f4b108dbf.jpg?v=1563684188""
"updated_at": "2019-07-09T10:23:08-04:00"
"width": 1280
]
"options": [
"name": "Title"
"position": 1
"shopify_id": 123456789
"shopify_product_id": 9876543210
"values": [
"Default Title"
]
]
"product_type": ""
"published_at": "2019-07-09T10:18:32-04:00"
"shopify_id": 9876543210
"tags": ""
"title": "Brain freeze"
"updated_at": "2019-08-19T12:39:17-04:00"
"variants": [
"barcode": ""
"compare_at_price": null
"created_at": "2019-07-09T10:23:05-04:00"
"fulfillment_service": "manual"
"grams": 136
"inventory_management": "shopify"
"inventory_policy": "deny"
"inventory_quantity": 0
"option1": "Default Title"
"option2": null
"option3": null
"position": 1
"presentment_prices": null
"price": "5.00"
"requires_shipping": true
"shopify_id": 17917730424832
"shopify_image_id": null
"shopify_product_id": 1999358580003
"sku": "004"
"taxable": true
"title": "Default Title"
"updated_at": "2019-08-19T12:39:17-04:00"
"weight": 0.3
"weight_unit": "lb"
]
"vendor": "Test Store"


We have modified the shopify_details object that gets returned in an effort to reduce confusion with Recharge IDs. We have modified the following properties found within the object:
- id == shopify_id
- product_id == shopify_product_id
- variant_ids = shopify_variant_ids
product.shopify_product_id
number
"product.shopify_product_id":506020921408
Unique numeric identifier of the product in Shopify.
product.subscription_defaults
object
"charge_interval_frequency": 2
"cutoff_day_of_month": null
"cutoff_day_of_week": null
"expire_after_specific_number_of_charges": null
"modifiable_properties": []
"number_charges_until_expiration": null
"order_day_of_month": null
"order_day_of_week": null
"order_interval_frequency_options": ["2", "1"]
"order_interval_unit": "Weeks"
"storefront_purchase_options": "subscription_and_onetime"

Returns default attributes for the Subscription.
product.title
string
"product.title":"Bare Box - 3 Month Plan"
The title of the product.
product.updated_at
string
"product.updated_at":"2019-03-13T16:37:33"
Date and time when ruleset is updated.

[GET] - List of products

Returns a list of all products available.

GET /request_objects

(async () => {
  let schema = '{ "customer": {}, "products": { "base_source": "store_settings", "page": 1, "limit": 15 }, "products_count": { "base_source": "store_settings" }, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "customer": {}, "products": { "base_source": "store_settings", "page": 1, "limit": 15 }, "products_count": { "base_source": "store_settings" }, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "customer": {}, "products": { "base_source": "store_settings", "page": 1, "limit": 15 }, "products_count": { "base_source": "store_settings" }, "settings": {}, "store": {} }'}
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "customer":{  
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },  
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":7,
      "number_subscriptions":19,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-17T19:54:30"
   },
   "products":[  
      {  
         "collection_id":106920,
         "created_at":"2018-02-16T11:05:55",
         "discount_amount":0.0,
         "discount_type":"percentage",
         "handle":"bare-box-3-month-plan",
         "id":659929,
         "images":{  
            "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_large.jpg",
            "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_medium.jpg",
            "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg",
            "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_small.jpg"
         },
         "inventory_policy":{  
            "one_time":"1",
            "subscription":"1"
         },
         "shopify_details":{  
            "body_html":"<meta charset=\"utf-8\"><span>Looking to mix things up? Every month we'll send you a surprise box filled with all kinds of natural and organic goodies. Each box will contain speciality supplements, beauty supplies,\u00a0clothes and accessories, and many more products\u00a0to help you live your best life. All products are ethically and humanely sourced.</span>",
            "created_at":"2018-02-16T11:01:02-05:00",
            "handle":"bare-box-3-month-plan",
            "image":{  
               "alt":null,
               "created_at":"2018-02-16T11:01:05-05:00",
               "height":1060,
               "position":1,
               "shopify_id":1555302776896,
               "shopify_product_id":506020921408,
               "shopify_variant_ids":[  

               ],
               "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg?v=1518796865",
               "updated_at":"2018-02-16T11:01:05-05:00",
               "width":1060
            },
            "images":[  
               {  
                  "alt":null,
                  "created_at":"2018-02-16T11:01:05-05:00",
                  "height":1060,
                  "position":1,
                  "shopify_id":1555302776896,
                  "shopify_product_id":506020921408,
                  "shopify_variant_ids":[  

                  ],
                  "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg?v=1518796865",
                  "updated_at":"2018-02-16T11:01:05-05:00",
                  "width":1060
               }
            ],
            "options":[  
               {  
                  "name":"T-Shirt Size",
                  "position":1,
                  "shopify_id":651242111040,
                  "shopify_product_id":506020921408,
                  "values":[  
                     "x-small",
                     "small",
                     "medium",
                     "large",
                     "x-large"
                  ]
               }
            ],
            "product_type":"",
            "published_at":"2018-02-16T10:59:15-05:00",
            "shopify_id":506020921408,
            "tags":"",
            "title":"Bare Box - 3 Month Plan",
            "updated_at":"2019-03-27T15:30:20-04:00",
            "variants":[  
               {  
                  "barcode":"",
                  "compare_at_price":null,
                  "created_at":"2018-02-16T11:01:03-05:00",
                  "fulfillment_service":"manual",
                  "grams":1814,
                  "inventory_management":null,
                  "inventory_policy":"deny",
                  "inventory_quantity":-30,
                  "option1":"x-small",
                  "option2":null,
                  "option3":null,
                  "position":1,
                  "presentment_prices":null,
                  "price":"70.00",
                  "requires_shipping":true,
                  "shopify_id":5424189177920,
                  "shopify_image_id":null,
                  "shopify_product_id":506020921408,
                  "sku":"",
                  "taxable":true,
                  "title":"x-small",
                  "updated_at":"2019-05-15T13:42:25-04:00",
                  "weight":4.0,
                  "weight_unit":"lb"
               },
               {  
                  "barcode":"",
                  "compare_at_price":null,
                  "created_at":"2018-02-16T11:01:03-05:00",
                  "fulfillment_service":"manual",
                  "grams":1814,
                  "inventory_management":null,
                  "inventory_policy":"deny",
                  "inventory_quantity":0,
                  "option1":"x-large",
                  "option2":null,
                  "option3":null,
                  "position":5,
                  "presentment_prices":null,
                  "price":"70.00",
                  "requires_shipping":true,
                  "shopify_id":5424189308992,
                  "shopify_image_id":null,
                  "shopify_product_id":506020921408,
                  "sku":"",
                  "taxable":true,
                  "title":"x-large",
                  "updated_at":"2019-03-13T16:37:32-04:00",
                  "weight":4.0,
                  "weight_unit":"lb"
               }
            ],
            "vendor":"bare-supplements"
         },
         "shopify_product_id":506020921408,
         "subscription_defaults":{  
            "charge_interval_frequency":3,
            "cutoff_day_of_month":null,
            "cutoff_day_of_week":null,
            "expire_after_specific_number_of_charges":null,
            "modifiable_properties": [

            ],
            "number_charges_until_expiration":null,
            "order_day_of_month":0,
            "order_day_of_week":null,
            "order_interval_frequency_options":[  
               "1"
            ],
            "order_interval_unit":"Months",
            "storefront_purchase_options":"subscription_only"
         },
         "title":"Bare Box - 3 Month Plan",
         "updated_at":"2019-03-13T16:37:33"
      },
      {  
         "shopify_details":{  
            "body_html":"<meta charset=\"utf-8\"><span>Looking to mix things up? Every month we'll send you a surprise box filled with all kinds of natural and organic goodies. Each box will contain speciality supplements, beauty supplies,\u00a0clothes and accessories, and many more products\u00a0to help you live your best life. All products are ethically and humanely sourced.</span>",
            "created_at":"2018-02-16T11:02:15-05:00",
            "handle":"bare-box-6-month-plan",
            "image":{  
               "alt":null,
               "created_at":"2018-02-16T11:02:18-05:00",
               "height":1060,
               "position":1,
               "shopify_id":1555303825472,
               "shopify_product_id":506021216320,
               "shopify_variant_ids":[  

               ],
               "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a.jpg?v=1518796938",
               "updated_at":"2018-02-16T11:02:18-05:00",
               "width":1060
            },
            "images":[  
               {  
                  "alt":null,
                  "created_at":"2018-02-16T11:02:18-05:00",
                  "height":1060,
                  "position":1,
                  "shopify_id":1555303825472,
                  "shopify_product_id":506021216320,
                  "shopify_variant_ids":[  

                  ],
                  "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_869e6595-cb3b-40a4-9dd8-60d55904d11a.jpg?v=1518796938",
                  "updated_at":"2018-02-16T11:02:18-05:00",
                  "width":1060
               }
            ],
            "options":[  
               {  
                  "name":"T-Shirt Size",
                  "position":1,
                  "shopify_id":651242405952,
                  "shopify_product_id":506021216320,
                  "values":[  
                     "x-small",
                     "small",
                     "medium",
                     "large",
                     "x-large"
                  ]
               }
            ],
            "product_type":"",
            "published_at":"2018-02-16T11:01:42-05:00",
            "shopify_id":506021216320,
            "tags":"",
            "title":"Bare Box - 6 Month Plan",
            "updated_at":"2019-03-27T15:30:21-04:00",
            "variants":[  
               {  
                  "barcode":"",
                  "compare_at_price":null,
                  "created_at":"2018-02-16T11:02:16-05:00",
                  "fulfillment_service":"manual",
                  "grams":1814,
                  "inventory_management":null,
                  "inventory_policy":"deny",
                  "inventory_quantity":-1,
                  "option1":"x-small",
                  "option2":null,
                  "option3":null,
                  "position":1,
                  "presentment_prices":null,
                  "price":"120.00",
                  "requires_shipping":true,
                  "shopify_id":5424189866048,
                  "shopify_image_id":null,
                  "shopify_product_id":506021216320,
                  "sku":"",
                  "taxable":true,
                  "title":"x-small",
                  "updated_at":"2019-03-29T16:04:15-04:00",
                  "weight":4.0,
                  "weight_unit":"lb"
               },
               {  
                  "barcode":"",
                  "compare_at_price":null,
                  "created_at":"2018-02-16T11:02:16-05:00",
                  "fulfillment_service":"manual",
                  "grams":1814,
                  "inventory_management":null,
                  "inventory_policy":"deny",
                  "inventory_quantity":0,
                  "option1":"x-large",
                  "option2":null,
                  "option3":null,
                  "position":5,
                  "presentment_prices":null,
                  "price":"120.00",
                  "requires_shipping":true,
                  "shopify_id":5424189997120,
                  "shopify_image_id":null,
                  "shopify_product_id":506021216320,
                  "sku":"",
                  "taxable":true,
                  "title":"x-large",
                  "updated_at":"2018-09-11T20:29:55-04:00",
                  "weight":4.0,
                  "weight_unit":"lb"
               }
            ],
            "vendor":"bare-supplements"
         }
      },
      ...
   ],
   "products_count":11,
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a list of all products available cusomter could be subscribed to.

URL: {{ product_search_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/products/search?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/products/search?token=${window.customerToken}

Template file: products_search.html

Schema: '{ "customer": {}, "products": { "base_source": "store_settings", "page": page, "limit": limit }, "products_count": { "base_source": "store_settings" }, "settings": {}, "store": {} }'

Available objects

Schedule

EXAMPLE USING PROPERTIES

{% for delivery in schedule %}
   {{ delivery.date | date("%B %d, %Y") }}
{% endfor %}

EXAMPLE OUTPUT

August 07, 2019

Delivery schedule dates are when your order will be placed. Future deliveries will be added to your schedule as the date approaches.

Schedule routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/schedule

This enpoint renders a template with schedule dates when your order will be placed. route details

Schedule object

Object contains the different variables of information you may want to access when rendering an object. Some objects will even contain child properties, such as schedule.orders.shipment_type

Property Definition
schedule.date
string
"address.date": "2019-07-07T00:00:00"
Provides a convenient way to access the charge date of the shipment.
schedule.orders
"charge": {} Returns Charge object
"is_skippable": true
"is_skipped": false
"order": {} Returns Order object
"price": "70.0"
"shipment_type": "PROJECTED_SHIPMENT"
"subscription": {} Returns Subscription object
"title": "Bare Box - 3 Month Plan"

[GET] - Retrieve schedule

GET /request_objects

(async () => {
  let schema = '{ "schedule": [], "addresses": [], "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "schedule": [], "addresses": [], "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "schedule": [], "addresses": [], "customer": {}, "settings": {}, "store": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{  
   "addresses":[  
      {  
         "address1":"101 Washington Street",
         "address2":"204",
         "cart_note":"Updated phone",
         "city":"Los Angeles",
         "company":"Recharge",
         "country":"United States",
         "created_at":"2019-04-30T15:25:20",
         "customer_id":8187626,
         "discount": {},
         "discount_id":null,
         "first_name":"John",
         "id":32172754,
         "include": {
            "payment_methods": []
         },
         "last_name":"Doe",
         "note_attributes":null,
         "phone":"3103102221",
         "province":"California",
         "shipping_lines_override":null,
         "updated_at":"2019-05-14T12:32:22",
         "zip":"90025"
      },
      ...
   ],
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },  
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":8,
      "number_subscriptions":19,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-13T14:19:01"
   },
   "schedule":[  
      {  
         "date":"2019-07-07T00:00:00",
         "orders":[  
            {  
               "charge":{  
                  "address_id":32172754,
                  "analytics_data": {
                      "utm_params": []
                  },
                  "billing_address":{  
                     "address1":"607 Midvale Ave",
                     "address2":"",
                     "city":"Los Angeles",
                     "company":"Recharge",
                     "country":"United States",
                     "first_name":"John",
                     "last_name":"Doe",
                     "phone":"5623095450",
                     "province":"California",
                     "zip":"90024"
                  },
                  "client_details":{  
                     "browser_ip":null,
                     "user_agent":null
                  },
                  "created_at":"2019-05-06T15:08:49",
                  "customer_hash":"818762670d14f56b6f39fd7",
                  "customer_id":8187626,
                  "discount_codes":[  

                  ],
                  "email":"john.doe@test.com",
                  "first_name":"John",
                  "has_uncommited_changes":false,
                  "id":158825571,
                  "last_name":"Doe",
                  "line_items":[  
                     {  
                        "grams":1814,
                        "images":{  
                           "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_large.jpg",
                           "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_medium.jpg",
                           "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg",
                           "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_small.jpg"
                        },
                        "price":"70.00",
                        "properties":[  
                           "name": "",
                           "value": ""
                        ],
                        "quantity":1,
                        "shopify_product_id":"506020921408",
                        "shopify_variant_id":"5424189177920",
                        "sku":"",
                        "subscription_id":42603951,
                        "title":"Bare Box - 3 Month Plan",
                        "variant_title":"x-small"
                     }
                  ],
                  "note":"Updated phone",
                  "note_attributes":null,
                  "processor_name":"stripe",
                  "scheduled_at":"2019-07-07T00:00:00",
                  "shipments_count":null,
                  "shipping_address":{  
                     "address1":"101 Washington Street",
                     "address2":"204",
                     "city":"Los Angeles",
                     "company":"Recharge",
                     "country":"United States",
                     "first_name":"John",
                     "last_name":"Doe",
                     "phone":"3103102221",
                     "province":"California",
                     "zip":"90025"
                  },
                  "shipping_lines":[  
                     {  
                        "code":"Priority",
                        "price":"7.81",
                        "title":"Priority Mail"
                     }
                  ],
                  "shopify_order_id":null,
                  "status":"QUEUED",
                  "sub_total":null,
                  "subtotal_price":"70.0",
                  "tags":"Subscription, Subscription Recurring Order",
                  "tax_lines":0.0,
                  "total_discounts":"0.0",
                  "total_line_items_price":"70.00",
                  "total_price":"77.81",
                  "total_refunds":null,
                  "total_tax":0.0,
                  "total_weight":1814,
                  "transaction_id":null,
                  "type":"RECURRING",
                  "updated_at":"2019-05-14T12:32:24"
               },
               "is_skippable":true,
               "is_skipped":false,
               "order":{  

               },
               "price":"70.0",
               "shipment_type":"PROJECTED_SHIPMENT",
               "subscription":{  
                  "address_id":32172754,
                  "cancellation_reason":null,
                  "cancellation_reason_comments":null,
                  "cancelled_at":null,
                  "charge_interval_frequency":"1",
                  "charge_interval_unit_type": "week",
                  "created_at":"2019-05-06T14:55:59",
                  "customer_id":8187626,
                  "expire_after_specific_number_of_charges":null,
                  "has_queued_charges":1,
                  "id":42603951,
                  "is_prepaid": false,
                  "is_skippable": true,
                  "is_swappable": true,
                  "max_retries_reached":0,
                  "next_charge_scheduled_at":"2019-07-07T00:00:00",
                  "order_day_of_month":null,
                  "order_day_of_week":null,
                  "order_interval_frequency":"1",
                  "order_interval_unit":"month",
                  "price":70.0,
                  "product":{  
                     "collection_id":106920,
                     "created_at":"2018-02-16T11:05:55",
                     "discount_amount":0.0,
                     "discount_type":"percentage",
                     "handle":"bare-box-3-month-plan",
                     "id":659929,
                     "images":{  
                        "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_large.jpg",
                        "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_medium.jpg",
                        "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg",
                        "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_small.jpg"
                     },
                     "inventory_policy":{  
                        "one_time":"1",
                        "subscription":"1"
                     },
                     "shopify_details":{  
                        "body_html":"<meta charset=\"utf-8\"><span>Looking to mix things up? Every month we'll send you a surprise box filled with all kinds of natural and organic goodies. Each box will contain speciality supplements, beauty supplies,\u00a0clothes and accessories, and many more products\u00a0to help you live your best life. All products are ethically and humanely sourced.</span>",
                        "created_at":"2018-02-16T11:01:02-05:00",
                        "handle":"bare-box-3-month-plan",
                        "image":{  
                           "alt":null,
                           "created_at":"2018-02-16T11:01:05-05:00",
                           "height":1060,
                           "position":1,
                           "shopify_id":1555302776896,
                           "shopify_product_id":506020921408,
                           "shopify_variant_ids":[  

                           ],
                           "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg?v=1518796865",
                           "updated_at":"2018-02-16T11:01:05-05:00",
                           "width":1060
                        },
                        "images":[  
                           {  
                              "alt":null,
                              "created_at":"2018-02-16T11:01:05-05:00",
                              "height":1060,
                              "position":1,
                              "shopify_id":1555302776896,
                              "shopify_product_id":506020921408,
                              "shopify_variant_ids":[  

                              ],
                              "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg?v=1518796865",
                              "updated_at":"2018-02-16T11:01:05-05:00",
                              "width":1060
                           }
                        ],
                        "options":[  
                           {  
                              "name":"T-Shirt Size",
                              "position":1,
                              "shopify_id":651242111040,
                              "shopify_product_id":506020921408,
                              "values":[  
                                 "x-small",
                                 "small",
                                 "medium",
                                 "large",
                                 "x-large"
                              ]
                           }
                        ],
                        "product_type":"",
                        "published_at":"2018-02-16T10:59:15-05:00",
                        "shopify_id":506020921408,
                        "tags":"",
                        "title":"Bare Box - 3 Month Plan",
                        "updated_at":"2019-03-27T15:30:20-04:00",
                        "variants":[  
                           {  
                              "barcode":"",
                              "compare_at_price":null,
                              "created_at":"2018-02-16T11:01:03-05:00",
                              "fulfillment_service":"manual",
                              "grams":1814,
                              "inventory_management":null,
                              "inventory_policy":"deny",
                              "inventory_quantity":-29,
                              "option1":"x-small",
                              "option2":null,
                              "option3":null,
                              "position":1,
                              "presentment_prices":null,
                              "price":"70.00",
                              "requires_shipping":true,
                              "shopify_id":5424189177920,
                              "shopify_image_id":null,
                              "shopify_product_id":506020921408,
                              "sku":"",
                              "taxable":true,
                              "title":"x-small",
                              "updated_at":"2019-05-14T13:12:57-04:00",
                              "weight":4.0,
                              "weight_unit":"lb"
                           },
                        ],
                        "vendor":"bare-supplements"
                     },
                     "shopify_product_id":506020921408,
                     "subscription_defaults":{  
                        "charge_interval_frequency":3,
                        "cutoff_day_of_month":null,
                        "cutoff_day_of_week":null,
                        "expire_after_specific_number_of_charges":null,
                        "modifiable_properties":[],
                        "number_charges_until_expiration":null,
                        "order_day_of_month":0,
                        "order_day_of_week":null,
                        "order_interval_frequency":1,
                        "order_interval_frequency_options":[  
                           "1"
                        ],
                        "order_interval_unit":"Months",
                        "storefront_purchase_options":"subscription_only"
                     },
                     "title":"Bare Box - 3 Month Plan",
                     "updated_at":"2019-03-13T16:37:33"
                  },
                  "product_title":"Bare Box - 3 Month Plan",
                  "properties":[  
                      "name": "",
                      "value": ""
                  ],
                  "quantity":1,
                  "recharge_product_id":659929,
                  "shopify_product_id":506020921408,
                  "shopify_variant_id":5424189177920,
                  "sku":"",
                  "sku_override":false,
                  "status":"ACTIVE",
                  "updated_at":"2019-05-08T10:23:56",
                  "variant_title":"x-small"
               },
               "title":"Bare Box - 3 Month Plan"
            },
           ...
         ]
      },
      ...
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

Delivery schedule dates are when your order will be placed. Future deliveries will be added to your schedule as the date approaches. This enpoint renders a template with schedule dates when your order will be placed.

URL: {{ schedule_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/schedule?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/schedule?token=${window.customerToken}

Template file: schedule.html

Schema: '{ "schedule": [], "addresses": [], "customer": {}, "settings": {}, "store": {} }'

Available objects

Settings

The settings object will contain various attributes, such as customer portal and shop ID.

Settings routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/request_objects

Returns settings object.

Settings object


Property Definition
settings.customer_portal "custom_code": {
"footer": ""
"header": ""
"header_logo_url": ""
}
"discount_input": true
"edit_shipping_address": true
"hosted_customer_portal": true
"inventory_behaviour": "bypass"
"onetime": {
"available_products": "recharge_products"
"enabled": true
"shopify_collection_id": null
"zero_inventory_purchase": true
}

"subscription": {
"add_product": true
"cancel_subscription": true
"cancellation_email_contact": ""
"cancellation_minimum_order_count": 0
"change_product": true
"change_quantity": true
"change_variant": true
"edit_order_frequency": "Any"
"edit_scheduled_date": true
"reactivate_subscription": true
"skip_scheduled_order": true
"zero_inventory_purchase": true
}
"view_order_schedule": true
"view_recharge_payment_methods": false
settings.has_shopify_connector
boolean
"settings.has_shopify_connector": false
settings.shop_id
number
"settings.shop_id": 41575

[GET] - Settings object

Settings object for the current customer.

Methods accepted: GET

Schema: '{ "settings": {} }'

GET /request_objects

(async () => {
  let schema = '{ "settings": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "settings": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects' + '?token=' + window.customerToken,
  type: 'get',
  dataType: 'json',
  data: { schema: '{ "settings": {} }' }
}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE


{
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector":false,
      "shop_id":41575
   }

}

Retrieve settings object

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/request_objects?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/request_objects?token=${window.customerToken}

Template file: All Theme Editor Template files

Schema: '{ "settings": {} }'

Shop

EXAMPLE USING PROPERTIES

Shop name: {{ shop.name }}
Shop domain: {{ shop.domain }}

EXAMPLE OUTPUT

Shop name: teststore
Shop domain: teststore.com

The shop object will contain various attributes, such as domain and email.

Shop object

Object contains the different variables of information you may want to access when rendering an object.

Property Definition
shop.checkout_logo_url
string
"shop.checkout_logo_url": "https://cdn.shopify.com/s/files/1/3104/4618/logo/facd505-3d76-4ce9-8f33-99146e2fd4db_logo.jpg
Logo of the store.
shop.created_at
string
"shop.created_at": "Thu, 15 Feb 2018 11:53:56 GMT"
Date and time when shop is created.
shop.currency
string
"shop.currency": "USD"
The currency of shop.
shop.domain
string
"shop.domain": "teststore.com"
The domain of shop.
shop.email
string
"shop.email": "store@teststore.com"
The email of shop. Proprty will be depracated soon. Please use shop_email instead.
shop.external_platform
string
"shop.external_platform": "shopify"
External platform on which store is based. Can have values of "shopify" or "bigcommerce"
shop.iana_timezone
string
"shop.iana_timezone": "America/New_York"
Iana database timezone format.
shop.id
number
"shop.id": 41575
Unique number identifier of the shop.
shop.my_shopify_domain
string
"shop.my_shopify_domain": "test-dev-store.myshopify.com"
Shop domain name in Shopify.
shop.name
string
"shop.name": "teststore"
The name of shop.
shop.platform_domain
string
"shop.platform_domain": "teststore"
Platform domain of the shop.
shop.shop_email
string
"shop.shop_email": "john.doe@test.com"
E-mail address of the shop owner.
shop.shop_phone
string
"shop.shop_phone": ""
Phone number of the shop owner.
shop.timezone
string
"shop.timezone": "(GMT-05:00) Eastern Time (US & Canada)"
Timezone of the shop.
shop.updated_at
string
"shop.updated_at": "Tue, 21 May 2019 08:00:54 GMT"
Date and time when store is updated.

Store

EXAMPLE USING PROPERTIES

Store name: {{ store.name }}
Store domain: {{ store.domain }}

EXAMPLE OUTPUT

Store name: teststore
Store domain: teststore.com

The store object will contain various attributes, such as domain and email.

Store object

Object contains the different variables of information you may want to access when rendering an object.

Property Definition
store.checkout_logo_url
string
""
The checkout logo URL.
store.checkout_platform
string
"store.checkout_platform": "recharge"
Store checkout platform.
store.created_at
string
"store.created_at": "Thu, 15 Feb 2018 11:53:56 GMT"
Date and time when shop is created.
store.currency
string
"store.currency": "USD"
The currency of store.
store.customer_portal_domain
string
""
Customer portal domain.
store.domain
string
"store.domain": "teststore.com"
The domain of the store.
store.email
string
"store.email": "store@teststore.com"
The email of store.
store.external_platform
string
"store.external_platform": "shopify"
External platform of the store.
store.iana_timezone
string
"store.iana_timezone": "America/New_York"
Iana database timezone format.
store.id
number
"store.id": 41575
Unique number identifier of the store.
store.migrated_to_shopify_checkout_integration
number
"store.migrated_to_shopify_checkout_integration": 0
Shows the migration status of the store.
store.my_shopify_domain
string
"store.my_shopify_domain": "teststore.myshopify.com"
Store domain name in Shopify.
store.name
string
"store.name": "teststore"
The name of store.
store.platform_domain
string
"store.platform_domain": "store.myshopify.com"
The platform domain of the store.
store.shop_email
string
"store.shop_email": "john.doe@test.com"
E-mail address of the store owner.
store.shop_phone
string
"store.shop_phone": ""
Phone number of the store owner.
store.timezone
string
"store.timezone": "(GMT-05:00) Eastern Time (US & Canada)"
Timezone of the store.
store.updated_at
string
"store.updated_at": "Tue, 21 May 2019 08:00:54 GMT"
Date and time when store is updated.

Subscriptions

EXAMPLE USING PROPERTIES

{% if subscription.status == "ACTIVE" %}
  <fieldset>
  {% if subscription.is_skippable %}
    <a href="#" onclick="ReCharge.Subscription.skip({{ subscription.id }}); return false;">Skip shipment</a><br>
  {% endif %}
  {% if subscription.is_swappable %}
    <a href="{{ subscription.id | subscription_swap_search_url }}">Swap product</a><br>
  {% endif %}
  {% if subscription.status == "ONETIME" %}
     <a href="#" onclick="if (window.confirm('Are you sure you want to cancel this product?')) { ReCharge.Onetime.cancel({{ onetime.id }}); }; return false;">Cancel</a><br>
  {% else %}
    <a href="{{ subscription | subscription_cancel_url }}">Cancel subscription</a><br>
  {% endif %}
  </fieldset>
  <br>
{% endif %}tion 

EXAMPLE OUTPUT

Skip shipment Swap product Cancel subscription

Subscriptions are individual items customers are receiving on a recurring basis. Customer can create multiple subscriptions of the same product on one address.

Getting a subscription

EXAMPLE INPUT

{% for subscription in subscriptions %}
  {% if subscription.status == "ACTIVE" %}
    {% if subscription.next_charge_scheduled_at %}
      {{ subscription.next_charge_scheduled_at | replace('T00:00:00', '') | replace('-', '/') }}
    {% else %}
      &mdash;
    {% endif %}
  {% else %}
    {{ subscription.status }}
  {% endif %}
{% endfor %}

EXAMPLE OUTPUT

2019/12/28
2019/11/28
--
CANCELLED
2019/08/28

You can access all subscription objects by looping over the subscriptions parent object.

Subscription routes

Routes are used to retrieve, create, or modify existing data. Some routes are tied to templates, which can be rendered by the theme engine. All routes have an accepted method. View route details for more information.


GET /tools/recurring/portal/<string:customer_hash>/subscriptions

This endpoint renders a template with a list of subscriptions for customer. route details

GET /tools/recurring/portal/<string:customer_hash>/subscriptions/new

This endpoint renders a template with form for creating new subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions

This endpoint creates a new subscription for customer. route details

POST /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/subscriptions-bulk-create

This endpoint bulk create subscriptions. route details

GET /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>

This endpoint renders a template with form for updating properties of the current subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>

This endpoint updates current subscription. route details

POST tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/subscriptions-bulk-update

This endpoint bulk update subscription properties. route details

GET /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel

This endpoint renders a template with all retention strategies for cancelling current subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel

This enpoint cancels current subscription for the customer. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/activate

This enpoint activates or re-activates current subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/delay

This endpoint delays current subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date

This enpoint is used to change next charge date pf subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/skip

This enpoint is used for skipping subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/unskip

This enpoint is used to unskip subscription. route details

POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>

This endpoint is used to swap subscription. route details

GET /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel/<int:retention_strategy_id>

This enpoint renders a template with retention strategy used for cancelling subscription. route details

Subscription object

Object contains the different variables of information you may want to access when rendering an object. Some objects will even contain child properties, such as subscription.address.city, but some of them, such as subscription.address.discount will not be avialable.

Property Definition
subscription.address_id
number
"subscription.address_id": 178918
Unique numeric identifier for the address the subscription is associated with.
subscription.analytics_data
array
"subscription.analytics_data": []
Analytics data.
subscription.cancellation_reason
string
"subscription.cancellation_reason": "I already have more than I need"
Retention strategy reason for cancellation.
subscription.cancellation_reason_comments
string
"subscription.cancellation_reason_comments": "Don't need more of this products."
Additional comments when cancelling the subscription.
subscription.cancelled_at
string
"subscription.cancelled_at": null
The time the subscription was cancelled.
subscription.charge_delay
string
"subscription.charge_delay": null
subscription.charge_interval_frequency
string
"subscription.charge_interval_frequency": 30
The number of units (specified in order_interval_unit) between each charge. For example, "order_interval_unit": "month" and "charge_interval_frequency": 3, indicate charge every 3 months. Charges must use the same unit types as orders.
subscription.created_at
string
"subscription.created_at": "Mon, 22 Apr 2019 09:48:22 GMT"
Date and time when store is created.
subscription.customer_id
number
"subscription.customer_id": 8187626
Unique numeric identifier of the customer.
subscription.cutoff_day_of_month_before_and_after
number
"subscription.cutoff_day_of_month_before_and_after": null
subscription.cutoff_day_of_week_before_and_after
number
"subscription.cutoff_day_of_week_before_and_after": null
subscription.email
number
"subscription.email": "johndoe@gmail.com"
Email address of the customer.
subscription.expire_after_specific_number_of_charges
number
"subscription.expire_after_specific_number_of_charges": 5
Number of charges after which subscription will expire
subscription.first_charge_date
string
"subscription.first_charge_date": "2020-05-15T00:00:00"
Date of the first charge for subscription
subscription.has_queued_charges
number
"subscription.has_queued_charges": 1
Retrieves 1 if there is queued charge. Otherwise, retrieves 0.
subscription.id
number
"subscription.id": 10101
Unique numeric identifier for the subscription.
subscription.is_prepaid
boolean
"subscription.is_prepaid": 10101
Returns true if subscription is prepaid,
subscription.is_skippable
boolean
"is_skippable": true

Retrieves true or false if subscription is skippable. Boolean value.
subscription.is_swappable
boolean
"is_swappable": true

Retrieves true or false if subscription is swappable. Boolean value.
subscription.locked_pending_charge_id
boolean
"locked_pending_charge_id": 0
When non-null it prevents a subscription from being modified. The subscription’s locked_pending_charge_id is cleared (set to null) when Stripe calls Recharge webhook.
subscription.max_retries_reached
boolean
"subscription.max_retries_reached": 0
Retrieves 1 if charge has an error max retries reached. Otherwise, retrieves 0.
subscription.next_charge_scheduled_at
string
"subscription.next_charge_scheduled_at": "2018-12-23T00:00:00"
Next charge date of the subscription.
subscription.order_day_of_month
number
"subscription.order_day_of_month": null
This is the date customers will be charge after the initial charge. Subscription orders charge customers on the day they sign up and automatically skip the next billing cycle to avoid double-charging.
subscription.order_day_of_week
number
"subscription.order_day_of_week": 5
This is the date customers will be charge after the initial charge. Subscription orders charge customers on the day they sign up and automatically skip the next billing cycle to avoid double-charging.
subscription.order_interval_frequency
string
"subscription.order_interval_frequency":30
The number of units (specified in order_interval_unit) between each order. For example, "order_interval_unit": "month" and "order_interval_frequency": 3, indicate order every 3 months.
subscription.order_interval_unit
string
"subscription.order_interval_unit": "day"
The frequency with which a subscription should have order created. Valid values are “day”, “week” and “month”.
subscription.price
number
"subscription.price": 12
The price of the item before discounts, taxes, or shipping have been applied.
subscription.product
object
Returns product object.
subscription.product_title
string
"subscription.product_title": "Sumatra Coffee"
The name of the product in a shop’s catalog.
subscription.properties
string
"name": "grind"
"value": "drip"

A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself.
subscription.quantity
number
"subscription.quantity": 1
The number of items on the subscription.
subscription.recharge_product_id
number
"subscription.recharge_product_id": 660262
Unique number identifier of the product in Recharge.
subscription.shopify_product_id
number
"subscription.shopify_product_id": 1255183683
The id of the Shopify product.
subscription.shopify_variant_id
number
"subscription.shopify_variant_id": 3844924611
The id of the Shopify product variant.
subscription.sku
string
"subscription.sku": null
A unique identifier of the item in the fulfillment.
subscription.sku_override
boolean
"subscription.sku_override": false
Flag that is automatically updated to True when SKU is passed on create or update. When sku_override is True, the sku on the subscription will be used to generate charges and orders. When sku_override is False, Recharge will dynamically fetch the SKU from the corresponding shopify variant.
subscription.status
string
"subscription.status": "ACTIVE"
The status of the subscription. The valid values are “ACTIVE”, “CANCELLED”, “EXPIRED”, “ONETIME”.
subscription.updated_at
string
"subscription.updated_at": "2019-04-22T09:35:44"
The date and time when the subscription was last updated.
subscription.variant_title
string
"subscription.variant_title": "Milk - a / b"
The name of the variant in a shop’s catalog.
subscription.address
"address1": "101 Washington Street"
"address2": "204"
"cart_note": null
"city": "los angeles"
"company": "bootstrap"
"country": United States"
"created_at": "2019-04-30T15:25:20"
"customer_id": 8187626
"discount_id": null
"first_name": "Recharge"
"id": 7976732
"last_name": "Test"
"note_attributes": null
"phone": "5553103101"
"province": "California"
"shipping_lines_override": null
"updated_at": "2019-05-08T10:23:07"
"zip": "90025"
Returns Address object in retrieved subscription.

[GET] - List of subscriptions

GET /request_objects

(async () => {
  let schema = '{ "addresses": { "discount": { "id": "parent.discount_id" } }, "subscriptions": { "product": {} }, "onetimes": { "product": {} }, "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "addresses": { "discount": { "id": "parent.discount_id" } }, "subscriptions": { "product": {} }, "onetimes": { "product": {} }, "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects" + '?token=' + window.customerToken,
  type: "get",
  dataType: "json",
  data: {
    schema:
      '{ "addresses": { "discount": { "id": "parent.discount_id" } }, "subscriptions": { "product": {} }, "onetimes": { "product": {} }, "customer": {}, "settings": {}, "store": {} }',
  },
})
  .done(function (response) {
    // Successful request made
    console.log(response);
  })
  .fail(function (response) {
    // Request failed
    console.log(response);
  });

CLICK HERE TO SEE RESPONSE

{
   "addresses":[
      {
         "address1":"101 Washington Street",
         "address2":"204",
         "cart_note":"Updated phone",
         "city":"Los Angeles",
         "company":"Recharge",
         "country":"United States",
         "created_at":"2019-04-30T15:25:20",
         "customer_id":8187626,
         "discount":{
            "applies_to":null,
            "applies_to_id":null,
            "applies_to_product_type":"ALL",
            "applies_to_resource":null,
            "channel_settings": {
               "api": {"can_apply": true},
               "checkout_page": {"can_apply": true},
               "customer_portal": {"can_apply": true},
               "merchant_portal": {"can_apply": true},
            },
            "code":"20 % to all product",
            "created_at":"2018-11-21T15:19:43",
            "discount_type":"percentage",
            "duration":"forever",
            "duration_usage_limit":null,
            "ends_at":null,
            "first_time_customer_restriction": null,
            "id":10986334,
            "once_per_customer":false,
            "prerequisite_subtotal_min": null,
            "starts_at":"2018-11-21T00:00:00",
            "status":"enabled",
            "times_used":0,
            "updated_at":"2018-11-21T16:19:43",
            "usage_limit":null,
            "value":20.0
         },
         "discount_id":10986334,
         "first_name":"John",
         "id":32172754,
         "include": {
            "payment_methods": []
         },
         "last_name":"Doe",
         "note_attributes": [],
         "phone":"5553102221",
         "province":"California",
         "shipping_lines_override":null,
         "updated_at":"2019-05-02T14:18:05",
         "zip":"90025"
      },
      {
         "address1":"101 Washington Street",
         "address2":null,
         "cart_note":null,
         "city":"Los Angeles",
         "company":null,
         "country":"United States",
         "created_at":"2019-04-30T15:11:43",
         "customer_id":8187626,
         "discount":{

         },
         "discount_id":null,
         "first_name":"John",
         "id":32172457,
         "include": {
            "payment_methods": []
         },
         "last_name":"Doe",
         "note_attributes": [],
         "phone":"5553103101",
         "province":"California",
         "shipping_lines_override":null,
         "updated_at":"2019-04-30T15:11:43",
         "zip":"90025"
      },
      ...
   ],
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      }, 
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":3,
      "number_subscriptions":14,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-04-30T15:11:43"
   },
   "onetimes":[
      {
         "address_id":18586680,
         "created_at":"2019-04-22T09:50:39",
         "customer_id":8187626,
         "id":42012667,
         "next_charge_scheduled_at":"2019-12-26T00:00:00",
         "price":30.0,
         "product":{
            "collection_id": 291945,
            "created_at": "2019-07-09T10:25:17",
            "discount_amount": 0,
            "discount_type": "percentage",
            "handle": "brain-freeze",
            "id": 1248212,
            "images": {
                "large": "https://cdn.shopify.com/s/files/1/092/3765/969/products/1_f4b10f24-c0dd-653-a588-db9aa3648dbf_large.jpg",
                "medium": "https://cdn.shopify.com/s/files/1/092/3765/969/products/1_f4b10f24-c0dd-653-a588-db9aa3648dbf_medium.jpg",
                "original": "https://cdn.shopify.com/s/files/1/092/3765/969/products/1_f4b10f24-c0dd-653-a588-db9aa3648dbf.jpg",
                "small": "https://cdn.shopify.com/s/files/1/092/3765/969/products/1_f4b10f24-c0dd-653-a588-db9aa3648dbf_small.jpg",
            },
            "inventory_policy": {
                "one_time": "1",
                "subscription": "1"
            },
            "shopify_details": {
                "body_html": "Perfect for hot weather. If you want to cool yourself and find some peace, then Brain freeze is the perfect choice.",
                "created_at": "2019-07-09T10:23:05-04:00",
                "handle": "brain-freeze",
                "image": {
                    "alt": null,
                    "created_at": "2019-07-09T10:23:08-04:00",
                    "height": 720,
                    "position": 1,
                    "shopify_id": 11492393843635,
                    "shopify_product_id": 1999758540003,
                    "shopify_variant_ids": [],
                    "src": "https://cdn.shopify.com/s/files/1/092/3765/969/products/1_f4b10f24-c0dd-4653-a588-db9a3648dbf.jpg?v=1562682188",
                    "updated_at": "2019-07-09T10:23:08-04:00",
                    "width": 1280,
                },
                "images": [
                    {
                        "alt": null,
                        "created_at": "2019-07-09T10:23:08-04:00",
                        "height": 720,
                        "position": 1,
                        "shopify_id": 11492395823635,
                        "shopify_product_id": 1999758590303,
                        "shopify_variant_ids": [],
                        "src": "https://cdn.shopify.com/s/files/1/092/3765/969/products/1_f4b10f24-c0dd-4653-a88-db9aa3648dbf.jpg?v=1562682188",
                        "updated_at": "2019-07-09T10:23:08-04:00",
                        "width": 1280
                    }
                ],
                "options": [
                    {
                        "name": "Title",
                        "position": 1,
                        "shopify_id": 2722627540019,
                        "shopify_product_id": 1939758590003,
                        "values":[
                        "Default Title"
                        ]
                    }
                ],
                "product_type": "",
                "published_at": "2019-07-09T10:18:32-04:00",
                "shopify_id": 1999752590003,
                "tags": "",
                "title": "Brain freeze",
                "updated_at": "2019-08-19T12:39:17-04:00",
                "variants": [
                    {
                        "barcode": "",
                        "compare_at_price": null,
                        "created_at": "2019-07-09T10:23:05-04:00",
                        "fulfillment_service": "manual",
                        "grams": 136,
                        "inventory_management": "shopify",
                        "inventory_policy": "deny",
                        "inventory_quantity": 0,
                        "option1": "Default Title",
                        "option2": null,
                        "option3": null,
                        "position": 1,
                        "presentment_prices": null,
                        "price": "5.00",
                        "requires_shipping": true,
                        "shopify_id": 17912730422835,
                        "shopify_image_id": null,
                        "shopify_product_id": 1999758590703,
                        "sku": "004",
                        "taxable": true,
                        "title": "Default Title",
                        "updated_at": "2019-08-19T12:39:17-04:00",
                        "weight": 0.3,
                        "weight_unit": "lb",
                    }
                ],
                "vendor": "The best Belgrade ice-cream"
            },
            "shopify_product_id": 1999758520003,
            "subscription_defaults": {
                "charge_interval_frequency": 3,
                "cutoff_day_of_month": null,
                "cutoff_day_of_week": null,
                "expire_after_specific_number_of_charges": null,
                "modifiable_properties": [],
                "number_charges_until_expiration": null,
                "order_day_of_month": 5,
                "order_day_of_week": null,
                "order_interval_frequency_options": ["1"],
                "order_interval_unit": "Months",
                "storefront_purchase_options": "subscription_only"
            },
            "title": "Brain freeze",
            "updated_at": "2019-08-19T12:39:17",
         },
         "product_title":"Relax Box Subscription",
         "properties":[

         ],
         "quantity":1,
         "recharge_product_id":null,
         "shopify_product_id":505967476800,
         "shopify_variant_id":5423480635456,
         "sku":null,
         "status":"ONETIME",
         "updated_at":"2019-04-22T09:50:39",
         "variant_title":"Relax Box Subscription",
      },
      {
         "address_id":18586680,
         "created_at":"2019-03-22T16:24:20",
         "customer_id":8187626,
         "id":39764654,
         "next_charge_scheduled_at":null,
         "price":12.99,
         "product":{
            "collection_id":106910,
            "created_at":"2018-02-16T10:34:04",
            "discount_amount":20.0,
            "discount_type":"percentage",
            "handle":"bare-sleep",
            "id":659857,
            "images":{
               "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_large.jpg",
               "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_medium.jpg",
               "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg",
               "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_small.jpg"
            },
            "inventory_policy":{
               "one_time":"1",
               "subscription":"1"
            },
            "shopify_details":{
               "body_html":"<p>Having trouble sleeping? Get a restful night's sleep with a beautiful blend of organic, raw ingredients. Natural melatonin and vitamin B6 to help you catch some zzz's.</p>\n<p>Ingredients:</p>\n<ul>\n<li>Natural melatonin</li>\n<li>Vitamin B6</li>\n<li>St. John's wort</li>\n<li>Magnesium</li>\n<li>Passion flower</li>\n</ul>",
               "created_at":"2018-02-15T14:12:50-05:00",
               "handle":"bare-sleep",
               "image":{
                  "alt":null,
                  "created_at":"2018-02-15T17:50:46-05:00",
                  "height":1060,
                  "position":1,
                  "shopify_id":1553517019200,
                  "shopify_product_id":505545949248,
                  "shopify_variant_ids":[

                  ],
                  "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg?v=1518735046",
                  "updated_at":"2018-02-15T17:50:46-05:00",
                  "width":1060
               },
               "images":[
                  {
                     "alt":null,
                     "created_at":"2018-02-15T17:50:46-05:00",
                     "height":1060,
                     "position":1,
                     "shopify_id":1553517019200,
                     "shopify_product_id":505545949248,
                     "shopify_variant_ids":[

                     ],
                     "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg?v=1518735046",
                     "updated_at":"2018-02-15T17:50:46-05:00",
                     "width":1060
                  }
               ],
               "options":[
                  {
                     "name":"Title",
                     "position":1,
                     "shopify_id":650547494976,
                     "shopify_product_id":505545949248,
                     "values":[
                        "Default Title"
                     ]
                  }
               ],
               "product_type":"",
               "published_at":"2018-02-15T14:12:08-05:00",
               "shopify_id":505545949248,
               "tags":"",
               "title":"Bare Sleep",
               "updated_at":"2019-03-27T15:30:20-04:00",
               "variants":[
                  {
                     "barcode":"",
                     "compare_at_price":null,
                     "created_at":"2018-02-15T14:12:51-05:00",
                     "fulfillment_service":"manual",
                     "grams":907,
                     "inventory_management":null,
                     "inventory_policy":"deny",
                     "inventory_quantity":-38,
                     "option1":"Default Title",
                     "option2":null,
                     "option3":null,
                     "position":1,
                     "presentment_prices":null,
                     "price":"12.99",
                     "requires_shipping":true,
                     "shopify_id":5421270171712,
                     "shopify_image_id":null,
                     "shopify_product_id":505545949248,
                     "sku":"12347",
                     "taxable":true,
                     "title":"Default Title",
                     "updated_at":"2019-04-25T18:51:05-04:00",
                     "weight":32.0,
                     "weight_unit":"oz"
                  }
               ],
               "vendor":"bare-supplements"
            },
            "shopify_product_id":505545949248,
            "subscription_defaults":{
               "charge_interval_frequency":1,
               "cutoff_day_of_month":null,
               "cutoff_day_of_week":null,
               "expire_after_specific_number_of_charges":null,
               "number_charges_until_expiration":null,
               "order_day_of_month":14,
               "order_day_of_week":null,
               "order_interval_frequency_options":[
                  "1",
                  "2",
                  "3",
                  "6"
               ],
               "order_interval_unit":"Months",
               "storefront_purchase_options":"subscription_and_onetime"
            },
            "title":"Bare Sleep",
            "updated_at":"2019-0is_prepaid3-15T11:57:45"
         },
         "product_title":"Bare Sleep  20.00% Off Auto renew",
         "properties":[

         ],
         "quantity":1,
         "recharge_product_id":659857,
         "shopify_product_id":505545949248,
         "shopify_variant_id":5421270171712,
         "sku":null,
         "status":"ONETIME",
         "updated_at":"2019-04-22T09:35:58",
         "variant_title":""
      },
      ...
   ],
   "subscriptions":[
      {
         "address_id":18586680,
         "analytics_data": {
            "utm_params": []
         },
         "cancellation_reason":null,
         "cancellation_reason_comments":null,
         "cancelled_at":null,
         "charge_delay": null,
         "charge_interval_frequency":"20",
         "created_at":"2019-04-22T09:48:22",
         "customer_id":8187626,
         "cutoff_day_of_month_before_and_after": null,
         "cutoff_day_of_week_before_and_after": null,
         "email": "johndoe@gmail.com"
         "expire_after_specific_number_of_charges":null,
         "first_charge_date": "2020-01-15T00:00:00",
         "has_queued_charges":1,
         "id":42012593,
         "is_prepaid": false,
         "is_skippable": true,
         "is_swappable": true,
         "locked_pending_charge_id"0,
         "max_retries_reached":0,
         "next_charge_scheduled_at":"2019-12-26T00:00:00",
         "order_day_of_month":null,
         "order_day_of_week":null,
         "order_interval_frequency":"20",
         "order_interval_unit":"day",
         "price":27.0,
         "product":{
            "collection_id":199120,
            "created_at":"2019-03-27T15:45:48",
            "discount_amount":10.0,
            "discount_type":"percentage",
            "handle":"sleep-box",
            "id":1175780,
            "images":{
               "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep-box_large.jpg",
               "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep-box_medium.jpg",
               "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep-box.jpg",
               "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep-box_small.jpg"
            },
            "inventory_policy":{
               "one_time":"1",
               "subscription":"1"
            },
            "shopify_details":{
               "body_html":"Catch some zzz's with the Bare Sleep Box. We'll send you a monthly gift box filled with Bare Sleep supplements, eye masks, essential oil pillow spray, cleansing face cream, and everything else you need for a good night's sleep.",
               "created_at":"2018-02-16T08:59:02-05:00",
               "handle":"sleep-box",
               "image":{
                  "alt":null,
                  "created_at":"2018-02-16T08:59:04-05:00",
                  "height":1060,
                  "position":1,
                  "shopify_id":1555100041280,
                  "shopify_product_id":505978880064,
                  "shopify_variant_ids":[

                  ],
                  "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep-box.jpg?v=1518789544",
                  "updated_at":"2018-02-16T08:59:04-05:00",
                  "width":1060
               },
               "images":[
                  {
                     "alt":null,
                     "created_at":"2018-02-16T08:59:04-05:00",
                     "height":1060,
                     "position":1,
                     "shopify_id":1555100041280,
                     "shopify_product_id":505978880064,
                     "shopify_variant_ids":[

                     ],
                     "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep-box.jpg?v=1518789544",
                     "updated_at":"2018-02-16T08:59:04-05:00",
                     "width":1060
                  }
               ],
               "options":[
                  {
                     "name":"Title",
                     "position":1,
                     "shopify_id":651181981760,
                     "shopify_product_id":505978880064,
                     "values":[
                        "Default Title"
                     ]
                  }
               ],
               "product_type":"",
               "published_at":"2018-02-16T08:48:22-05:00",
               "shopify_id":505978880064,
               "tags":"",
               "title":"Sleep Box",
               "updated_at":"2019-03-27T15:46:10-04:00",
               "variants":[
                  {
                     "barcode":"",
                     "compare_at_price":null,
                     "created_at":"2018-02-16T08:59:02-05:00",
                     "fulfillment_service":"manual",
                     "grams":1814,
                     "inventory_management":null,
                     "inventory_policy":"deny",
                     "inventory_quantity":1,
                     "option1":"Default Title",
                     "option2":null,
                     "option3":null,
                     "position":1,
                     "presentment_prices":null,
                     "price":"30.00",
                     "requires_shipping":true,
                     "shopify_id":5423555936320,
                     "shopify_image_id":null,
                     "shopify_product_id":505978880064,
                     "sku":"222",
                     "taxable":true,
                     "title":"Default Title",
                     "updated_at":"2019-03-27T15:46:10-04:00",
                     "weight":4.0,
                     "weight_unit":"lb"
                  }
               ],
               "vendor":"bare-supplements"
            },
            "shopify_product_id":505978880064,
            "subscription_defaults":{
               "charge_interval_frequency":6,
               "cutoff_day_of_month":null,
               "cutoff_day_of_week":null,
               "expire_after_specific_number_of_charges":null,
               "modifiable_properties": [],
               "number_charges_until_expiration":null,
               "order_day_of_month":0,
               "order_day_of_week":null,
               "order_interval_frequency_options":[
                  "6"
               ],
               "order_interval_unit":"Months",
               "storefront_purchase_options":"subscription_and_onetime"
            },
            "title":"Sleep Box",
            "updated_at":"2019-03-27T15:46:10"
         },
         "product_title":"Sleep Box  10.00% Off Auto renew",
         "properties":[

         ],
         "quantity":1,
         "recharge_product_id":1175780,
         "shopify_product_id":505978880064,
         "shopify_variant_id":5423555936320,
         "sku":null,
         "sku_override":false,
         "status":"ACTIVE",
         "updated_at":"2019-04-22T09:55:18",
         "variant_title":"Sleep Box"
      },
      {
         "address_id":7976732,
         "analytics_data": {
            "utm_params": []
         },
         "cancellation_reason":"I already have more than I need",
         "cancellation_reason_comments":"Some comment here",
         "cancelled_at":null,
         "charge_delay": null,
         "charge_interval_frequency":"1",
         "created_at":"2019-04-03T09:20:28",
         "customer_id":8187626,
         "cutoff_day_of_month_before_and_after": null,
         "cutoff_day_of_week_before_and_after": null,
         "email": "johndoe@gmail.com"
         "expire_after_specific_number_of_charges":null,
         "first_charge_date": "2020-01-15T00:00:00",
         "has_queued_charges":0,
         "id":40628734,
         "is_prepaid": false,
         "is_skiipable": true,
         "is_swappable": false,
         "max_retries_reached":0,
         "next_charge_scheduled_at":null,
         "order_day_of_month":null,
         "order_day_of_week":null,
         "order_interval_frequency":"1",
         "order_interval_unit":"month",
         "price":11.4,
         "product":{
            "collection_id":106965,
            "created_at":"2018-02-16T15:55:41",
            "discount_amount":5.0,
            "discount_type":"percentage",
            "handle":"free-trial-bare-energy",
            "id":660262,
            "images":{
               "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/energy_large.jpg",
               "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/energy_medium.jpg",
               "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/energy.jpg",
               "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/energy_small.jpg"
            },
            "inventory_policy":{
               "one_time":"1",
               "subscription":"1"
            },
            "shopify_details":{
               "body_html":"<meta charset=\"utf-8\">\n<p>Subscribe for 3 months and receive the first month free.<br><br>Packed with vitamins and roots, these gummy supplements will help you recharge and energize. One supplement per day will help your mind and body stay alert and read to conquer the world.\u00a0</p>\n<p>Ingredients:</p>\n<ul>\n<li>Calcium</li>\n<li>B12</li>\n<li>Guarana</li>\n</ul>",
               "created_at":"2018-02-16T15:54:53-05:00",
               "handle":"free-trial-bare-energy",
               "image":{
                  "alt":null,
                  "created_at":"2018-02-16T15:54:55-05:00",
                  "height":1060,
                  "position":1,
                  "shopify_id":1556209008704,
                  "shopify_product_id":506206715968,
                  "shopify_variant_ids":[

                  ],
                  "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/energy.jpg?v=1518814495",
                  "updated_at":"2018-02-16T15:54:55-05:00",
                  "width":1060
               },
               "images":[
                  {
                     "alt":null,
                     "created_at":"2018-02-16T15:54:55-05:00",
                     "height":1060,
                     "position":1,
                     "shopify_id":1556209008704,
                     "shopify_product_id":506206715968,
                     "shopify_variant_ids":[

                     ],
                     "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/energy.jpg?v=1518814495",
                     "updated_at":"2018-02-16T15:54:55-05:00",
                     "width":1060
                  }
               ],
               "options":[
                  {
                     "name":"Title",
                     "position":1,
                     "shopify_id":651454382144,
                     "shopify_product_id":506206715968,
                     "values":[
                        "Default Title"
                     ]
                  }
               ],
               "product_type":"",
               "published_at":"2018-02-16T15:54:24-05:00",
               "shopify_id":506206715968,
               "tags":"",
               "title":"Free Trial - Bare Energy 3 Month Subscription",
               "updated_at":"2019-03-27T15:30:21-04:00",
               "variants":[
                  {
                     "barcode":"",
                     "compare_at_price":null,
                     "created_at":"2018-02-16T15:54:53-05:00",
                     "fulfillment_service":"manual",
                     "grams":907,
                     "inventory_management":null,
                     "inventory_policy":"deny",
                     "inventory_quantity":-3,
                     "option1":"Default Title",
                     "option2":null,
                     "option3":null,
                     "position":1,
                     "presentment_prices":null,
                     "price":"12.00",
                     "requires_shipping":true,
                     "shopify_id":5424766091328,
                     "shopify_image_id":null,
                     "shopify_product_id":506206715968,
                     "sku":"",
                     "taxable":true,
                     "title":"Default Title",
                     "updated_at":"2019-05-05T03:42:55-04:00",
                     "weight":32.0,
                     "weight_unit":"oz"
                  }
               ],
               "vendor":"bare-supplements"
            },
            "shopify_product_id":506206715968,
            "subscription_defaults":{
               "charge_interval_frequency":2,
               "cutoff_day_of_month":null,
               "cutoff_day_of_week":null,
               "expire_after_specific_number_of_charges":null,
               "number_charges_until_expiration":null,
               "order_day_of_month":null,
               "order_day_of_week":null,
               "order_interval_frequency_options":[
                  "2",
                  "1"
               ],
               "order_interval_unit":"Weeks",
               "storefront_purchase_options":"subscription_and_onetime"
            },
            "title":"Free Trial - Bare Energy",
            "updated_at":"2019-03-13T09:47:37"
         },
         "product_title":"Free Trial - Bare Energy  Auto renew",
         "properties":[

         ],
         "quantity":1,
         "recharge_product_id":660262,
         "shopify_product_id":506206715968,
         "shopify_variant_id":5424766091328,
         "sku":null,
         "sku_override":false,
         "status":"CANCELLED",
         "updated_at":"2019-04-22T09:35:44",
         "variant_title":""
      },
      ...
   ],
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with a list of subscriptions for customer.

URL: {{ subscription_list_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/subscriptions?token=${window.customerToken}

Template file: subscriptions.html

Schema: '{ addresses": { "discount": { "id": "parent.discount_id" } }, "subscriptions": { "products": {} }, "onetimes": { "products": {} }, "customer": {}, "settings": {}, "store": {} }'

Available template objects:

[GET] - New subscription form

GET /request_objects

(async () => {
  let schema = '{ "settings": {}, "addresses": { "subscriptions": { "address_id": <int:address.id> } }, "product": { "shopify_product_id": <int:shopify_product_id>, "base_source": "store_settings" }, "customer": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "settings": {}, "addresses": { "subscriptions": { "address_id": <int:address.id> } }, "product": { "shopify_product_id": <int:shopify_product_id>, "base_source": "store_settings" }, "customer": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects" + '?token=' + window.customerToken,
  type: "get",
  dataType: "json",
  data: {
    schema:
      '{ "settings": {}, "addresses": { "subscriptions": { "address_id": <int:address.id> } }, "product": { "shopify_product_id": <int:shopify_product_id>, "base_source": "store_settings" }, "customer": {}, "store": {} }',
  },
})
  .done(function (response) {
    // Successful request made
    console.log(response);
  })
  .fail(function (response) {
    // Request failed
    console.log(response);
  });

CLICK HERE TO SEE RESPONSE

{
   "addresses":[
      {
         "address1":"101 Washington Street",
         "address2":"204",
         "cart_note":"Updated phone",
         "city":"Los Angeles",
         "company":"Recharge",
         "country":"United States",
         "created_at":"2019-04-30T15:25:20",
         "customer_id":8187626,
         "discount_id":null,
         "first_name":"John",
         "id":32172754,
         "include": {
            "payment_methods": []
         },
         "last_name":"Doe",
         "note_attributes":null,
         "phone":"5553102221",
         "province":"California",
         "shipping_lines_override":null,
         "subscriptions":[
            {
               "address_id":32172754,
               "analytics_data": {
                  "utm_params": []
               },
               "cancellation_reason":null,
               "cancellation_reason_comments":null,
               "cancelled_at":null,
               "charge_delay": null,
               "charge_interval_frequency":"1",
               "created_at":"2019-05-06T11:00:14",
               "customer_id":8187626,
               "cutoff_day_of_month_before_and_after": null,
               "cutoff_day_of_week_before_and_after": null,
               "email": "johndoe@gmail.com",
               "expire_after_specific_number_of_charges":null,
               "first_charge_date": "2020-01-15T00:00:00",
               "has_queued_charges":0,
               "id":42594533,
               "is_prepaid": false,
               "is_skippable": true,
               "is_swappable": true,
               "locked_pending_charge_id"0,
               "max_retries_reached":0,
               "next_charge_scheduled_at":null,
               "order_day_of_month":null,
               "order_day_of_week":null,
               "order_interval_frequency":"1",
               "order_interval_unit":"month",
               "price":70.0,
               "product_title":"Bare Box - 3 Month Plan",
               "properties":[

               ],
               "quantity":1,
               "recharge_product_id":1175780,
               "shopify_product_id":505978880064,
               "shopify_variant_id":5423555936320,
               "sku":null,
               "sku_override":false,
               "status":"ACTIVE",
               "updated_at":"2019-05-06T11:00:14",
               "variant_title":"Sleep Box"
            },
            ...
         ],
         "updated_at":"2019-05-02T14:18:05",
         "zip":"90025"
      },
      ...
   ],
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },
      "can_add_payment_method"false,
      "created_at":"2018-02-21T11:45:58",
      "email":"john.doe@test.com",
      "first_charge_processed_at":"2018-02-21T11:46:02",
      "first_name":"John",
      "has_card_error_in_dunning":false,
      "hash":"818762670d14f56b6f39fd7",
      "id":8187626,
      "include": {
         "payment_methods": []
      },
      "last_name":"Doe",
      "number_active_subscriptions":6,
      "number_subscriptions":17,
      "shopify_customer_id":"391100760128",
      "updated_at":"2019-05-06T11:00:16"
   },
   "product":{
      "collection_id":106920,
      "created_at":"2018-02-16T11:05:55",
      "discount_amount":0.0,
      "discount_type":"percentage",
      "handle":"bare-box-3-month-plan",
      "id":659929,
      "images":{
         "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_large.jpg",
         "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_medium.jpg",
         "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg",
         "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db_small.jpg"
      },
      "inventory_policy":{
         "one_time":"1",
         "subscription":"1"
      },
      "shopify_details":{
         "body_html":"<meta charset=\"utf-8\"><span>Looking to mix things up? Every month we'll send you a surprise box filled with all kinds of natural and organic goodies. Each box will contain speciality supplements, beauty supplies,\u00a0clothes and accessories, and many more products\u00a0to help you live your best life. All products are ethically and humanely sourced.</span>",
         "created_at":"2018-02-16T11:01:02-05:00",
         "handle":"bare-box-3-month-plan",
         "image":{
            "alt":null,
            "created_at":"2018-02-16T11:01:05-05:00",
            "height":1060,
            "position":1,
            "shopify_id":1555302776896,
            "shopify_product_id":506020921408,
            "shopify_variant_ids":[

            ],
            "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg?v=1518796865",
            "updated_at":"2018-02-16T11:01:05-05:00",
            "width":1060
         },
         "images":[
            {
               "alt":null,
               "created_at":"2018-02-16T11:01:05-05:00",
               "height":1060,
               "position":1,
               "shopify_id":1555302776896,
               "shopify_product_id":506020921408,
               "shopify_variant_ids":[

               ],
               "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/surprise-box_7facd505-3d76-4ce9-8f33-99146e2fd4db.jpg?v=1518796865",
               "updated_at":"2018-02-16T11:01:05-05:00",
               "width":1060
            }
         ],
         "options":[
            {
               "name":"T-Shirt Size",
               "position":1,
               "shopify_id":651242111040,
               "shopify_product_id":506020921408,
               "values":[
                  "x-small",
                  "small",
                  "medium",
                  "large",
                  "x-large"
               ]
            }
         ],
         "product_type":"",
         "published_at":"2018-02-16T10:59:15-05:00",
         "shopify_id":506020921408,
         "tags":"",
         "title":"Bare Box - 3 Month Plan",
         "updated_at":"2019-03-27T15:30:20-04:00",
         "variants":[
            {
               "barcode":"",
               "compare_at_price":null,
               "created_at":"2018-02-16T11:01:03-05:00",
               "fulfillment_service":"manual",
               "grams":1814,
               "inventory_management":null,
               "inventory_policy":"deny",
               "inventory_quantity":-24,
               "option1":"x-small",
               "option2":null,
               "option3":null,
               "position":1,
               "presentment_prices":null,
               "price":"70.00",
               "requires_shipping":true,
               "shopify_id":5424189177920,
               "shopify_image_id":null,
               "shopify_product_id":506020921408,
               "sku":"",
               "taxable":true,
               "title":"x-small",
               "updated_at":"2019-05-05T12:57:26-04:00",
               "weight":4.0,
               "weight_unit":"lb"
            },
            {
               "barcode":"",
               "compare_at_price":null,
               "created_at":"2018-02-16T11:01:03-05:00",
               "fulfillment_service":"manual",
               "grams":1814,
               "inventory_management":null,
               "inventory_policy":"deny",
               "inventory_quantity":0,
               "option1":"small",
               "option2":null,
               "option3":null,
               "position":2,
               "presentment_prices":null,
               "price":"70.00",
               "requires_shipping":true,
               "shopify_id":5424189210688,
               "shopify_image_id":null,
               "shopify_product_id":506020921408,
               "sku":"",
               "taxable":true,
               "title":"small",
               "updated_at":"2019-03-13T16:37:26-04:00",
               "weight":4.0,
               "weight_unit":"lb"
            },
            ...
         ],
         "vendor":"bare-supplements"
      },
      "shopify_product_id":506020921408,
      "subscription_defaults":{
         "charge_interval_frequency":3,
         "cutoff_day_of_month":null,
         "cutoff_day_of_week":null,
         "expire_after_specific_number_of_charges":null,
         "modifiable_properties": [],
         "number_charges_until_expiration":null,
         "order_day_of_month":0,
         "order_day_of_week":null,
         "order_interval_frequency_options":[
            "1"
         ],
         "order_interval_unit":"Months",
         "storefront_purchase_options":"subscription_only"
      },
      "title":"Bare Box - 3 Month Plan",
      "updated_at":"2019-03-13T16:37:33"
   },
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",            
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with form for creating new subscription.

URL: {{ subscription_new_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/new?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/subscriptions/new?token=${window.customerToken}

Template file: subscription_new.html

Schema: '{ "settings": {}, "addresses": { "subscriptions": { "address_id": <int:address.id> } }, "product": { "shopify_product_id": <int:shopify_product_id>, "base_source": "store_settings" }, "customer": {}. "store": {} }'

Available template objects:

[POST] - Create subscription

POST /subscriptions

(async () => {
  let url = "{{ subscription_list_url }}" + '?token=' + window.customerToken;
  let data = {
    shopify_variant_id: "5423555936320",
    order_interval_frequency: "1",
    order_interval_unit: "month",
    charge_interval_frequency: 1,
    next_charge_scheduled_at: "2019-12-26",
    address_id: 32172754,
    quantity: 1,
    "properties[key-prop]": "value-prop",
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = "{{ subscription_list_url }}" + '?token=' + window.customerToken;
let data = {
  shopify_variant_id: "5423555936320",
  order_interval_frequency: "1",
  order_interval_unit: "month",
  charge_interval_frequency: 1,
  next_charge_scheduled_at: "2019-12-26",
  address_id: 32172754,
  quantity: 1,
  "properties[key-prop]": "value-prop",
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: "{{ subscription_list_url }}" + '?token=' + window.customerToken,
  type: "post",
  dataType: "json",
  data: {
    shopify_variant_id: "5423555936320",
    order_interval_frequency: "1",
    order_interval_unit: "month",
    charge_interval_frequency: 1,
    next_charge_scheduled_at: "2019-12-26",
    address_id: 32172754,
    quantity: 1,
    "properties[key-prop]": "value-prop",
  },
})
  .done(function (response) {
    // Successful request made
    console.log(response);
  })
  .fail(function (response) {
    // Request failed
    console.log(response);
  });

CLICK HERE TO SEE RESPONSE

{
   "subscription":{
      "address_id":32172754,
      "analytics_data": {
         "utm_params": []
      },
      "cancellation_reason":null,
      "cancellation_reason_comments":null,
      "cancelled_at":null,
      "charge_delay": null,
      "charge_interval_frequency":"1",
      "created_at":"2019-05-06T10:56:12",
      "customer_id":8187626,
      "cutoff_day_of_month_before_and_after": null,
      "cutoff_day_of_week_before_and_after": null,
      "email": "johndoe@gmail.com",
      "expire_after_specific_number_of_charges":null,
      "first_charge_date": "2020-05-30T00:00:00",
      "has_queued_charges":0,
      "id":42594371,
      "is_prepaid": false,
      "is_skippable": null,
      "is_swappable": null,
      "locked_pending_charge_id"0,
      "max_retries_reached":0,
      "next_charge_scheduled_at":null,
      "order_day_of_month":null,
      "order_day_of_week":null,
      "order_interval_frequency":"1",
      "order_interval_unit":"month",
      "price":70.0,
      "product_title":"Bare Box - 3 Month Plan",
      "properties":[
         "key-prop":"value-prop"
      ],
      "quantity":1,
      "recharge_product_id":1175780,
      "shopify_product_id":505978880064,
      "shopify_variant_id":5423555936320,
      "sku":null,
      "sku_override":false,
      "status":"ACTIVE",
      "updated_at":"2019-05-06T10:56:12",
      "variant_title":"Sleep Box"
   }
}

This endpoint creates a new subscription for customer.

URL: {{ subscription_list_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/subscriptions?token=${window.customerToken}

Template file: subscription_new.html

Available template objects:

Arguments accepted:

Property Type
Shopify variant ID * number
Order interval frequency * string
Order interval unit * string
Charge interval frequency * number
Next charge date * string
Address ID * number
Quantity * number
Properties string

* = required

[POST] - Bulk create subscriptions

POST /addresses/<int:address_id>/subscriptions-bulk-create


// Bulk create subscriptions object
/*
let dataToSend = {
  subscriptions: [
    {
      "charge_interval_frequency": "30",
      "next_charge_scheduled_at": "2020-05-09",
      "order_interval_frequency": "30",
      "order_interval_unit": "day",
      "quantity": 1,
      "shopify_variant_id": 31771123454883
    },
    {
      "charge_interval_frequency": "3",
      "next_charge_scheduled_at": "2020-05-10",
      "order_interval_frequency": "3",
      "order_interval_unit": "week",
      "quantity": 1,
      "shopify_variant_id": 31771543214883
    },
  ]
}
*/
(async () => {
  let url = "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash}}/addresses/<int:address_id>/subscriptions-bulk-create" + '?token=' + window.customerToken;
  let data = JSON.stringify(dataToSend);

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);           
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash}}/addresses/<int:address_id>/subscriptions-bulk-create" + '?token=' + window.customerToken;
let data = JSON.stringify(dataToSend);
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: data
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
      // Request failed
    console.error(error);
  });
$.ajax({
  url: "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash}}/addresses/<int:address_id>/subscriptions-bulk-create" + '?token=' + window.customerToken,
  type: "post",
  dataType: "json",
  contentType: 'application/json',
  data: JSON.stringify(dataToSend)
})
  .done(function (response) {
    // Successful request made
    console.log(response);
  })
  .fail(function (response) {
    // Request failed
    console.log(response);
  });

CLICK HERE TO SEE RESPONSE

{
   "subscriptions":[
      {
         "address_id": 34143969,
         "analytics_data": {
            "utm_params": []
         },
         "cancellation_reason": null,
         "cancellation_reason_comments": null,
         "cancelled_at": null,
         "charge_delay": null,
         "charge_interval_frequency": "4",
         "created_at": "2020-04-10T07:46:22",
         "customer_id": 30369811,
         "cutoff_day_of_month_before_and_after": null,
         "cutoff_day_of_week_before_and_after": null,
         "email": "johndoe@gmail.com",
         "expire_after_specific_number_of_charges": null,
         "first_charge_date": "2020-05-10T00:00:00",
         "has_queued_charges": 1,
         "id": 71689295,
         "is_prepaid": false,
         "is_skippable": true,
         "is_swappable": true,
         "locked_pending_charge_id"0,
         "max_retries_reached": 0,
         "next_charge_scheduled_at": "2020-05-10T00:00:00",
         "order_day_of_month": 0,
         "order_day_of_week": null,
         "order_interval_frequency": "4",
         "order_interval_unit": "week",
         "price": 13.5,
         "product_title": "Chocolate - Raspberry fantasy  10.00% Off Auto renew",
         "properties": [],
         "quantity": 4,
         "recharge_product_id": 1246123,
         "shopify_product_id": 198245846232123,
         "shopify_variant_id": 178525122342123,
         "sku": "001",
         "sku_override": false,
         "status": "ACTIVE",
         "updated_at": "2020-04-14T15:29:33",
         "variant_title": "Default Title",
      },
      {
         "address_id": 34143969,
         "analytics_data": {
            "utm_params": []
         },
         "cancellation_reason": null,
         "cancellation_reason_comments": null,
         "cancelled_at": null,
         "charge_delay": null,
         "charge_interval_frequency": "4",
         "created_at": "2020-04-10T07:46:22",
         "customer_id": 30369811,
         "cutoff_day_of_month_before_and_after": null,
         "cutoff_day_of_week_before_and_after": null,
         "email": "johndoe@gmail.com",
         "expire_after_specific_number_of_charges": null,
         "first_charge_date": "2020-05-10T00:00:00",
         "has_queued_charges": 1,
         "id": 71689123,
         "is_prepaid": false,
         "is_skippable": true,
         "is_swappable": true,
         "max_retries_reached": 0,
         "next_charge_scheduled_at": "2020-05-12T00:00:00",
         "order_day_of_month": 0,
         "order_day_of_week": null,
         "order_interval_frequency": "4",
         "order_interval_unit": "week",
         "price": 13.5,
         "product_title": "Raspberry fantasy  10.00% Off Auto renew",
         "properties": [],
         "quantity": 4,
         "recharge_product_id": 1246147,
         "shopify_product_id": 19824584623259,
         "shopify_variant_id": 17852512234275,
         "sku": "001",
         "sku_override": false,
         "status": "ACTIVE",
         "updated_at": "2020-04-14T15:29:33",
         "variant_title": "Default Title",
      },
      {
         "address_id": 34143969,
         "analytics_data": {
            "utm_params": []
         },
         "cancellation_reason": null,
         "cancellation_reason_comments": null,
         "cancelled_at": null,
         "charge_delay": null,
         "charge_interval_frequency": "4",
         "created_at": "2020-04-10T07:46:22",
         "customer_id": 30369811,
         "cutoff_day_of_month_before_and_after": null,
         "cutoff_day_of_week_before_and_after": null,
         "email": "johndoe@gmail.com",
         "expire_after_specific_number_of_charges": null,
         "first_charge_date": "2020-05-12T00:00:00",
         "has_queued_charges": 1,
         "id": 71689456,
         "is_prepaid": false,
         "is_skippable": true,
         "is_swappable": true,
         "max_retries_reached": 0,
         "next_charge_scheduled_at": "2020-05-12T00:00:00",
         "order_day_of_month": 0,
         "order_day_of_week": null,
         "order_interval_frequency": "4",
         "order_interval_unit": "week",
         "price": 13.5,
         "product_title": "Chocolate 10.00% Off Auto renew",
         "properties": [],
         "quantity": 4,
         "recharge_product_id": 1246143,
         "shopify_product_id": 19824584623233,
         "shopify_variant_id": 17852512234233,
         "sku": "001",
         "sku_override": false,
         "status": "ACTIVE",
         "updated_at": "2020-04-14T15:29:33",
         "variant_title": "Default Title",
      },
   ]
}

This endpoint bulk create subscriptions.

URL: /tools/recurring/portal/{{ customer.hash }}/addresses/<int:address_id>/subscriptions-bulk-create

Methods accepted: POST

Arguments accepted:

Property Type
Shopify variant ID * number
Order interval frequency * string
Order interval unit * string
Charge interval frequency * number
Next charge date * string
Address ID * number
Quantity * number

* = required

[GET] - Retrieve subscription

GET /request_objects

(async () => {
  let schema = '{ "subscription": { "id": <int:subscription_id>, "address": {"id": <int:address_id> }, "product": { "shopify_product_id": <int:shopify_product_id>,      "base_source": "store_settings" } }, "payment_sources": {"customer_id": <int:customer_id> },  "customer": {}, "settings": {}, "store": {} }';
  let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;
  try {
    const response = await axios(url);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let schema = '{ "subscription": { "id": <int:subscription_id>, "address": {"id": <int:address_id> }, "product": { "shopify_product_id": <int:shopify_product_id>, "base_source": "store_settings" } }, "payment_sources": {"customer_id": <int:customer_id> },  "customer": {}, "settings": {}, "store": {} }';
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects?token=${window.customerToken}&schema=${schema}`;

fetch(url)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/request_objects" + '?token=' + window.customerToken,
  type: "get",
  dataType: "json",
  data: {
    schema:
      '{ "subscription": { "id": <int:subscription_id>, "address": {"id": <int:address_id> }, "product": { "shopify_product_id": <int:shopify_product_id>, "base_source": "store_settings" } }, "payment_sources": {"customer_id": <int:customer_id> },  "customer": {}, "settings": {}, "store": {} }',
    },
  })
  .done(function (response) {
    // Successful request made
    console.log(response);
  })
  .fail(function (response) {
    // Request failed
    console.log(response);
  });

CLICK HERE TO SEE RESPONSE

{
   "customer":{
      "accepts_marketing": null,
      "analytics_data": {
         "utm_params": []
      },
      "can_add_payment_method"false,
      "created_at":"2018-02-15T11:57:16",
      "email":"johndoe@gmail.com",
      "first_charge_processed_at":"2018-02-15T11:57:19",
      "first_name":"Recharge",
      "has_card_error_in_dunning":false,
      "hash":"80590367f65013980851042",
      "id":8059036,
      "include": {
         "payment_methods": []
      },
      "last_name":"Test",
      "number_active_subscriptions":1,
      "number_subscriptions":4,
      "shopify_customer_id":"299083169856",
      "updated_at":"2019-06-04T12:17:05"
   },
   "payment_sources":[
      {
         "billing_address":{
            "address1":"1933 Manning",
            "address2":"204",
            "city":"Los Angeles",
            "company":"bootstrap",
            "country":"United States",
            "first_name":"Recharge",
            "last_name":"Test",
            "phone":"3103103101",
            "province":"California",
            "zip":"90025"
         },
         "card_brand":null,
         "card_exp_month":null,
         "card_exp_year":null,
         "card_last4":null,
         "cardholder_name: null",
         "customer_id":8059036,
         "has_card_error_in_dunning":false,
         "id": "1",
         "payment_token": null,
         "payment_type":"credit",
         "processor_name":"stripe",
         "status":"active",
         "status_reason":null
      }
   ],
   "subscription":{
      "address":{
         "address1":"1933 Manning",
         "address2":"200",
         "cart_note":"None",
         "city":"Los Angeles",
         "company":"bootstrap",
         "country":"United States",
         "created_at":"2018-02-15T11:57:18",
         "customer_id":8059036,
         "discount_id":null,
         "first_name":"Recharge",
         "id":7846132,
         "last_name":"Test",
         "note_attributes":[

         ],
         "phone":"3103103101",
         "province":"California",
         "shipping_lines_override":null,
         "updated_at":"2019-01-30T14:43:27",
         "zip":"90025"
      },
      "address_id":7846132,
      "analytics_data": {
            "utm_params": []
         },
      "cancellation_reason":"Max Number of Charge attempts reached",
      "cancellation_reason_comments":null,
      "cancelled_at":null,
      "charge_delay": null,
      "charge_interval_frequency":"1",
      "created_at":"2019-01-30T13:42:15",
      "customer_id":8059036,
      "cutoff_day_of_month_before_and_after": null,
      "cutoff_day_of_week_before_and_after": null,
      "email": "johndoe@gmail.com",
      "expire_after_specific_number_of_charges":null,
      "first_charge_date": "2020-05-30T00:00:00",
      "has_queued_charges":0,
      "id":35565007,
      "is_prepaid": false,
      "is_skippable": true,
      "is_swappable": true,
      "max_retries_reached":0,
      "next_charge_scheduled_at":null,
      "order_day_of_month":null,
      "order_day_of_week":null,
      "order_interval_frequency":"1",
      "order_interval_unit":"month",
      "price":10.39,
      "product":{
         "collection_id":106910,
         "created_at":"2018-02-16T10:34:04",
         "discount_amount":20.0,
         "discount_type":"percentage",
         "handle":"bare-sleep",
         "id":659857,
         "images":{
            "large":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_large.jpg",
            "medium":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_medium.jpg",
            "original":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg",
            "small":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep_small.jpg"
         },
         "inventory_policy":{
            "one_time":"1",
            "subscription":"1"
         },
         "shopify_details":{
            "body_html":"<p>Having trouble sleeping? Get a restful night's sleep with a beautiful blend of organic, raw ingredients. Natural melatonin and vitamin B6 to help you catch some zzz's.</p>\n<p>Ingredients:</p>\n<ul>\n<li>Natural melatonin</li>\n<li>Vitamin B6</li>\n<li>St. John's wort</li>\n<li>Magnesium</li>\n<li>Passion flower</li>\n</ul>",
            "created_at":"2018-02-15T14:12:50-05:00",
            "handle":"bare-sleep",
            "image":{
               "alt":null,
               "created_at":"2018-02-15T17:50:46-05:00",
               "height":1060,
               "position":1,
               "shopify_id":1553517019200,
               "shopify_product_id":505545949248,
               "shopify_variant_ids":[

               ],
               "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg?v=1518735046",
               "updated_at":"2018-02-15T17:50:46-05:00",
               "width":1060
            },
            "images":[
               {
                  "alt":null,
                  "created_at":"2018-02-15T17:50:46-05:00",
                  "height":1060,
                  "position":1,
                  "shopify_id":1553517019200,
                  "shopify_product_id":505545949248,
                  "shopify_variant_ids":[

                  ],
                  "src":"https://cdn.shopify.com/s/files/1/3104/4618/products/sleep.jpg?v=1518735046",
                  "updated_at":"2018-02-15T17:50:46-05:00",
                  "width":1060
               }
            ],
            "options":[
               {
                  "name":"Title",
                  "position":1,
                  "shopify_id":650547494976,
                  "shopify_product_id":505545949248,
                  "values":[
                     "Default Title"
                  ]
               }
            ],
            "product_type":"",
            "published_at":"2018-02-15T14:12:08-05:00",
            "shopify_id":505545949248,
            "tags":"",
            "title":"Bare Sleep",
            "updated_at":"2019-03-27T15:30:20-04:00",
            "variants":[
               {
                  "barcode":"",
                  "compare_at_price":null,
                  "created_at":"2018-02-15T14:12:51-05:00",
                  "fulfillment_service":"manual",
                  "grams":907,
                  "inventory_management":null,
                  "inventory_policy":"deny",
                  "inventory_quantity":-66,
                  "option1":"Default Title",
                  "option2":null,
                  "option3":null,
                  "position":1,
                  "presentment_prices":null,
                  "price":"12.99",
                  "requires_shipping":true,
                  "shopify_id":5421270171712,
                  "shopify_image_id":null,
                  "shopify_product_id":505545949248,
                  "sku":"12347",
                  "taxable":true,
                  "title":"Default Title",
                  "updated_at":"2019-06-04T15:27:45-04:00",
                  "weight":32.0,
                  "weight_unit":"oz"
               }
            ],
            "vendor":"bare-supplements"
         },
         "shopify_product_id":505545949248,
         "subscription_defaults":{
            "charge_interval_frequency":1,
            "cutoff_day_of_month":null,
            "cutoff_day_of_week":null,
            "expire_after_specific_number_of_charges":null,
            "modifiable_properties": [],
            "number_charges_until_expiration":null,
            "order_day_of_month":14,
            "order_day_of_week":null,
            "order_interval_frequency_options":[
               "1",
               "2",
               "3",
               "6"
            ],
            "order_interval_unit":"Months",
            "storefront_purchase_options":"subscription_and_onetime"
         },
         "title":"Bare Sleep",
         "updated_at":"2019-03-15T11:57:45"
      },
      "product_title":"Bare Sleep  20.00% Off Auto renew",
      "properties":[
        {
          "name": "shipping_interval_frequency",
          "value": "1"
        },
        {
          "name": "shipping_interval_unit_type",
          "value": "Months"
        }
      ],
      "quantity":1,
      "recharge_product_id":659857,
      "shopify_product_id":505545949248,
      "shopify_variant_id":5421270171712,
      "sku":"12347",
      "sku_override":false,
      "status":"ACTIVE",
      "updated_at":"2019-06-04T12:17:01",
      "variant_title":""
   },
   "settings":{
      "customer_portal":{
         "custom_code":{
            "footer": "",
            "header": "",
            "header_logo_url": "",
         },
         "discount_input":true,
         "edit_shipping_address":true,
         "hosted_customer_portal":true,
         "inventory_behaviour":"bypass",
         "onetime":{
            "available_products":"recharge_products",
            "enabled":true,
            "shopify_collection_id":null,
            "zero_inventory_purchase":true
         },
         "subscription":{
            "add_product":true,
            "cancel_subscription":true,
            "cancellation_email_contact":"",
            "cancellation_minimum_order_count":0,
            "change_product":true,
            "change_quantity":true,
            "change_variant":true,
            "edit_order_frequency":"Any",
            "edit_scheduled_date":true,
            "reactivate_subscription":true,
            "skip_scheduled_order":true,
            "zero_inventory_purchase":true
         },
         "view_order_schedule":true,
         "view_recharge_payment_methods"false
      },
      "has_shopify_connector": false,
      "shop_id":41575
   },
   "store": {
      "checkout_logo_url""",
      "checkout_platform": "recharge",
      "created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
      "currency": "USD",
      "customer_portal_domain""",
      "domain": "store.myshopify.com",
      "email": "johndoe@gmail.com",
      "external_platform""shopify",
      "iana_timezone": "America/New_York",
      "id": 90732,
      "migrated_to_shopify_checkout_integration"0,
      "my_shopify_domain": "store.myshopify.com",
      "name": "mystore",
      "platform_domain""store.myshopify.com",
      "shop_email": "johndoe@gmail.com",
      "shop_phone": "",
      "timezone": "(GMT-05:00) America/New_York",
      "updated_at": "Thu, 17 Sep 2020 03:06:52 GMT"
   }
}

This endpoint renders a template with form for updating properties of the current subscription.

URL: {{ subscription_url }}

Methods accepted: GET

Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>?token=${window.customerToken}

Template file: subscription.html

Schema: '{ "subscription": { "id": <int:subscription_id>, "address": {"id": <int:address_id> }, "product": { "shopify_product_id": <int:shopify_product_id>, "base_source": "store_settings" } }, "payment_sources": {"customer_id": <int:customer_id> }, "customer": {}, "settings": {}, "store": {} }'

Available template objects:

[POST] - Update subscription

POST /subscriptions/<int:subscription_id>

(async () => {
  let url = "{{ subscription_url }}" + '?token=' + window.customerToken;
  let data = {
    charge_interval_frequency: "20",
    order_interval_frequency: "20",
    order_interval_unit: "day",
    quantity: "1",
    "properties[key-prop]": "value-prop",
  }

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = "{{ subscription_url }}" + '?token=' + window.customerToken;
let data = {
  charge_interval_frequency: "20",
  order_interval_frequency: "20",
  order_interval_unit: "day",
  quantity: "1",
  "properties[key-prop]": "value-prop",
}
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: "{{ subscription_url }}" + '?token=' + window.customerToken,
  type: "post",
  dataType: "json",
  data: {
    charge_interval_frequency: "20",
    order_interval_frequency: "20",
    order_interval_unit: "day",
    quantity: "1",
    "properties[key-prop]": "value-prop",
  },
})
  .done(function (response) {
    // Successful request made
    console.log(response);
  })
  .fail(function (response) {
    // Request failed
    console.log(response);
  });

CLICK HERE TO SEE RESPONSE

{
   "subscription":{
      "address_id":18586680,
      "analytics_data": {
            "utm_params": []
         },
      "cancellation_reason":null,
      "cancellation_reason_comments":null,
      "cancelled_at":null,
      "charge_delay": null,
      "charge_interval_frequency":"20",
      "created_at":"2019-04-22T09:48:22",
      "customer_id":8187626,
      "cutoff_day_of_month_before_and_after": null,
      "cutoff_day_of_week_before_and_after": null,
      "email": "johndoe@gmail.com",
      "expire_after_specific_number_of_charges":null,
      "first_charge_date": "2021-01-01T00:00:00",
      "has_queued_charges":1,
      "id":42012593,
      "is_prepaid": false,
      "is_skippable":null,
      "is_swappable":null,
      "locked_pending_charge_id"0,
      "max_retries_reached":0,
      "next_charge_scheduled_at":"2019-12-26T00:00:00",
      "order_day_of_month":null,
      "order_day_of_week":null,
      "order_interval_frequency":"20",
      "order_interval_unit":"day",
      "price":27.0,
      "product_title":"Sleep Box  10.00% Off Auto renew",
      "properties":[
         "key-prop":"value-prop"
      ],
      "quantity":1,
      "recharge_product_id":1175780,
      "shopify_product_id":505978880064,
      "shopify_variant_id":5423555936320,
      "sku":null,
      "sku_override":false,
      "status":"ACTIVE",
      "updated_at":"2019-05-06T12:46:52",
      "variant_title":"Sleep Box"
   }
}

This endpoint updates current subscription.

URL: {{ subscription_url }}

Methods accepted: POST

Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>?token=${window.customerToken}

Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>?token=${window.customerToken}

Template file: subscription.html

Available template objects:

Arguments accepted:

Property Type
Charge interval frequency string
Order interval frequency string
Order interval unit string
Quantity number
Properties string

[POST] - Bulk update subscription

POST /addresses/<int:address_id>/subscriptions-bulk-update

// Update quantity object 
/*
   let dataToSend = {
    "subscriptions":[
      {
        "id": "subscription.id",
        "quantity": "newQuantity"
      }
    ]
  }
*/

// Update address id object 
/*
   let dataToSend = {
    "subscriptions":[
      {
        "id": "subscription.id",
        "address_id": "newAddressId"
      }
    ]
   }
*/

// Update frequency object 
/*
  let dataToSend = {
    "subscriptions":[
      {
        "id": "subscription.id",
        "order_interval_unit": newOrderIntervalUnit,
        "order_interval_frequency": newOrderIntervalFrequency,
        "charge_interval_frequency": newChargeIntervalFrequency,
      }
    ]
  }
*/

// Update next charge date object 
/*
  let dataToSend = {
    "subscriptions":[
      {
        "id": "subscription.id",
        "next_charge_scheduled_at": nextChargeDate
      }
    ]
  }
*/

// Cancel subscriptions object
/*
  let dataToSend = {
    "subscriptions":[
      {
        "id": "subscription.id",
        "status": "CANCELLED",
        "cancellation_reason": newCancellationReason,
        "cancellation_reason_comments": newCancellationReasonComments,
      }
    ]
  }
*/

// Reactivate subscriptions object
/*
  let dataToSend = {
    "subscriptions":[
      {
        "id": "subscription.id",
        "status": "ACTIVE",
      }
    ]
  }
*/
(async () => {
  let url = '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/addresses/<int:address_id>/subscriptions-bulk-update' + '?token=' + window.customerToken;
  let data = JSON.stringify(dataToSend);

  try {
    const response = await axios.post(url, data);
    // Successful request made
    console.log(response.data);         
  } catch (error) {
    // Request failed
    console.error(error);
  }
})();
let url = '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/addresses/<int:address_id>/subscriptions-bulk-update' + '?token=' + window.customerToken;
let data = JSON.stringify(dataToSend);
let options = {
  method: "post",  
  headers: {
    'Content-Type': 'application/json'
  },
  body: data
}

fetch(url, options)
  .then((response) => response.json())
  .then((showData) => {
    // Successful request made
    console.log(showData);
  })
  .catch((error) => {
    // Request failed
    console.error(error);
  });
$.ajax({
  url: '{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/addresses/<int:address_id>/subscriptions-bulk-update' + '?token=' + window.customerToken,
  type: 'post',
  dataType: 'json',
  contentType: 'application/json',
  data: JSON.stringify(dataToSend)

}).done(function(response) {
  // Successful request made
  console.log(response);
}).fail(function(response) {
  // Request failed
  console.log(response);
});

CLICK HERE TO SEE RESPONSE

{
   "subscriptions":[
      {
         "address_id": 34143969,
         "analytics_data": {
            "utm_params": []
         },
         "cancellation_reason": null,
         "cancellation_reason_comments": null,
         "cancelled_at": null,
         "charge_delay": null,
         "charge_interval_frequency": "4",
         "created_at": "2020-04-10T07:46:22",
         "customer_id": 30369811,
         "cutoff_day_of_month_before_and_after": null,
         "cutoff_day_of_week_before_and_after": null,
         "email": "johndoe@gmail.com",
         "expire_after_specific_number_of_charges": null,
         "first_charge_date": "2020-05-10T00:00:00",
         "has_queued_charges": 1,
         "id": 71689295,
         "is_prepaid": false,
         "is_skippable": true,
         "is_swappable": true,
         "locked_pending_charge_id"0,
         "max_retries_reached": 0,
         "next_charge_scheduled_at": "2020-05-10T00:00:00",
         "order_day_of_month": 0,
         "order_day_of_week": null,
         "order_interval_frequency": "4",
         "order_interval_unit": "week",
         "price": 13.5,
         "product_title": "Chocolate - Raspberry fantasy  10.00% Off Auto renew",
         "properties": [],
         "quantity": 4,
         "recharge_product_id": 1246123,
         "shopify_product_id": 198245846232123,
         "shopify_variant_id": 178525122342123,
         "sku": "001",
         "sku_override": false,
         "status": "ACTIVE",
         "updated_at": "2020-04-14T15:29:33",
         "variant_title": "Default Title",
      },
      {
         "address_id": 34143969,
         "analytics_data": {
            "utm_params": []
         },
         "cancellation_reason": null,
         "cancellation_reason_comments": null,
         "cancelled_at": null,
         "charge_delay": null,
         "charge_interval_frequency": "4",
         "created_at": "2020-04-10T07:46:22",
         "customer_id": 30369811,
         "cutoff_day_of_month_before_and_after": null,
         "cutoff_day_of_week_before_and_after": null,
         "email": "johndoe@gmail.com",
         "expire_after_specific_number_of_charges": null,
         "first_charge_date": "2020-05-10T00:00:00",
         "has_queued_charges": 1,
         "id": 71689123,
         "is_prepaid": false,
         "is_skippable": true,
         "is_swappable": true,
         "max_retries_reached": 0,
         "next_charge_scheduled_at": "2020-05-12T00:00:00",