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);
});
Example querying all memberships for a customer.
(async () => {
let schema = '{ "memberships": [] }';
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 = '{ "memberships": [] }';
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: '{ "memberships": [] }' }
}).done(function(response) {
// Successful request made
console.log(response);
}).fail(function(response) {
// Request failed
console.log(response);
});
Example querying specific membership
(async () => {
let schema = '{ "membership": { "id": <int:membership_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 = '{ "membership": { "id": <int:membership_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: '{ "membership": { "id": <int:membership_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. |
Payment methods | { schema: '{ "payment_methods": [] }' } |
Example of querying all payment methods for a customer. Replaces payment sources from Novum 4. |
Payment method | { schema: '{ "payment_methods": [ "id": <int:payment_method_id> ] }' } |
Example of querying a specific payment method for a customer. Replaces payment sources from Novum 4. |
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. |
Shipping Addresses | { schema: '{ "addresses": [] }' } |
Example of querying all shipping addresses for a customer. Replaces Addresses from Novum 4. |
Shipping Address | { schema: '{ "address": { "id": <int:address_id> } }' } |
Example of querying a specific address by address id for a customer. Replaces Address from Novum 4. |
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. |
Subscription bundle selections | { schema: '{ "subscription": { "id": <int:subscription_id>, "bundle_selections": {} } }' } |
Example of querying subscription and its bundle selections by subscription id. |
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. |
Memberships | { schema: '{ "memberships": [] }' } |
Example of querying all memberships. |
Membership | { schema: '{ "membership": { "id": <int:membership_id> } }' } |
Example of querying a membership by membership id for a customer. |
Memberships | { schema: '{ "memberships": { "include": "membership_program" } }' } |
Example of querying all memberships and including membership program information. |
Membership | { schema: '{ "membership": { "id": <int:membership_id>, "include": "membership_program" } }' } |
Example of querying a membership by membership id for a customer and including membership program information. |
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": {} }' } |
Payment Methods endpoint (valid from Novum 4 only)
Filter | Schema |
---|---|
payment_methods_list_url | { schema: '{ "customer": {}, "payment_methods": [] }' } |
show_payment_method_url | { schema: '{ "customer": {}, "payment_methods": [ "id": <int:payment_method_id> ] }' } |
update_payment_method_url | { schema: '{ "customer": {}, "payment_methods": [ "id": <int:payment_method_id> ] }' } |
payment_method_address_url | { schema: '{ "customer": {}, "payment_methods": [ "payment_method_id": <int:payment_method_id> ] }' } |
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> } }' } |
Shipping addresses endpoints
Filter | Schema |
---|---|
list_addresses_url | { schema: '{ "customer": {} }, "addresses": [] }' } |
create_address_url | { schema: '{ "customer": {} }' } |
show_shipping_url | { schema: '{ "customer": {}, "address": { "id": <int:address_id> } }' } |
update_shipping_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> } }' } |
Membership endpoints
Filter | Schema |
---|---|
membership_list_url | { schema: '{ "customer": {}, "addresses": [], "memberships": [] }' } |
Membership action endpoints
Filter | Schema |
---|---|
membership_activate_url | { schema: '{ "customer": {}, "membership": { "id": <int:membership_id> } }' } |
Membership cancel endpoints
Filter | Schema |
---|---|
membership_retention_strategy_url | { schema: '{ "customer": {}, "membership": { "id": <int:membership_id> }, "retention_strategies": { "sort_by": "id-asc" , "cancellation_flow_type": "membership"} }' } |
membership_cancel_url | { schema: '{ "customer": {}, "membership": { "id": <int:membership_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 Angeles 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 endpoint 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 endpoint updates an existing address for customer. route details
POST /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>
This endpoint updates payment method for the associated address by moving all subscriptions tied to a selected payment method. route details
POST /tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/charges/skip
This endpoint skips one or more subscriptions associated with an address. route details
POST /tools/recurring/portal/<string:customer_hash>/addresses/merge
This endpoint merges up to 10 different addresses per request into a single address. 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.deleted_at string |
"address.deleted_at": null The date and time when the address was deleted. |
address.delivery_method object |
"external_location_id": null, "type":"SHIPPING" Object that contains information about delivery method:
|
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.discount_id number |
"address.discount_id": null Unique numeric identifier for the discount. |
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 array |
"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.presentment_currency string |
"address.presentment_currency": "USD" The currency on the subscription contract in Shopify. |
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,
"deleted_at": null,
"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,
"external_discount_id":null,
"external_discount_source":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",
"presentment_currency": "USD",
"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,
"deleted_at": null,
"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",
"deleted_at": null,
"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,
"phone": "+12394121332"
"shopify_customer_id":"391100760128",
"customer.tax_exempt": false,
"updated_at":"2019-04-30T15:11:43"
},
"settings":{
"customer_portal":{
"collection_ids": [],
"custom_code":{
"backend_portal": "#rc_subscriptions__items__recurring_price{display:none!important;}",
"credit_cart_update_page": "",
"footer": "",
"header": "",
"header_logo_url": "",
},
"discount_input":true,
"edit_shipping_address":true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal":true,
"inventory_behaviour":"bypass",
"membership":{
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime":{
"available_products":"recharge_products",
"enabled":true,
"shopify_collection_id":null,
"zero_inventory_purchase":true
},
"show_credits": false,
"subscription":{
"add_product":true,
"cancel_subscription":true,
"cancellation_email_contact":"",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{'duration_options':[{'frequency':1,'unit':'months'},{'frequency':1,'unit':'weeks'},{'frequency':1.33320003,'unit':'days'}],'enabled':1,'last_toggled_at':'2023-02-13T17:21:00.521Z'}",
"cancellation_minimum_order_count":0,
"cancellation_reason_optional": true,
"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,
"multicurrency_enabled": true,
"shop_id":41575
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": "",
"checkout_platform": "recharge",
"created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "store.myshopify.com",
"email": "johndoe@gmail.com",
"enabled_presentment_currencies":[
"USD"
],
"enabled_presentment_currencies_symbols":[
{
"currency": "USD",
"location": "before",
"suffix": "",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 90732,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "store.myshopify.com",
"name": "mystore",
"payment_processor": "stripe",
"platform_domain": "store.myshopify.com",
"shop_email": "johndoe@gmail.com",
"shop_phone": "",
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Thu, 17 Sep 2020 03:06:52 GMT",
"use_single_payment_method": 0
}
}
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",
"external_sync": null,
"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,
"phone": "+122312324",
"shopify_customer_id":"391100760128",
"tax_exempt": false,
"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":{
"backend_portal": "#rc_subscriptions__items__recurring_price{display:none!important;}",
"credit_cart_update_page": "",
"footer": "",
"header": "",
"header_logo_url": "",
},
"discount_input":true,
"edit_shipping_address":true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal":true,
"inventory_behaviour":"bypass",
"membership":{
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime":{
"available_products":"recharge_products",
"enabled":true,
"shopify_collection_id":null,
"zero_inventory_purchase":true
},
"show_credits": false,
"subscription":{
"add_product":true,
"cancel_subscription":true,
"cancellation_email_contact":"",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{'duration_options':[{'frequency':1,'unit':'months'},{'frequency':1,'unit':'weeks'},{'frequency':1.33320003,'unit':'days'}],'enabled':1,'last_toggled_at':'2023-02-13T17:21:00.521Z'}",
"cancellation_minimum_order_count":0,
"cancellation_reason_optional": true,
"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,
"multicurrency_enabled": true,
"shop_id":41575
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": "",
"checkout_platform": "recharge",
"created_at": "Wed, 25 Dec 2019 13:16:44 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "store.myshopify.com",
"email": "johndoe@gmail.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": "",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 90732,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "store.myshopify.com",
"name": "mystore",
"payment_processor": "stripe",
"platform_domain": "store.myshopify.com",
"shop_email": "johndoe@gmail.com",
"shop_phone": "",
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Thu, 17 Sep 2020 03:06:52 GMT",
"use_single_payment_method": 0
}
}
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 }}';
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",
"country_code": "US"
"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",
"presentment_currency": "USD",
"province":"California",
"shipping_lines_override":null,
"updated_at":"2019-04-30T15:25:20",
"zip":"90025"
}
}
This endpoint 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,
"deleted_at": null,
"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,
"external_discount_id": null,
"external_discount_source": 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",
"presentment_currency": "USD",
"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"
}
}
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 }}';
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 endpoint 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
[POST] - Update payment method for an address
POST
/addresses/<int:address_id>
(async () => {
let url = '{{ address_url }}';
let data = {
"id":"91926701",
"payment_method_id":"54880892"
}
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 = {
"id":"91926701",
"payment_method_id":"54880892"
}
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: {
"id":"91926701",
"payment_method_id":"54880892"
}
}).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",
"presentment_currency":"USD",
"province":"California",
"shipping_lines_override":null,
"updated_at":"2019-05-02T14:07:16",
"zip":"90025"
}
}
This endpoint updates payment method for the associated address by moving all subscriptions tied to a selected payment method.
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 |
---|---|
id * | number |
payment_method_id * | number |
* = required
[POST] - Skip future charges
POST
/addresses/<int:address_id>/charges/skip
(async () => {
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/addresses/<int:address_id>/charges/skip?token=${window.customerToken}`;
let data = {
date: "2022-09-07",
subscription_ids: [1234567834, 4567893423]
};
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>/charges/skip?token=${window.customerToken}`;
let data = {
date: "2022-09-07",
subscription_ids: [1234567834, 4567893423]
};
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: `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/addresses/<int:address_id>/charges/skip?token=${window.customerToken}`,
type: "post",
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({
date: "2022-09-07",
subscription_ids: [1234567834, 4567893423]
}),
}).done(function (response) {
// Successful request made
console.log(response);
}).fail(function (response) {
// Request failed
console.error(response);
});
CLICK HERE TO SEE RESPONSE
{
"charge": {
"address_id": 18586680,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "101 Washington Street",
"address2": "204",
"city": "Los Angeles",
"company": "Recharge",
"country_code": "US",
"first_name": "John",
"last_name": "Doe",
"phone": "122211121212",
"province": "",
"zip": "90009"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2020-02-05T08:45:41",
"currency": "USD",
"customer": {
"email": "test@test.com",
"external_customer_id": {
"ecommerce": "1234567890"
},
"hash": "63cadb9b9a8853f3218396ded9aff2",
"id": 78902356
},
"discounts": [],
"error": null,
"error_type": null,
"external_order_id": {
"ecommerce": null
},
"external_transaction_id": {
"payment_processor": null
},
"has_uncommited_changes": false,
"id": 32172457,
"line_items": [
{
"external_product_id": {
"ecommerce": "7610487406759"
},
"external_variant_id": {
"ecommerce": "43203789848743"
},
"grams": 1230,
"handle": null,
"images": {
"large": "",
"medium": "",
"original": "",
"small": ""
},
"properties": [],
"purchase_item_id": 23456789,
"purchase_item_type": "subscription",
"quantity": 1,
"sku": null,
"tax_due": "0.00",
"tax_lines": [],
"taxable": true,
"taxable_amount": "100.00",
"title": "Optimum Nutrition Gold Standard Whey",
"total_price": "100.00",
"unit_price": "100.00",
"unit_price_includes_tax": false,
"variant_title": ""
}
],
"note": "next order in sequence 1",
"note_attributes": [],
"order_count": 0,
"payment_processor": "shopify_payments",
"processed_at": "2023-02-05T08:55:39",
"retry_date": null,
"scheduled_at": "2023-02-05T00:00:00",
"shipping_address": {
"address1": "101 Washington Street",
"address2": "",
"city": "Los Angeles",
"company": "Recharge",
"country_code": "US",
"first_name": "John",
"last_name": "Doe",
"phone": "122211121212",
"province": "California",
"zip": "90009"
},
"shipping_lines": {
"code": "Standard",
"price": "0.00",
"source": "shopify",
"tax_lines": [],
"taxable": false,
"title": "Standard"
},
"status": "skipped",
"subtotal_price": "100.0",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": [],
"total_discounts": "0.00",
"total_duties": "0.00",
"total_line_items_price": "100.00",
"total_price": "100.00",
"total_refunds": "0.00",
"total_tax": "0.00",
"total_weight_grams": 1230,
"type": "recurring",
"updated_at": "2023-02-05T09:55:41"
}
}
This endpoint skips one or more subscriptions associated to an address. You can skip subscriptions not added to queued charges or skip charges in a future date.
Must pass a date
in the future that matches charge interval frequency of the subscription and a list of subscription_ids
to skip.
Methods accepted: POST
Embedded Route: /tools/recurring/portal/{{ customer.hash }}/addresses/<int:address_id>/charges/skip?token=${window.customerToken}
Hosted Route: /portal/{{ customer.hash }}/addresses/<int:address_id>/charges/skip?token=${window.customerToken}
;
Arguments accepted:
Property | Type |
---|---|
date * | string |
subscription_ids * | array of numbers |
* = required
[POST] - Merge addresses
POST
/addresses/merge
(async () => {
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/addresses/merge?token=${window.customerToken}`;
let data = {
"delete_source_addresses": false,
"target_address": { "id": 94777070 },
"source_addresses": [
{ "id": 94795589 },
{ "id": 94795588 },
{ "id": 94729445 }
]
};
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/merge?token=${window.customerToken}`;
let data = {
"delete_source_addresses": false,
"target_address": { "id": 94777070 },
"source_addresses": [
{ "id": 94795589 },
{ "id": 94795588 },
{ "id": 94729445 }
]
};
let options = {
method: 'post',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
};
fetch(url, options)
.then((response) => response.json())
.then((response) => {
// Successful request made
console.log(response);
})
.catch((error) => {
// Request failed
console.error(error);
});
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/addresses/merge?token=${window.customerToken}`;
let data = {
"delete_source_addresses": false,
"target_address": { "id": 94777070 },
"source_addresses": [
{ "id": 94795589 },
{ "id": 94795588 },
{ "id": 94729445 }
]
};
$.ajax({
url: url,
type: 'post',
contentType: 'application/json',
data: JSON.stringify(data)
}).done(function (response) {
// Successful request made
console.log(response);
}).fail(function (error) {
// Request failed
console.log(error);
});
CLICK HERE TO SEE RESPONSE
{
"address": {
"address1": "101 Washington Street",
"address2": "Suite 101",
"city": "Los Angeles",
"company": "Recharge",
"country_code": "US",
"created_at": "2019-04-30T15:25:20",
"customer_id": 8187626,
"discounts": [],
"first_name": "John",
"id": 94777070,
"last_name": "Doe",
"order_attributes": [],
"order_note": null,
"payment_method_id": 84574322,
"phone": null,
"presentment_currency": "USD",
"province": "California",
"shipping_lines_conserved": [],
"shipping_lines_override": [],
"updated_at": "2023-04-30T15:25:20",
"zip": "90025"
}
}
This endpoint merges up to 10 different addresses per request into a single address.
Note: If one of the addresses being merged has a different presentment currency, the entire merge will fail and throw an error.
Methods accepted: POST
Embedded Route: /tools/recurring/portal/{{ customer.hash }}/addresses/merge?token={window.customerToken}
Hosted Route: /portal/{{customer.hash}}/addresses/merge?token={window.customerToken}
Property | Type | Definition |
---|---|---|
delete_source_addresses | boolean | Indicates whether the source addresses should be deleted. |
next_charge_date | string | Specifies the next charge date of the associated subscriptions on the target address. |
target_address * target_address.id |
object number |
The address all of the subscriptions should be moved to. The ID of the address. |
source_addresses * source_addresses[].id |
array number |
A list of objects containing the addresses that the subscriptions should move from. |
* = 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. |
Shipping
Shipping represents the shipping information for the customer.
Shipping 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>/shipping
This endpoint renders a template with a list of shipping addresses and their associated payment methods for the customer. route details
POST /tools/recurring/portal/<string:customer_hash>/shipping/create
This endpoint creates a new address for customer. route details
GET /tools/recurring/portal/<string:customer_hash>/shipping/<int:address_id>
This endpoint renders a template with a form for the shipping address. route details
GET /tools/recurring/portal/<string:customer_hash>/shipping/<int:address_id>/payment_method
This endpoint renders a template with a form for switching the default payment method for an address for the customer. route details
Shipping 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 shipping.subscription.address_id
.
Property | Definition |
---|---|
shipping.address1 string |
"shipping.address1": "101 Washington Street" The street associated with the address. |
shipping.address2 string |
"shipping.address2": "Suite 101" Any additional information associated with the address. |
shipping.cart_note string |
"shipping.cart_note": "" The note that that will be passed to the “note” field of orders made within the address. |
shipping.city string |
"shipping.city": "Los Angeles" The city associated with the address. |
shipping.company string |
"shipping.company": "Recharge" The company associated with the address. |
shipping.country string |
"shipping.country": "United States" The country associated with the address. |
shipping.created_at string |
"shipping.created_at": "2018-02-21T11:46:01" The date and time when the address was created. |
shipping.customer_id number |
"shipping.customer_id": 8187626 Unique numeric identifier for the customer associated with the address. |
shipping.discount_id number |
"shipping.discount_id": null Unique numeric identifier for the discount. |
shipping.first_name string |
"shipping.first_name": "John" The customer’s first name associated with the address. |
shipping.id number |
"shipping.id": 7976732 Unique numeric identifier for the address. |
shipping.include object |
"shipping.include": {"payment_methods": []} Includes payment methods. |
shipping.include.payment_methods array |
"shipping.include.payment_methods": [{ "billing_address": { "address1" : "220 Division Street South", "address2" : "River Level", "city" : "NORTHFIELD", "company": null "country": "United States", "first_name": "Shipping", "last_name": "Data4", "phone": "", "province": "Minnesota", "zip": "55057" }, "created_at": "2021-12-15T10:35:00", "default": true, "include": {}, "payment_details": { "brand": "visa", "exp_month": 11, "exp_year": 2023, "last4": 1111 }, "payment_type": "CREDIT_CARD", "processor_customer_token": "cus_Fh9JvsIGSONGWn", "processor_name": "stripe", "processor_payment_method_token": "pm_1JUCFtJ2zqHvZRd15i1bCqce", "status": null "status_reason": null "updated_at": "2021-12-15T10:55:00" }] Payment methods details. |
shipping.last_name string |
"shipping.last_name": "Doe" The customer’s last name associated with the address. |
shipping.note_attributes string |
"shipping.note_attributes": [] Extra information that is added to the address. Each array entry must contain a hash with “name” and “value” keys. |
shipping.phone string |
"shipping.phone": "3103103101" The phone number associated with the address. |
shipping.province string |
"shipping.province": "California" The state or province associated with the address. |
shipping.shipping_lines_override string |
"shipping.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. |
shipping.subscriptions array |
"shipping.subscriptions": [{ "address_id": 61539090, "analytics_data": { "utm_params":[] }, "cancellation_reason": null, "cancellation_reason_comments": null, "cancelled_at": null, "charge_delay" : null, "charge_interval_frequency": "30" "created_at": "2021-01-21T16:24:15," "customer_id": 1263344150, "cutoff_day_of_month_before_and_after": null, "cutoff_day_of_week_before_and_after": null, "email": "john.doe@email.com", "expire_after_specific_number_of_charges": null, "first_charge_date": null, "has_queued_charges": 1, "id": 126344150, "is_prepaid": false, "is_skippable": true, "is_swappable": true, "locked_pending_charge_id": 0, "max_retries_reached": 0, "next_charge_scheduled_at": "2022-01-28T00:00:00", "order_day_of_month": null, "order_day_of_week": null, "order_interval_frequency": "30", "order_interval_unit": "day", "price": 7.99, "product_title": "Pure Pistachios Auto renew", "properties": [], "quantity": 1, "recharge_product_id": 1428131, "shopify_product_id": 4536616321104, "shopify_variant_id": 32180428734544 "sku": "PURE", "sku_override": false, "status": "ACTIVE", "updated_at": "2021-01-21T16:24:15", "variant_title": "" }] Array of subscriptions under this address |
shipping.updated_at string |
"shipping.updated_at": "2019-04-22T09:35:39" The date and time when the address was last updated. |
shipping.zip string |
"shipping.zip": "90025" The zip or postal code associated with the address. |
[GET] - List shipping
GET
/request_objects
(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": {}, "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",
"city":"Los Angeles",
"company":"",
"country":"United States",
"created_at":"2018-10-09T08:38:33",
"customer_id":8187626,
"first_name":"John",
"id":18586680,
"last_name":"Doe",
"province":"California",
"zip":"90025"
"payment_method": {
"id": 1234567,
"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"
},
"created_at": "2021-11-14T09:00:01",
"customer_id":8187626,
"default": true,
"payment_details" : [
{
"brand" : "visa",
"exp_month" : 04
"exp_year" : 2025,
"last4": 1235
}
],
"payment_type": "credit_card",
"processor_customer_token":"cus_AB3ebcBaL6pCx9",
"processor_name":"stripe",
"processor_payment_token":"pm_123123",
"updated_at": "2021-12-14T09:00:01"
},
"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":""
},
...
]
},
{
"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,
"subscriptions" : [],
"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: {{ shipping_list_url }}
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/shipping?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/shipping?token=${window.customerToken}
Template file: shipping.html
Schema: '{ "addresses": {}, "customer": {}, "settings": {}, "store": {} }'
Available template objects:
[POST] - Create new shipping address
POST
/shipping/create
(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,
"first_name":"John",
"id":32172754,
"last_name":"Doe",
"phone":"5551231234",
"province":"California",
"shipping_lines_override":null,
"updated_at":"2019-04-30T15:25:20",
"zip":"90025"
}
}
This endpoint creates a new address for customer.
URL: {{ shipping_create_url }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/shipping/create?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/shipping/create?token=${window.customerToken}
Template file: create_shipping.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 a shipping address
GET
/request_objects
(async () => {
let schema = '{ "addresses": { "id": <int:address_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> }, "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> }, "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",
"city":"Los Angeles",
"company":"Recharge",
"country":"United States",
"created_at":"2019-04-30T15:25:20",
"customer_id":8187626,
"first_name":"John",
"id":32172754,
"last_name":"Doe",
"phone":"5551231234",
"province":"California",
"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: {{ shipping_address_url }}
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/shipping/<int:address_id>?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/shipping/<int:address_id>?token=${window.customerToken}
Template file: edit_shipping_address.html
Available template objects:
[GET] - Update payment method on a shipping address
GET
/shipping/<int:address_id>/payment_method
(async () => {
let schema = '{ "addresses": { "id": <int:address_id> }, "payment_methods": [], "billing_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> }, "payment_methods": [], "billing_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> }, "payment_methods": [], "billing_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
{
"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 endpoint updates an existing address for customer.
URL: {{shipping_payment_method_url}}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/shipping/<int:address_id>/payment_method?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/shipping/<int:address_id>/payment_method?token=${window.customerToken}
Template file: edit_shipping_payment_method.html
Available template objects:
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. route details
POST /tools/recurring/portal/<string:customer_hash>/charges/<int:charge_id>/process
This endpoint updates/processes an existing charge for customer. route details
POST /tools/recurring/portal/<string:customer_hash>/charges/<int:charge_id>/skip
This endpoint skips one or more subscriptions attached to a single queued charge. route details
POST /tools/recurring/portal/<string:customer_hash>/charges/<int:charge_id>/unskip
This endpoint unskips one or more subscriptions attached to a single queued charge. route details
POST /tools/recurring/portal/<string:customer_hash>/charges/skip_gift
This endpoint allows one or more subscriptions attached to a single address to be gifted to someone. route details
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.analytics_data.utm_params array |
"charge.analytics_data.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:
|
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.currency string |
"charge.currency": "USD" The code of the currency for this Charge, such as USD. |
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 array |
"amount: 184.23 "code": "DISCOUNT_CODE" "recharge_discount_id": 85855220 "type": "fixed_amount" 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.include object |
"order_modifications" : [{ "charge_id": 479471048, "created_at": "2022-11-30T10:46:56", "id": 151, "modifications": { "line_items": [{ "line_item_id": 1, "modification_type": "delete", "modifications": [{ "attribute": "quantity", "created_at": "2022-11-30T10:45:08", "previous_value": "2", "reason": "Removed due to inventory", "value": null }], "subscription_id": 203309206 }, { "line_item_id": 2, "modification_type": "update", "modifications": [{ "attribute": "quantity", "created_at": "2022-11-30T10:45:09", "previous_value": "3", "reason": "Quantity reduced due to inventory", "value": "2" }], "subscription_id": 203309207 }] }, "order_id": 310319778, "updated_at": "2022-11-30T10:47:07" }] Object that contains information about order modifications:
|
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": [] "type": "SUBSCRIPTION" "title": "Bare Box - 3 Month Plan" "variant_title": "x-small" "vendor": "recharge-test-store" A list of line item objects, each one containing information about an item in the charge:
|
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.requires_shipping boolean |
"charge.requires_shipping": true Whether or not a charge requires shipping. |
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:
|
charge.shipping_lines array |
"code": "Priority" "description": null "price": "7.81" "source": "Subscription" "tax_lines": "[]" "title": "Priority Mail" The 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_duties number |
"charge.total_duties": null The sum of all duties applied to the line items in the order in the currency's subunit. |
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",
"currency": "USD",
"customer_hash": "818762670d14f56b6f39fd7",
"customer_id": 8187626,
"discount_codes": [],
"email": "john.doe@test.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 32172457,
"include": {
"order_modifications": [{
"charge_id": 479471048,
"created_at": "2022-11-30T10:46:56",
"id": 151,
"modifications": {
"line_items": [{
"line_item_id": 1,
"modification_type": "delete",
"modifications": [{
"attribute": "quantity",
"created_at": "2022-11-30T10:45:08",
"previous_value": "2",
"reason": "Removed due to inventory",
"value": null
}],
"subscription_id": 203309206
},
{
"line_item_id": 2,
"modification_type": "update",
"modifications": [{
"attribute": "quantity",
"created_at": "2022-11-30T10:45:09",
"previous_value": "3",
"reason": "Quantity reduced due to inventory",
"value": "2"
}],
"subscription_id": 203309207
}]
},
"order_id": 310319778,
"updated_at": "2022-11-30T10:47:07"
}]
},
"last_name": "Doe",
"line_items": [
{
"grams": 0,
"images": {
"large": "",
"medium": "",
"original": "",
"small": ""
},
"original_price": "100.00",
"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",
"requires_shipping": true,
"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",
"description": null,
"price": "0.00",
"source": "Subscription",
"tax_lines": [],
"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_duties": null,
"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",
"currency": "USD",
"customer_hash": "818762670d14f56b6f39fd7",
"customer_id": 8187626,
"discount_codes": [],
"email": "john.doe@test.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 32172457,
"include": {
"order_modifications": []
},
"last_name": "Doe",
"line_items": [
{
"grams": 0,
"images": {
"large": "",
"medium": "",
"original": "",
"small": ""
},
"original_price": "100.00",
"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",
"requires_shipping": true,
"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",
"description": null,
"price": "0.00",
"source": "Subscription",
"tax_lines": [],
"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_duties": null,
"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",
"currency": "USD",
"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,
"include": {
"order_modifications": []
},
"last_charge_attempt_date": "2020-03-02T15:29:59",
"last_name": "Doe",
"line_items": [
{
"grams": 0,
"images": {
"large": "",
"medium": "",
"original": "",
"small": ""
},
"original_price": "100.00",
"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",
"requires_shipping": true,
"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",
"description": null,
"price": "0.00",
"source": "Subscription",
"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_duties": null,
"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>/process
(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",
"currency": "USD",
"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": [
{
"grams": 0,
"images": {
"large": "",
"medium": "",
"original": "",
"small": ""
},
"original_price": "100.00",
"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",
"requires_shipping": true,
"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",
"description": null,
"price": "0.00",
"source": "Subscription",
"tax_lines": [],
"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_duties": null,
"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}
[POST] - Skip subscriptions
POST
/charges/<int:charge_id>/skip
(async () => {
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/<int:charge_id>/skip?token=${window.customerToken}`;
let data = {
"subscription_ids": [1234567834, 4567893423]
}
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 }}/charges/<int:charge_id>/skip?token=${window.customerToken}`;
let data = {
"subscription_ids": [1234567834, 4567893423]
}
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: `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/<int:charge_id>/skip?token=${window.customerToken}`,
type: 'post',
dataType: 'json',
data: {
"subscription_ids": [1234567834, 4567893423]
},
}).done(function(response) {
// Successful request made
console.log(response);
}).fail(function(response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"charge":
{
"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": [
"grams": 0,
{
"images": {
"large": "",
"medium": "",
"original": "",
"small": ""
},
"original_price": "100.00",
"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",
"requires_shipping": true,
"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",
"description": null,
"price": "0.00",
"source": "Subscription",
"tax_lines": [],
"title": "Standard"
},
"shopify_order_id": "197852934323",
"status": "SKIPPED",
"sub_total": null,
"subtotal_price": "300.0",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0,
"total_discounts": "0.0",
"total_duties": null,
"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"
}
}
This endpoint skips one or more subscriptions attached to a single queued charge. Must pass a list of subscription_ids
to skip.
Methods accepted: POST
Embedded Route: /tools/recurring/portal/{{ customer.hash }}/charges/<int:charge_id>/skip?token=${window.customerToken}
Hosted Route: /portal/{{ customer.hash }}/charges/<int:charge_id>/skip?token=${window.customerToken}
[POST] - Unskip subscriptions
POST
/charges/<int:charge_id>/unskip
(async () => {
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/<int:charge_id>/unskip?token=${window.customerToken}`;
let data = {
"subscription_ids": [1234567834, 4567893423]
}
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 }}/charges/<int:charge_id>/unskip?token=${window.customerToken}`;
let data = {
"subscription_ids": [1234567834, 4567893423]
}
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: `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/<int:charge_id>/unskip?token=${window.customerToken}`,
type: 'post',
dataType: 'json',
data: {
"subscription_ids": [1234567834, 4567893423]
},
}).done(function(response) {
// Successful request made
console.log(response);
}).fail(function(response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"charge":
{
"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": [
"grams": 0,
{
"images": {
"large": "",
"medium": "",
"original": "",
"small": ""
},
"original_price": "100.00",
"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",
"requires_shipping": true,
"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",
"description": null,
"price": "0.00",
"source": "Subscription",
"tax_lines": [],
"title": "Standard"
},
"shopify_order_id": "197852934323",
"status": "SKIPPED",
"sub_total": null,
"subtotal_price": "300.0",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0,
"total_discounts": "0.0",
"total_duties": null,
"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"
}
}
This endpoint unskips one or more subscriptions attached to a single queued charge. Must pass a list of subscription_ids
to unskip.
Methods accepted: POST
Embedded Route: /tools/recurring/portal/{{ customer.hash }}/charges/<int:charge_id>/unskip?token=${window.customerToken}
Hosted Route: /portal/{{ customer.hash }}/charges/<int:charge_id>/unskip?token=${window.customerToken}
[POST] - Skip and gift subscription
POST
/charges/skip_gift
(async () => {
let url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/skip_gift?token=${window.customerToken}`;
let data = {
"purchase_item_ids": [1234567834, 4567893423],
"recipient_address": {
"email": "person@rechargepayments.com",
"address1": "123 Main St.",
"address2": "",
"city": "Boston",
"company": "",
"country_code": "US",
"province": "Massachusetts",
"first_name": "John",
"last_name": "Smith",
"phone": "",
"zip": "02108",
}
}
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 }}/charges/skip_gift?token=${window.customerToken}`;
let data = {
"purchase_item_ids": [1234567834, 4567893423],
"recipient_address": {
"email": "person@rechargepayments.com",
"address1": "123 Main St.",
"address2": "",
"city": "Boston",
"company": "",
"country_code": "US",
"province": "Massachusetts",
"first_name": "John",
"last_name": "Smith",
"phone": "",
"zip": "02108",
}
}
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: `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/charges/skip_gift?token=${window.customerToken}`,
type: 'post',
dataType: 'json',
data: {
"purchase_item_ids": [1234567834, 4567893423],
"recipient_address": {
"email": "person@rechargepayments.com",
"address1": "123 Main St.",
"address2": "",
"city": "Boston",
"company": "",
"country_code": "US",
"province": "Massachusetts",
"first_name": "John",
"last_name": "Smith",
"phone": "",
"zip": "02108",
}
},
}).done(function(response) {
// Successful request made
console.log(response);
}).fail(function(response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"onetimes": [
{
"address_id": 119355268,
"created_at": "2023-03-27T11:47:47",
"customer_id": 108773672,
"id": 347071353,
"next_charge_scheduled_at": "2023-12-12T00:00:00",
"presentment_currency": "USD",
"price": 25.0,
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": null,
"status": "ONETIME",
"updated_at": "2023-03-27T11:47:47",
"variant_title": ""
}
]
}
This endpoint allows one or more subscriptions attached to a single address to be gifted to someone. Must pass a list of purchase_item_ids
to gift and a recipient_address
. Note: purchase_item_ids
is the same as subscription_ids
. recipient_address
is the same as address
object, it contains same properties.
This will skip the subscriptions and create onetimes that will be delivered to the recipient. The recipient will receive an email notification when the onetimes are charged.
Methods accepted: POST
Embedded Route: /tools/recurring/portal/{{ customer.hash }}/charges/skip_gift?token=${window.customerToken}
Hosted Route: /portal/{{ customer.hash }}/charges/skip_gift?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 endpoint 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.deleted_at string |
"customer.deleted_at": "2019-03-11T10:32:23" The date and time when the customer was deleted. |
customer.email string |
"customer.email": "john.doe@test.com" The email address of the customer. |
customer.external_sync object |
"customer.external_sync": null The external sync 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 Number of active subscriptions for customer. |
customer.number_subscriptions number |
"customer.number_subscriptions": 19 Number of subscriptions for customer. |
customer.phone string |
"customer.phone": "5551231234" The customer's phone number. |
customer.shopify_customer_id string |
"customer.shopify_customer_id": "391100760128" Shopify’s unique identifier for the customer. |
customer.tax_exempt boolean | "customer.tax_exempt": false Whether the customer tax exempt or not. |
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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897889",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d06789029e50d9702c9af9e462d9d3",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048567829",
"tax_exempt": false,
"updated_at": "2023-03-23T17:19:02"
},
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177889,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Fri, 24 Mar 2023 05:03:22 GMT",
"use_single_payment_method": 0
}
}
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 }}';
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": 0,
"analytics_data": {
"utm_params": []
},
"billing_address1": "3030 Nebraska Ave. Santa Monica",
"billing_address2": null,
"billing_city": "Los Angeles",
"billing_company": null,
"billing_country": "United States",
"billing_phone": null,
"billing_province": "California",
"billing_zip": "90404",
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"has_valid_payment_method": true,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"processor_type": null,
"reason_payment_method_not_valid": null,
"shopify_customer_id": "6877048897845",
"status": "ACTIVE",
"tax_exempt": false,
"updated_at": "2023-03-24T13:10:52"
}
}
This endpoint 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 |
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.
GET /tools/recurring/portal/<string:customer_hash>/request_objects
This endpoint retrieves a list of discounts for the current customer. route details
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.
Property | Definition |
---|---|
applies_to string |
"applies_to": null An indicator of whether the discount applies to product or collection. |
applies_to_id number |
"applies_to_id": null An indication of the collection or product id to which the discount applies. |
applies_to_product_type string |
"applies_to_product_type": null An indicator of whether the discount applies to onetimes, subscriptions, or all purchase item types. |
applies_to_resource string |
"applies_to_resource": null An indicator of the type of resource to which applies_to_id refers. |
channel_settings object |
"api": {can_apply: true} "checkout_page": {can_apply: true} "customer_portal": {can_apply: true} "merchant_portal": {can_apply: true} A list of channel objects containing information regarding discount behaviors for each. |
code string |
"code": "test123" The code used to apply the discount. |
created_at string |
"created_at": "2019-07-03T10:06:47" The date and time when the discount was created. |
discount_type string |
"discount_type": "percentage" Type of discount mechanic. |
duration string |
"duration": "single_use" Duration of the discount. |
duration_usage_limit object |
"duration_usage_limit": null An object containing limitations on a discount based on usage_counts results |
ends_at string |
"ends_at": null The expiration timestamp of the discount. Past this time the Discount can no longer be redeemed. After ends_at the status of the Discount will go from active to disabled. |
external_discount_id object |
"external_discount_id": null An object containing external ids of the discount. |
external_discount_source string |
"external_discount_source": null The external discount source. |
first_time_customer_restriction boolean |
"first_time_customer_restriction": null Discount can be used on checkout for customer that still don’t exist in Recharge database. |
id number |
"id": 13350570 Unique numeric identifier for the discount in Recharge. |
once_per_customer boolean |
"once_per_customer": true The code could be applied once. |
prerequisite_subtotal_min string |
"prerequisite_subtotal_min": null The minimum cart subtotal needed for the discount to be applicable. duration has to be single_use and the discount must apply to the entire order. |
starts_at string |
"starts_at": "2019-07-04T00:00:00" The date when the discount becomes active. |
status string |
"status": "enabled" The status of the discount. |
times_used number |
"times_used": 0 Number of times discount has been used. |
updated_at string |
"updated_at": "2019-07-03T10:06:47" The date when the discount is updated. |
usage_limit number |
"usage_limit": null Discount usage limit. |
value number |
"value": 10 The discounted value to be applied. |
[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',
data: { schema: '{ "discounts": [], "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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00167",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d967",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-24T13:10:52"
},
"discounts": [
{
"applies_to": "shopify_collection_id",
"applies_to_id": 440626512165,
"applies_to_product_type": "ALL",
"applies_to_resource": "shopify_collection_id",
"channel_settings": {
"api": {
"can_apply": true
},
"checkout_page": {
"can_apply": true
},
"customer_portal": {
"can_apply": true
},
"merchant_portal": {
"can_apply": true
}
},
"code": "TEST_DISCOUNT",
"created_at": "2023-03-27T09:43:45",
"discount_type": "percentage",
"duration": "single_use",
"duration_usage_limit": 1,
"ends_at": "2023-07-31T23:59:59",
"external_discount_id": null,
"external_discount_source": null,
"first_time_customer_restriction": null,
"id": 143067197,
"once_per_customer": true,
"prerequisite_subtotal_min": null,
"starts_at": "2023-03-27T00:00:00",
"status": "enabled",
"times_used": 0,
"updated_at": "2023-03-27T09:43:45",
"usage_limit": 20,
"value": 10.0
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177875
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "nina@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Sat, 25 Mar 2023 05:01:04 GMT",
"use_single_payment_method": 0
}
}
List all discounts for the current customer.
Methods accepted: GET
Schema: '{ "discounts": [], "customer": {} , "settings": {}, "store": {} }'
[POST] - Apply discount
POST
/addresses/<int:address_id>/apply_discount
(async () => {
let url = '{{ discount_apply_url }}';
let data = {
"discount_code":"TEST_DISCOUNT"
}
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":"TEST_DISCOUNT"
}
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":"TEST_DISCOUNT"
}
}).done(function(response) {
// Successful request made
console.log(response);
}).fail(function(response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"cart_attributes": [],
"cart_note": null,
"city": "Los Angeles",
"company": "",
"country": "United States",
"country_code": "US",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"discount_id": 143068306,
"first_name": "Recharge",
"id": 119355268,
"last_name": "Test",
"note_attributes": [],
"original_shipping_lines": null,
"phone": "",
"presentment_currency": "USD",
"province": "California",
"shipping_lines_override": null,
"updated_at": "2023-03-27T10:20:22",
"zip": "90404"
}
}
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:
Property | Type |
---|---|
Discount Code * | string |
* = required
[POST] - Remove discount
POST
/addresses/<int:address_id>/remove_discount
(async () => {
let url = '{{ discount_remove_url }}';
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": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"cart_attributes": [],
"cart_note": null,
"city": "Los Angeles",
"company": "",
"country": "United States",
"country_code": "US",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"discount_id": null,
"first_name": "Recharge",
"id": 119355268,
"last_name": "Test",
"note_attributes": [],
"original_shipping_lines": null,
"phone": "",
"presentment_currency": "USD",
"province": "California",
"shipping_lines_override": null,
"updated_at": "2023-03-27T10:29:12",
"zip": "90404"
}
}
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:
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
This feature enables the creation of custom apps that can be utilized for upselling to your existing subscriber base, among other things. It expands the possibilities of Recharge and allows for greater creative freedom.
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.
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
This endpoint creates a new one time product for customer. route details
POST /tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>
This endpoint 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 updating 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.presentment_currency string |
"onetime.presentment_currency": null The currency on the subscription contract in Shopify. |
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 array |
"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. |
[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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d967",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-27T10:27:53"
},
"onetime": {
"address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"cart_note": null,
"city": "Los Angeles",
"company": "",
"country": "United States",
"country_code": "US",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"deleted_at": null,
"discount_id": null,
"first_name": "John",
"id": 119355268,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d967",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"note_attributes": [],
"phone": "",
"presentment_currency": "USD",
"province": "California",
"shipping_lines_override": null,
"updated_at": "2023-03-27T10:29:12",
"zip": "90404"
},
"address_id": 119355268,
"created_at": "2023-03-27T11:17:23",
"customer_id": 108773672,
"id": 347062631,
"next_charge_scheduled_at": "2023-04-27T00:00:00",
"presentment_currency": "USD",
"price": 40.0,
"product": {
"collection_id": null,
"collection_ids": [],
"created_at": "2023-03-23T16:16:20-04:00",
"discount_amount": 10.0,
"discount_type": "percentage",
"handle": "box-of-pears",
"id": 3076509,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602578",
"medium": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745338-612x612_medium.jpg?v=1679602578",
"original": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-605745338-612x612.jpg?v=1679602578",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-605745338-612x612_small.jpg?v=1679602578",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745400-612x612_large.jpg?v=1679602578",
"medium": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745400-612x612_medium.jpg?v=1679602578",
"original": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745400-612x612.jpg?v=1679602578",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-605745400-612x612_small.jpg?v=1679602578",
"sort_order": 2
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "A box of pears weighing 6 kilograms.",
"created_at": "2023-03-23T16:16:20-04:00",
"handle": "box-of-pears",
"image": {
"alt": null,
"created_at": "2023-03-23T16:16:20-04:00",
"height": null,
"position": 1,
"shopify_id": 303009261367,
"shopify_product_id": 8184740184357,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745338-612x612.jpg?v=1679602578",
"updated_at": "2023-03-23T16:16:21-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T16:16:20-04:00",
"height": null,
"position": 1,
"shopify_id": 303009261367,
"shopify_product_id": 8184740184357,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745338-612x612.jpg?v=1679602581",
"updated_at": "2023-03-23T16:16:21-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:16:20-04:00",
"height": null,
"position": 2,
"shopify_id": 566519453093,
"shopify_product_id": 8184740184357,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0756/8219/0629/products/istockphoto-605745400-612x612.jpg?v=1679602581",
"updated_at": "2023-03-23T16:16:21-04:00",
"width": null
}
],
"options": [
{
"name": "Title",
"position": 1,
"shopify_id": 10381480722725,
"shopify_product_id": 8184740184357,
"values": [
"Default Title"
]
}
],
"product_type": "",
"published_at": "2023-03-23T16:16:20-04:00",
"shopify_id": 8184740184357,
"tags": [
"box",
"fruit"
],
"title": "Box of pears",
"updated_at": "2023-03-23T16:16:21-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": null,
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": null,
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Default Title",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "40.00",
"requires_shipping": true,
"shopify_id": 44751644295461,
"shopify_image_id": null,
"shopify_product_id": 8184740184357,
"sku": "boxofpears",
"taxable": true,
"title": "Default Title",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184740184357,
"subscription_defaults": {
"charge_interval_frequency": 1,
"cutoff_day_of_month": 6,
"cutoff_day_of_week": null,
"expire_after_specific_number_of_charges": null,
"modifiable_properties": [],
"number_charges_until_expiration": null,
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency_options": [
"1"
],
"order_interval_unit": "month",
"storefront_purchase_options": "subscription_and_onetime"
},
"title": "Box of pears",
"updated_at": "2023-03-23T16:50:55"
},
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"status": "ONETIME",
"updated_at": "2023-03-27T11:17:23",
"variant_title": ""
},
"payment_sources": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"card_brand": "visa",
"card_exp_month": 11,
"card_exp_year": 2025,
"card_last4": "4242",
"cardholder_name": "Recharge Test",
"customer_id": 108773672,
"has_card_error_in_dunning": false,
"id": 1,
"payment_method_id": 86434505,
"payment_token": "6877048897829",
"payment_type": "credit",
"processor_name": "shopify_payments",
"status": "active",
"status_reason": null
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "rechargetesting.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Mon, 27 Mar 2023 10:23:41 GMT",
"use_single_payment_method": 0
}
}
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] - Create one time product
POST
/onetimes
(async () => {
let url = '{{ onetime_list_url }}';
let data = {
shopify_variant_id: 44751516336421,
address_id: 119355268,
quantity: 1,
next_charge_scheduled_at: "2023-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: 44751516336421,
address_id: 119355268,
quantity: 1,
next_charge_scheduled_at: "2023-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: 44751516336421,
address_id: 119355268,
quantity: 1,
next_charge_scheduled_at: "2023-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": 119355268,
"created_at": "2023-03-27T11:47:47",
"customer_id": 108773672,
"id": 347071353,
"next_charge_scheduled_at": "2023-12-12T00:00:00",
"presentment_currency": "USD",
"price": 25.0,
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": null,
"status": "ONETIME",
"updated_at": "2023-03-27T11:47:47",
"variant_title": ""
}
}
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
[POST] - Update one time product
POST
/onetimes/<int:onetime_id>
(async () => {
let url = '{{ onetime_url }}';
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": 119355268,
"created_at": "2023-03-27T11:17:23",
"customer_id": 108773672,
"id": 347062631,
"next_charge_scheduled_at": "2023-04-27T00:00:00",
"presentment_currency": "USD",
"price": 40.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 2,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"status": "ONETIME",
"updated_at": "2023-03-27T11:53:24",
"variant_title": ""
}
}
This endpoint 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 }}';
let data = {
next_charge_scheduled_at: "2023-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: "2023-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: "2023-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": 119355268,
"created_at": "2023-03-27T11:17:23",
"customer_id": 108773672,
"id": 347062631,
"next_charge_scheduled_at": "2023-12-12T00:00:00",
"presentment_currency": "USD",
"price": 40.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 2,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"status": "ONETIME",
"updated_at": "2023-03-27T11:56:21",
"variant_title": ""
}
}
This endpoint renders a template with form for updating 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 }}';
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
POST /tools/recurring/portal/<string:customer_hash>/orders/<int:order_id>/delay
This endpoint will delay the prepaid order by one interval. 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:
|
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 |
"accepts_marketing": false "email": "john.Doe@gmail.com" "first_name": "John" "last_name": "Doe" "phone": null "send_email_welcome": false "verified_email": true |
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.error string |
"order.error": "" Displays an error of the order. |
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.include object |
"order_modifications" : [{ "charge_id": 479471048, "created_at": "2022-11-30T10:46:56", "id": 151, "modifications": { "line_items": [{ "line_item_id": 1, "modification_type": "delete", "modifications": [{ "attribute": "quantity", "created_at": "2022-11-30T10:45:08", "previous_value": "2", "reason": "Removed due to inventory", "value": null }], "subscription_id": 203309206 }, { "line_item_id": 2, "modification_type": "update", "modifications": [{ "attribute": "quantity", "created_at": "2022-11-30T10:45:09", "previous_value": "3", "reason": "Quantity reduced due to inventory", "value": "2" }], "subscription_id": 203309207 }] }, "order_id": 310319778, "updated_at": "2022-11-30T10:47:07" }] Object that contains information about order modifications:
|
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": "Doe" The last name of the customer. |
order.line_items array |
"external_inventory_policy": "bypass" "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:
|
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" "company": "bootstrap" "country": "United States" "first_name": "John" "last_name": "Doe" "phone": "3103103101" "province": "California" "zip": "90025" The mailing address where the order will be shipped to:
|
order.shipping_lines array |
"code": "Priority" "description": null "price": "7.80" "source": "shopify" "tax_lines": [] "title": "Priority Mail" The original shipping used for the address when the store has fixed shipping rates.
|
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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d965",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-27T10:27:53"
},
"orders": [
{
"address_id": 119355268,
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"browser_ip": null,
"charge_id": 781911618,
"charge_status": "SUCCESS",
"created_at": "2023-03-27T10:26:39",
"currency": "USD",
"customer": {
"accepts_marketing": false,
"email": "john.doe@gmail.com",
"first_name": "John",
"last_name": "Doe",
"phone": null,
"send_email_welcome": false,
"verified_email": true
},
"customer_id": 108773672,
"discount_codes": null,
"email": "john.doe@gmail.com",
"error": null,
"first_name": "Recharge",
"hash": "533c2671591dab35734e25b1d00165",
"id": 512504981,
"include": {
"order_modifications": []
},
"is_prepaid": 0,
"last_name": "Test",
"line_items": [
{
"external_inventory_policy": "decrement_obeying_policy",
"images": {
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": 22.5,
"price": 22.5,
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"processed_at": "2023-03-27T10:26:45",
"scheduled_at": "2023-04-23T00:00:00",
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "John",
"last_name": "Doe",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"price": "19.90",
"source": "shopify",
"title": "Economy"
}
],
"shopify_cart_token": null,
"shopify_customer_id": "6877048897829",
"shopify_order_id": "5306443333925",
"shopify_order_number": 1003,
"status": "SUCCESS",
"subtotal_price": 22.5,
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": [
{
"channel_liable": null,
"price": "0.51",
"price_set": {
"store_default": {
"amount": "0.51",
"currency_code": "USD"
}
},
"rate": 0.0225,
"title": "Los Angeles County Tax"
},
{
"channel_liable": null,
"price": "1.63",
"price_set": {
"store_default": {
"amount": "1.63",
"currency_code": "USD"
}
},
"rate": 0.0725,
"title": "California State Tax"
},
{
"channel_liable": null,
"price": "0.17",
"price_set": {
"store_default": {
"amount": "0.17",
"currency_code": "USD"
}
},
"rate": 0.0075,
"title": "Santa Monica City Tax"
}
],
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": 44.71,
"total_refunds": null,
"total_tax": 2.31,
"total_weight": 5000,
"transaction_id": "26185564453",
"type": "RECURRING",
"updated_at": "2023-03-27T10:26:49"
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Mon, 27 Mar 2023 10:23:41 GMT",
"use_single_payment_method": 0
}
}
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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d965",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-27T10:27:53"
},
"orders": {
"address_id": 119355268,
"address_is_active": 1,
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"browser_ip": null,
"charge_id": 781911618,
"charge_status": "SUCCESS",
"created_at": "2023-03-27T10:26:39",
"currency": "USD",
"customer": {
"accepts_marketing": false,
"email": "john.doe@gmail.com",
"first_name": "John",
"last_name": "Doe",
"phone": null,
"send_email_welcome": false,
"verified_email": true
},
"customer_id": 108773672,
"discount_codes": null,
"email": "john.doe@gmail.com",
"error": null,
"first_name": "John",
"hash": "533c2671591dab35734e25b1d00165",
"id": 512504981,
"include": {
"order_modifications": []
},
"is_prepaid": 0,
"last_name": "Doe",
"line_items": [
{
"external_inventory_policy": "decrement_obeying_policy",
"images": {
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": 22.5,
"price": 22.5,
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"payment_processor": "shopify_payments",
"processed_at": "2023-03-27T10:26:45",
"scheduled_at": "2023-04-23T00:00:00",
"shipped_date": "2023-03-27T10:26:45",
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_date": "2023-04-23T00:00:00",
"shipping_lines": [
{
"code": "Economy",
"price": "19.90",
"source": "shopify",
"title": "Economy"
}
],
"shopify_cart_token": null,
"shopify_customer_id": "6877048897829",
"shopify_id": "5306443333925",
"shopify_order_id": "5306443333925",
"shopify_order_number": 1003,
"status": "SUCCESS",
"subtotal_price": 22.5,
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": [
{
"channel_liable": null,
"price": "0.51",
"price_set": {
"store_default": {
"amount": "0.51",
"currency_code": "USD"
}
},
"rate": 0.0225,
"title": "Los Angeles County Tax"
},
{
"channel_liable": null,
"price": "1.63",
"price_set": {
"store_default": {
"amount": "1.63",
"currency_code": "USD"
}
},
"rate": 0.0725,
"title": "California State Tax"
},
{
"channel_liable": null,
"price": "0.17",
"price_set": {
"store_default": {
"amount": "0.17",
"currency_code": "USD"
}
},
"rate": 0.0075,
"title": "Santa Monica City Tax"
}
],
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": 44.71,
"total_refunds": null,
"total_tax": 2.31,
"total_weight": 5000,
"transaction_id": "26185564453",
"type": "RECURRING",
"updated_at": "2023-03-27T10:26:49"
},
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Mon, 27 Mar 2023 10:23:41 GMT",
"use_single_payment_method": 0
}
}
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
[POST] - Delay prepaid order
POST
/orders/<int:order_id>/delay
(async () => {
const url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/orders/<int:order_id>/delay?token=${window.customerToken}`;
try {
const response = await axios.post(url);
// Successful request made
console.log(response.data);
} catch (error) {
// Request failed
console.error(error);
}
})();
const url = `{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/orders/<int:order_id>/delay?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 }}/orders/<int:order_id>/delay?token=${window.customerToken}`,
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
{
"order": {
"address_id": 119675689,
"created_at": "2023-03-27T19:11:48+00:00",
"currency": null,
"discounts": [],
"error": null,
"external_cart_token": null,
"id": 512550837,
"is_prepaid": true,
"line_items": [],
"note": null,
"order_attributes": [],
"processed_at": null,
"scheduled_at": "2023-05-27T04:00:00+00:00",
"shipping_lines": [],
"status": "queued",
"subtotal_price": "0.00",
"tags": null,
"tax_lines": [],
"taxable": false,
"total_discounts": "0.00",
"total_duties": null,
"total_line_items_price": "0.00",
"total_price": "0.00",
"total_refunds": "0.00",
"total_tax": "0.00",
"total_weight_grams": null,
"type": "recurring",
"updated_at": "2023-03-27T19:14:53+00:00"
}
}
This endpoint will delay a prepaid order by one interval.
URL: /orders/<int:order_id>/delay
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/orders/<int:order_id>/delay?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/orders/<int:order_id>/delay?token=${window.customerToken}
Payment methods
Payment Methods hold payment and billing information for a customer. As of the API version 2021-11, a Customer may be associated with many Payment Methods, and an Address record must be associated with at least one Payment Method. This definition of payment instruments as Payment Method for customers supersedes Payment Sources.
Payment methods routes
GET /tools/recurring/portal/<string:customer_hash>/payment_methods
This endpoint renders a template with the a customer's list of billing information. route details
GET /tools/recurring/portal/<string:customer_hash>/payment_methods/<int:payment_method_id>
This endpoint renders the billing information details for a specific Payment Method for the customer. route details
POST /tools/recurring/portal/<string:customer_hash>/payment_methods/<int:payment_method_id>
This endpoint updates a specific payment method billing address. route details
Payment Method object
Object contains the different variables of information you may want to access when rendering an object.
Property | Definition |
---|---|
payment_method.billing_address array |
"address1": "101 Washington Street" "address2": "" "city": "Los Angeles" "company": "Recharge" "country": "United States" "country_code": "US" "first_name": "John" "last_name": "Doe" "phone": "5551231234" "province": "California" "zip": "90024" Returns billing address information.
|
payment_method.created_at string |
"payment_method.created_at": "2021-11-02T09:32:54" Timestamp of creation of the payment method. |
payment_method.customer_id number |
"payment_method.customer_id": 8187626 Unique customer identifier. |
payment_method.default boolean |
"payment_method.default": true If true, this is the default payment_method for a customer. |
payment_method.id number |
"payment_method.id": 12345675 Unique payment method id. |
payment_method.payment_details object |
"brand": "visa" "exp_month": "03" "exp_year": "2025" "last4": "1235" Returns the details of the payment method. Details may differ depending on payment_type of the Payment Method .
|
payment_method.payment_type string |
"payment_method.payment_type": "credit_card" Identifies the type of instrument used for the payment method. |
payment_method.processor_customer_token string |
"payment_method.processor_customer_token": "6877048897829" The customer token at the processor. |
payment_method.processor_name string |
"payment_method.processor_name": "shopify_payments" The name of the payment processor used for this payment method. |
payment_method.processor_payment_method_token string |
"payment_method.processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9a5" The payment token at the processor. |
payment_method.status string |
"payment_method.status": "valid" It identifies status of payment method. It can have unvalidated , valid , invalid or empty . |
payment_method.status_reason string |
"payment_method.status_reason": "null" Often used when invalid to provide background details in invalidity. |
payment_method.subscriptions array |
"payment_method.subscriptions": [] Identifies the subscriptions this payment method funds. |
payment_method.updated_at string |
"payment_method.updated_at": "2021-11-02T09:32:54" Timestamp for last update performed on the Payment Method. |
[GET] - List of Payment Methods
GET
/request_objects
(async () => {
let schema = '{ "customer": {}, "payment_methods": [], "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_methods": [], "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_methods": [], "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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9a6",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-29T12:34:48"
},
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9da6",
"status": "valid",
"status_reason": null,
"subscriptions": [
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": 1,
"created_at": "2023-03-23T20:49:06+00:00",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"deleted_at": null,
"expire_after_specific_number_of_charges": null,
"external_product_id": {
"ecommerce": "8184706793765"
},
"external_variant_id": {
"ecommerce": "44751516336421"
},
"first_charge_date": "2023-04-23T04:00:00+00:00",
"has_queued_charges": true,
"id": 345824707,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": false,
"next_charge_scheduled_at": "2023-04-27",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": 1,
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": "22.50",
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"sku": "apples",
"sku_override": false,
"status": "active",
"type": "subscription",
"updated_at": "2023-03-27T14:26:44+00:00",
"variant_title": null
}
],
"updated_at": "2023-03-23T16:49:06"
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Tue, 28 Mar 2023 11:47:13 GMT",
"use_single_payment_method": 0
}
}
This endpoint renders a template with a list of customer's specific payment methods and their details.
URL: {{ payment_methods_url }}
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/payment_methods?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/payment_methods?token=${window.customerToken}
Template file: payment_methods.html
Schema: '{ "customer": {}, "payment_methods": [], "store": {} }'
Available template objects:
[GET] - Retrieve a Payment Method
GET
/request_objects
(async () => {
let schema = '{ "customer": {}, "payment_methods": { "id": <int:payment_method_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_methods": { "id": <int:payment_method_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_methods": { "id": <int:payment_method_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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9a5",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-29T12:34:48"
},
"payment_methods": {
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"memberships": [],
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9a6",
"status": "valid",
"status_reason": null,
"subscriptions": [
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": 1,
"created_at": "2023-03-23T20:49:06+00:00",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"deleted_at": null,
"expire_after_specific_number_of_charges": null,
"external_product_id": {
"ecommerce": "8184706793765"
},
"external_variant_id": {
"ecommerce": "44751516336421"
},
"first_charge_date": "2023-04-23T04:00:00+00:00",
"has_queued_charges": true,
"id": 345824707,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": false,
"next_charge_scheduled_at": "2023-04-27",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": 1,
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": "22.50",
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"sku": "apples",
"sku_override": false,
"status": "active",
"type": "subscription",
"updated_at": "2023-03-27T14:26:44+00:00",
"variant_title": null
}
],
"updated_at": "2023-03-23T16:49:06"
},
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Tue, 28 Mar 2023 11:47:13 GMT",
"use_single_payment_method": 0
}
}
This endpoint renders a json object with the details of a single payment method of the customer.
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/payment_methods/<int:payment_method_id>?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/payment_methods/<int:payment_method_id>?token=${window.customerToken}
Available template objects:
[POST] - Update a Payment Method billing address details
POST
/payment_methods/<int:payment_method_id>
(async () => {
let url = '/tools/recurring/portal/<string:customer_hash>/payment_methods/<int:payment_method_id>' + '?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 = `/tools/recurring/portal/<string:customer_hash>/payment_methods/<int:payment_method_id>?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: `/tools/recurring/portal/<string:customer_hash>/payment_methods/<int:payment_method_id>'+ '?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
{
"payment_method": {
"billing_address": {
"address1": "101 Washington Street",
"address2": "",
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "John",
"last_name": "Doe",
"phone": "5551231234",
"province": "California",
"zip": "90024"
},
"created_at": "2023-01-18T16:17:59",
"customer_id": 25318308,
"default": true,
"id": 80243761,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 12,
"exp_year": 2034,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_MyrnkEy8nRKLV8",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1MRj174kseIcOIxK93JfrMLf",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-31T10:31:24"
}
}
This endpoint updates customer's billing address information.
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/payment_methods/<int:payment_method_id>?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/payment_methods/<int:payment_method_id>?token=${window.customerToken}
Template file: No available template files
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
Payment sources
Retrieve payment sources for a customer. Payment sources include billing address and credit card information.
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.
|
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": "cus_KFacH5FowQE5pT" 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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2022-07-15T11:23:34",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2022-07-15T11:23:42",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "9f042355f6fd2f41078e03e414b4a8",
"id": 90814485,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90009"
},
"created_at": "2022-07-15T11:35:16",
"customer_id": 90814485,
"default": true,
"id": 63893425,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 2,
"exp_year": 2031,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_M3yJI627c1uz65",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1LLqXqJ2zqHvZRd1k2Dp785b",
"status": "valid",
"status_reason": null,
"updated_at": "2023-04-04T14:09:22"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "5665176748167",
"tax_exempt": false,
"updated_at": "2023-04-04T14:10:24"
},
"payment_sources": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90009"
},
"card_brand": "visa",
"card_exp_month": 2,
"card_exp_year": 2031,
"card_last4": "4242",
"cardholder_name": "Recharge Test",
"customer_id": 90814485,
"has_card_error_in_dunning": false,
"id": 1,
"payment_method_id": 63893425,
"payment_token": "cus_M3yJI627c1uz65",
"payment_type": "credit",
"processor_name": "stripe",
"status": "active",
"status_reason": null
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "",
"header_logo_url": ""
},
"discount_input": false,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-04T18:11:27.203Z\"}",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": false,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": false,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": false,
"view_subscriptions": true
},
"has_shopify_connector": false,
"multicurrency_enabled": false,
"shop_id": 91836
},
"store": {
"bundles_enabled": false,
"checkout_logo_url": "",
"checkout_platform": "recharge",
"created_at": "Wed, 22 Jan 2020 09:09:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-test.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 91836,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-test.myshopify.com",
"name": "Recharge-test",
"payment_processor": "stripe",
"platform_domain": "recharge-test.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": "",
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) Eastern Time (US & Canada)",
"updated_at": "Tue, 04 Apr 2023 14:11:27 GMT",
"use_single_payment_method": 1
}
}
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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2022-07-15T11:23:34",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2022-07-15T11:23:42",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "9f042355f6fd2f41078e03e414b4a8",
"id": 90814485,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90009"
},
"created_at": "2022-07-15T11:35:16",
"customer_id": 90814485,
"default": true,
"id": 63893425,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 2,
"exp_year": 2031,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_M3yJI627c1uz5S",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1LLqXqJ2zqHvZRd1k2Dp785b",
"status": "valid",
"status_reason": null,
"updated_at": "2023-04-04T14:32:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "5665176748167",
"tax_exempt": false,
"updated_at": "2023-04-04T14:32:06"
},
"payment_sources": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90009"
},
"card_brand": "visa",
"card_exp_month": 2,
"card_exp_year": 2031,
"card_last4": "4242",
"cardholder_name": "Recharge Test",
"customer_id": 90814485,
"has_card_error_in_dunning": false,
"id": 1,
"payment_method_id": 63893425,
"payment_token": "cus_M3yJI627c1uz65",
"payment_type": "credit",
"processor_name": "stripe",
"status": "active",
"status_reason": null
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "",
"header_logo_url": ""
},
"discount_input": false,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-04T18:11:27.203Z\"}",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": false,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": false,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": false,
"view_subscriptions": true
},
"has_shopify_connector": false,
"multicurrency_enabled": false,
"shop_id": 91836
},
"store": {
"bundles_enabled": false,
"checkout_logo_url": "",
"checkout_platform": "recharge",
"created_at": "Wed, 22 Jan 2020 09:09:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": "USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 91836,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "stripe",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": "",
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) Eastern Time (US & Canada)",
"updated_at": "Tue, 04 Apr 2023 14:11:27 GMT",
"use_single_payment_method": 1
}
}
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
{
"billing_countries": [
{
"code": "AF",
"id": 1,
"name": "Afghanistan",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AX",
"id": 2,
"name": "Aland Islands",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AL",
"id": 3,
"name": "Albania",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "DZ",
"id": 4,
"name": "Algeria",
"province_label": "Province",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AD",
"id": 5,
"name": "Andorra",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AO",
"id": 6,
"name": "Angola",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AI",
"id": 7,
"name": "Anguilla",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AG",
"id": 8,
"name": "Antigua And Barbuda",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AR",
"id": 9,
"name": "Argentina",
"province_label": "Province",
"provinces": [
{
"code": "B",
"id": 1964,
"name": "Buenos Aires"
},
{
"code": "K",
"id": 1973,
"name": "Catamarca"
},
{
"code": "H",
"id": 1955,
"name": "Chaco"
},
{
"code": "U",
"id": 1969,
"name": "Chubut"
},
{
"code": "C",
"id": 2853,
"name": "Ciudad Aut\u00f3noma de Buenos Aires"
},
{
"code": "W",
"id": 1961,
"name": "Corrientes"
},
{
"code": "X",
"id": 1954,
"name": "C\u00f3rdoba"
}
...
],
"zip_label": "Postal code",
"zip_required": true
},
{
"code": "AM",
"id": 10,
"name": "Armenia",
"province_label": "Region",
"provinces": [],
"zip_label": "Postal code",
"zip_required": true
}
...
],
"customer": {
"accepts_marketing": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2022-07-15T11:23:34",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2022-07-15T11:23:42",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "9f042355f6fd2f41078e03e414b4a8",
"id": 90814485,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90009"
},
"created_at": "2022-07-15T11:35:16",
"customer_id": 90814485,
"default": true,
"id": 63893425,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 2,
"exp_year": 2031,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_M3yJI627c1uz6S",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1LLqXqJ2zqHvZRd1k2Dp78Sb",
"status": "valid",
"status_reason": null,
"updated_at": "2023-04-04T14:32:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "5665176748167",
"tax_exempt": false,
"updated_at": "2023-04-04T14:39:02"
},
"payment_sources": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90009"
},
"card_brand": "visa",
"card_exp_month": 2,
"card_exp_year": 2031,
"card_last4": "4242",
"cardholder_name": "Recharge Test",
"customer_id": 90814485,
"has_card_error_in_dunning": false,
"id": 1,
"payment_method_id": 63893425,
"payment_token": "cus_M3yJI627c1uz65",
"payment_type": "credit",
"processor_name": "stripe",
"status": "active",
"status_reason": null
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "",
"header_logo_url": ""
},
"discount_input": false,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-04T18:11:27.203Z\"}",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": false,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": false,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": false,
"view_subscriptions": true
},
"has_shopify_connector": false,
"multicurrency_enabled": false,
"shop_id": 91836
},
"store": {
"bundles_enabled": false,
"checkout_logo_url": "",
"checkout_platform": "recharge",
"created_at": "Wed, 22 Jan 2020 09:09:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": "USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 91836,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "stripe",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": "",
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) Eastern Time (US & Canada)",
"updated_at": "Tue, 04 Apr 2023 14:11:27 GMT",
"use_single_payment_method": 1
}
}
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 }}';
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 }}';
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 }}',
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": 0,
"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",
"can_add_payment_method": false,
"created_at": "2022-07-15T11:23:34",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2022-07-15T11:23:42",
"first_name": "John",
"has_card_error_in_dunning": false,
"has_valid_payment_method": true,
"hash": "9f042355f6fd2f41078e03e414b4a8",
"id": 90814485,
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"processor_type": "stripe",
"reason_payment_method_not_valid": null,
"shopify_customer_id": "5665176748167",
"status": "ACTIVE",
"stripe_customer_token": "cus_M3yJI627c1uz6S",
"tax_exempt": false,
"updated_at": "2023-04-04T15:18:54"
}
}
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.province_label string |
"billing_country.province_label": "State/territory" Province type label. |
billing_country.provinces array of objects |
"billing_country.provinces": [ "code": "ACT", "id": 2289 , "name": "Australian Capital Territory" ] Country provinces. |
billing_country.zip_label string |
"billing_country.zip_label": "Postcode" Zip type label. |
billing_country.zip_required boolean |
"billing_country.zip_required": true Indicates whether the zip is required. |
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 customer 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.collection_ids array |
"product.collection_ids": [] Array of collection ids. |
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 "image": { "large": "https://cdn.shopify.com/s/files/1/0017/8929/6710/products/1_f4b108dbf.jpg?v=1669052924" "medium": "https://cdn.shopify.com/s/files/1/0017/8929/6710/products/1_f4b108dbb.jpg?v=1669052924" "original": "https://cdn.shopify.com/s/files/1/0017/8929/6710/products/1_f4b108fbf.jpg?v=1669052924" "small": "https://cdn.shopify.com/s/files/1/0017/8929/6710/products/1_f4b108vff.jpg?v=1669052924" "sort_order": 1 } "inventory_management": "shopify" "inventory_policy": "deny" "inventory_quantity": 0 "option1": "Default Title" "option2": null "option3": null "position": 1 "presentment_prices":[ { "currency": "USD" "discounted_price": "38.55" "unit_price": "42.83" } { "currency": "CAD" "discounted_price": "9.89" "unit_price": "10.99" }] "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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d965",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-29T12:34:48"
},
"meta": {
"products": {
"next": null,
"previous": null
}
},
"products": [
{
"collection_id": null,
"collection_ids": [
145532
],
"created_at": "2023-03-23T16:18:21-04:00",
"discount_amount": 0.0,
"discount_type": "percentage",
"handle": "apple",
"id": 3076510,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/07365/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
{
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "",
"created_at": "2023-03-23T16:18:21-04:00",
"handle": "apple",
"image": {
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 2,
"shopify_id": 619018232580,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 3,
"shopify_id": 285814620818,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
}
],
"options": [
{
"name": "Color",
"position": 1,
"shopify_id": 10381482033445,
"shopify_product_id": 8184741265701,
"values": [
"Yellow",
"Red",
"Green"
]
}
],
"product_type": "",
"published_at": "2023-03-23T16:18:21-04:00",
"shopify_id": 8184741265701,
"tags": [
""
],
"title": "Apple",
"updated_at": "2023-03-27T09:35:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1999,
"option1": "Yellow",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646589221,
"shopify_image_id": 285814620818,
"shopify_product_id": 8184741265701,
"sku": "apple",
"taxable": true,
"title": "Yellow",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Red",
"option2": null,
"option3": null,
"position": 2,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646621989,
"shopify_image_id": 619018232580,
"shopify_product_id": 8184741265701,
"sku": "apple-2",
"taxable": true,
"title": "Red",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Green",
"option2": null,
"option3": null,
"position": 3,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646654757,
"shopify_image_id": 948690061543,
"shopify_product_id": 8184741265701,
"sku": "apple-3",
"taxable": true,
"title": "Green",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184741265701,
"subscription_defaults": {
"charge_interval_frequency": 7,
"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": [
"7"
],
"order_interval_unit": "day",
"storefront_purchase_options": "subscription_only"
},
"title": "Apple",
"updated_at": "2023-03-23T16:52:05"
},
{
"collection_id": null,
"collection_ids": [],
"created_at": "2023-03-23T15:40:47-04:00",
"discount_amount": 10.0,
"discount_type": "percentage",
"handle": "box-of-apples",
"id": 3076505,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612_small.jpg?v=1679600448",
"sort_order": 2
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "A box of red apples. 5 kilograms.",
"created_at": "2023-03-23T15:40:47-04:00",
"handle": "box-of-apples",
"image": {
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 2,
"shopify_id": 324204665638,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
}
],
"options": [
{
"name": "Title",
"position": 1,
"shopify_id": 10381440254245,
"shopify_product_id": 8184706793765,
"values": [
"Default Title"
]
}
],
"product_type": "",
"published_at": "2023-03-23T15:40:47-04:00",
"shopify_id": 8184706793765,
"tags": [
""
],
"title": "Box of apples",
"updated_at": "2023-03-27T15:15:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": null,
"created_at": "",
"fulfillment_service": "manual",
"grams": 5000.0,
"image": null,
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1997,
"option1": "Default Title",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "25.00",
"requires_shipping": true,
"shopify_id": 44751516336421,
"shopify_image_id": null,
"shopify_product_id": 8184706793765,
"sku": "apples",
"taxable": true,
"title": "Default Title",
"updated_at": "",
"weight": 5.0,
"weight_unit": "kg"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184706793765,
"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": null,
"order_day_of_week": null,
"order_interval_frequency_options": [
"1",
"2",
"3"
],
"order_interval_unit": "month",
"storefront_purchase_options": "subscription_and_onetime"
},
"title": "Box of apples",
"updated_at": "2023-03-23T16:40:51"
}
],
"products_count": {},
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Tue, 28 Mar 2023 11:47:13 GMT",
"use_single_payment_method": 0
}
}
This endpoint renders a template with a list of all products available customer 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 endpoint 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": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"cart_note": null,
"city": "Los Angeles",
"company": "",
"country": "United States",
"country_code": "US",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"deleted_at": null,
"discount_id": null,
"first_name": "John",
"id": 119355268,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d965",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"note_attributes": [],
"phone": "",
"presentment_currency": "USD",
"province": "California",
"shipping_lines_override": null,
"updated_at": "2023-03-27T11:53:25",
"zip": "90404"
}
],
"customer": {
"accepts_marketing": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d965",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-03-29T12:34:48"
},
"schedule": [
{
"date": "2023-04-27T00:00:00",
"orders": [
{
"charge": {
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-03-27T10:26:46",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": [],
"email": "john.Doe@gmail.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 784499621,
"last_name": "Doe",
"line_items": [
{
"grams": 5000,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448_large",
"medium": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448_medium",
"original": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448_small"
},
"original_price": "22.50",
"price": "22.50",
"properties": [],
"quantity": 1,
"shopify_product_id": "8184706793765",
"shopify_variant_id": "44751516336421",
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": "",
"vendor": "recharge-testing"
}
],
"note": "",
"note_attributes": [],
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-27T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"city": "Los Angeles",
"company": "",
"country": "United States",
"first_name": "John",
"last_name": "Doe",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": null,
"price": 19.9,
"source": "recharge",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": null,
"status": "QUEUED",
"sub_total": null,
"subtotal_price": "22.5",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.0,
"total_discounts": "0.00",
"total_duties": 0.0,
"total_line_items_price": "22.50",
"total_price": "42.40",
"total_refunds": null,
"total_tax": 0.0,
"total_weight": 5000.0,
"transaction_id": null,
"type": "RECURRING",
"updated_at": "2023-03-29T12:34:49"
},
"is_skippable": true,
"is_skipped": false,
"order": {},
"price": null,
"shipment_type": "PROJECTED_SHIPMENT",
"subscription": {
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_interval_frequency": "1",
"charge_interval_unit_type": "month",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"expire_after_specific_number_of_charges": null,
"has_queued_charges": 1,
"id": 345824707,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-27T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 22.5,
"product": {
"collection_id": null,
"collection_ids": [],
"created_at": "2023-03-23T15:40:47-04:00",
"discount_amount": 10.0,
"discount_type": "percentage",
"handle": "box-of-apples",
"id": 3076505,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612_small.jpg?v=1679600448",
"sort_order": 2
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "A box of red apples. 5 kilograms.",
"created_at": "2023-03-23T15:40:47-04:00",
"handle": "box-of-apples",
"image": {
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 2,
"shopify_id": 324204665638,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0765/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
}
],
"options": [
{
"name": "Title",
"position": 1,
"shopify_id": 10381440254245,
"shopify_product_id": 8184706793765,
"values": [
"Default Title"
]
}
],
"product_type": "",
"published_at": "2023-03-23T15:40:47-04:00",
"shopify_id": 8184706793765,
"tags": [
""
],
"title": "Box of apples",
"updated_at": "2023-03-27T15:15:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": null,
"created_at": "",
"fulfillment_service": "manual",
"grams": 5000.0,
"image": null,
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1997,
"option1": "Default Title",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "25.00",
"requires_shipping": true,
"shopify_id": 44751516336421,
"shopify_image_id": null,
"shopify_product_id": 8184706793765,
"sku": "apples",
"taxable": true,
"title": "Default Title",
"updated_at": "",
"weight": 5.0,
"weight_unit": "kg"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184706793765,
"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": null,
"order_day_of_week": null,
"order_interval_frequency_options": [
"1",
"2",
"3"
],
"order_interval_unit": "month",
"storefront_purchase_options": "subscription_and_onetime"
},
"title": "Box of apples",
"updated_at": "2023-03-23T16:40:51"
},
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-03-27T10:26:44",
"variant_title": ""
},
"title": "Box of apples"
}
]
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Tue, 28 Mar 2023 11:47:13 GMT",
"use_single_payment_method": 0
}
}
Delivery schedule dates are when your order will be placed. Future deliveries will be added to your schedule as the date approaches. This endpoint 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. route details
Settings object
Property | Definition |
---|---|
settings.customer_portal object |
"collection_ids": [] "custom_code": { "backend_portal": "" "credit_cart_update_page": "" "footer": "" "header": "" "header_logo_url": "" } "discount_input": true "edit_shipping_address": true "enable_membership_programs": false "force_customer_portal_accounts": true "hosted_customer_portal": true "inventory_behaviour": "bypass" "membership": { "allow_membership_cancellation_after": 0 "membership_cancellation_reason_optional": 1 } "onetime": { "available_products": "recharge_products" "enabled": true "shopify_collection_id": null "zero_inventory_purchase": true } "show_credits": false "subscription": { "add_product": true "cancel_subscription": true "cancellation_email_contact": "" "cancellation_enable_pause_options": true "cancellation_enable_pause_options_values": "{"duration_options":[{"frequency":1,"unit":"months"},{"frequency":2,"unit":"months"},{"frequency":3,"unit":"months"}],"enabled":1,"last_toggled_at":"2022-12-22T18:30:58.874Z"}" "cancellation_minimum_order_count": 0 "cancellation_reason_optional": true "change_product": true "change_quantity": true "change_variant": true "edit_order_frequency": "Any" "edit_scheduled_date": true "reactivate_subscription": true "skip_prepaid_order": true "skip_scheduled_order": true "zero_inventory_purchase": true } "view_memberships": true "view_order_schedule": true "view_recharge_payment_methods": false "shop_id": 177871 |
settings.has_shopify_connector boolean |
"settings.has_shopify_connector": false |
settings.multicurrency_enabled boolean |
"settings.multicurrency_enabled": 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": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": false,
"cancellation_enable_pause_options_values": "",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": true,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Any",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
}
}
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 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 shop object. route details
Shop object
Object contains the different variables of information you may want to access when rendering an object.
Property | Definition |
---|---|
shop.allow_customers_to_skip_delivery number |
"shop.allow_customers_to_skip_delivery": 0 Whether customer is allowed to skip a prepaid delivery or not. |
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 shop. |
shop.created_at string |
"shop.created_at": "Thu, 15 Feb 2018 11:53:56 GMT" Date and time when shop was created. |
shop.currency string |
"shop.currency": "USD" The currency of shop. |
shop.customer_portal_domain string |
"shop.customer_portal_domain": "" Domain used for customer portal. |
shop.disabled_currencies_historical array |
"shop.disabled_currencies_historical": [] A ledger of currencies that the shop no longer sells in. If a currency is present in both the enabled_presentment_currencies and disabled_currencies_historical ledger it is because it was disabled at one point in time but is now enabled. |
shop.domain string |
"shop.domain": "teststore.com" The domain of shop. |
shop.email string |
"shop.email": "store@teststore.com" The email of shop. |
shop.enabled_presentment_currencies array |
"shop.enabled_presentment_currencies": [ "USD" ] Enabled currencies the shop sells in. |
shop.enabled_presentment_currencies_symbols array |
"shop.enabled_presentment_currencies": [{ "currency": "USD" "location": "before" "suffix": " USD" "symbol": "$" }] Currency symbol used for enabled currencies the shop sells in. |
shop.external_platform string |
"shop.external_platform": "shopify" External platform on which shop 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.is_enterprise boolean |
"shop.is_enterprise": false Whether shop is enterprise or not. |
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.payment_processor string |
"shop.payment_processor": "teststore" Shop payment processor name. |
shop.platform_domain string |
"shop.platform_domain": "shopify_payments" 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.subscriptions_enabled number |
"shop.subscriptions_enabled": 1 Whether subscription widget is published or not. |
shop.test_mode boolean |
"shop.test_mode": true Whether payment processor is set to test mode or not. |
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. |
[GET] - Shop object
Shop object of the current shop.
Methods accepted: GET
Schema: '{ "shop": {} }'
GET
/request_objects
(async () => {
let schema = '{ "shop": {} }';
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 = '{ "shop": {} }';
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: '{ "shop": {} }' }
}).done(function(response) {
// Successful request made
console.log(response);
}).fail(function(response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"shop": {
"allow_customers_to_skip_delivery": 0,
"checkout_logo_url": null,
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"iana_timezone": "America/New_York",
"id": 177871,
"is_enterprise": false,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Wed, 05 Apr 2023 09:04:08 GMT"
}
}
Retrieve shop 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: '{ "shop": {} }'
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 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 store object. route details
Store object
Object contains the different variables of information you may want to access when rendering an object.
Property | Definition |
---|---|
store.bundles_enabled boolean |
"store.bundles_enabled": true Whether bundles are enabled on the store or not. |
store.checkout_logo_url string |
"store.checkout_logo_url": null 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 store was created. |
store.currency string |
"store.currency": "USD" The currency of store. |
store.customer_portal_domain string |
"" Customer portal domain. |
store.disabled_currencies_historical array |
"store.disabled_currencies_historical": [] A ledger of currencies that the store no longer sells in. If a currency is present in both the enabled_presentment_currencies and disabled_currencies_historical ledger it is because it was disabled at one point in time but is now enabled. |
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.enabled_presentment_currencies array |
"store.enabled_presentment_currencies": [ "USD" ] Enabled currencies the store sells in. |
store.enabled_presentment_currencies_symbols array |
"store.enabled_presentment_currencies": [{ "currency": "USD" "location": "before" "suffix": " USD" "symbol": "$" }] Currency symbol used for enabled currencies the store sells in. |
store.external_platform string |
"store.external_platform": "shopify" External platform of the store. |
store.has_preview_customer boolean |
"store.has_preview_customer": true Whether store has a preview customer or not. |
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.payment_processor string |
"store.payment_processor": "teststore" Store payment processor name. |
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.subscriptions_enabled number |
"store.subscriptions_enabled": 1 Whether subscription widget is published or not. |
store.test_mode boolean |
"store.test_mode": true Whether payment processor is set to test mode or not. |
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. |
store.use_single_payment_method number |
"store.use_single_payment_method": 0 Whether store supports single or multiple payment methods. |
[GET] - Store object
Store object of the current store.
Methods accepted: GET
Schema: '{ "store": {} }'
GET
/request_objects
(async () => {
let schema = '{ "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 = '{ "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: '{ "store": {} }' }
}).done(function(response) {
// Successful request made
console.log(response);
}).fail(function(response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Wed, 05 Apr 2023 09:04:08 GMT",
"use_single_payment_method": 0
}
}
Retrieve store 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: '{ "store": {} }'
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 %}
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 %}
—
{% 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 a form for creating a 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 endpoint cancels current subscription for the customer. route details
POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/activate
This endpoint 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 endpoint is used to change next charge date of subscription. route details
POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?pause=true
This endpoint is used to pause subscription. route details
POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/skip
This endpoint is used for skipping subscription. route details
POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/unskip
This endpoint is used to unskip subscription. route details
POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/swap
This endpoint is used to swap subscription. route details
POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/move/address/<int:address_id>
This endpoint updates the address that is tied to current subscription. route details
GET /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel/<int:retention_strategy_id>
This endpoint renders a template with retention strategy used for cancelling subscription. route details
POST /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/bundles
This endpoint is used to updates the bundle selections associated with a 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 available.
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. |
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.presentment_currency string |
"subscription.presentment_currency": "USD" The presentment currency of the subscription. |
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. |
[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": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"cart_note": null,
"city": "Los Angeles",
"company": "",
"country": "United States",
"country_code": "US",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"deleted_at": null,
"discount": {},
"discount_id": null,
"first_name": "John",
"id": 119355268,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d3",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"note_attributes": [],
"phone": "",
"presentment_currency": "USD",
"province": "California",
"shipping_lines_override": null,
"updated_at": "2023-04-03T15:37:07",
"zip": "90404"
}
],
"customer": {
"accepts_marketing": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d3",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 2,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-04-03T16:03:51"
},
"onetimes": [],
"settings": {
"customer_portal": {
"collection_ids": [
145532
],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": false,
"edit_shipping_address": false,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": false,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-03T19:19:46.671Z\"}",
"cancellation_minimum_order_count": 1,
"cancellation_reason_optional": false,
"change_product": false,
"change_quantity": false,
"change_variant": true,
"edit_order_frequency": "Prohibited",
"edit_scheduled_date": false,
"reactivate_subscription": false,
"skip_prepaid_order": true,
"skip_scheduled_order": false,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": false,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Wed, 05 Apr 2023 09:04:08 GMT",
"use_single_payment_method": 0
},
"subscriptions": [
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "7",
"created_at": "2023-04-03T15:24:20",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-27T00:00:00",
"has_queued_charges": 1,
"id": 349571928,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": false,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-27T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "7",
"order_interval_unit": "day",
"presentment_currency": "USD",
"price": 10.0,
"product": {
"collection_id": null,
"collection_ids": [
145532
],
"created_at": "2023-03-23T16:18:21-04:00",
"discount_amount": 0.0,
"discount_type": "percentage",
"handle": "apple",
"id": 3076510,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "",
"created_at": "2023-03-23T16:18:21-04:00",
"handle": "apple",
"image": {
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 2,
"shopify_id": 619018232580,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 3,
"shopify_id": 285814620818,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
}
],
"options": [
{
"name": "Color",
"position": 1,
"shopify_id": 10381482033445,
"shopify_product_id": 8184741265701,
"values": [
"Yellow",
"Red",
"Green"
]
}
],
"product_type": "",
"published_at": "2023-03-23T16:18:21-04:00",
"shopify_id": 8184741265701,
"tags": [
""
],
"title": "Apple",
"updated_at": "2023-03-27T09:35:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1999,
"option1": "Yellow",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646589221,
"shopify_image_id": 285814620818,
"shopify_product_id": 8184741265701,
"sku": "apple",
"taxable": true,
"title": "Yellow",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Red",
"option2": null,
"option3": null,
"position": 2,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646621989,
"shopify_image_id": 619018232580,
"shopify_product_id": 8184741265701,
"sku": "apple-2",
"taxable": true,
"title": "Red",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Green",
"option2": null,
"option3": null,
"position": 3,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646654757,
"shopify_image_id": 948690061543,
"shopify_product_id": 8184741265701,
"sku": "apple-3",
"taxable": true,
"title": "Green",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184741265701,
"subscription_defaults": {
"charge_interval_frequency": 7,
"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": [
"7"
],
"order_interval_unit": "day",
"storefront_purchase_options": "subscription_only"
},
"title": "Apple",
"updated_at": "2023-03-23T16:52:05"
},
"product_title": "Apple",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646621989,
"sku": "apple-2",
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-03T15:36:49",
"variant_title": "Red"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": "Other reason",
"cancellation_reason_comments": "",
"cancelled_at": "2023-04-03T16:02:50",
"charge_delay": null,
"charge_interval_frequency": "1",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-27T00:00:00",
"has_queued_charges": 0,
"id": 345824707,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": false,
"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",
"presentment_currency": "USD",
"price": 22.5,
"product": {
"collection_id": null,
"collection_ids": [],
"created_at": "2023-03-23T15:40:47-04:00",
"discount_amount": 10.0,
"discount_type": "percentage",
"handle": "box-of-apples",
"id": 3076505,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_small.jpg?v=1679600448",
"sort_order": 2
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "A box of red apples. 5 kilograms.",
"created_at": "2023-03-23T15:40:47-04:00",
"handle": "box-of-apples",
"image": {
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600440",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600440",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 2,
"shopify_id": 324204665638,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600440",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
}
],
"options": [
{
"name": "Title",
"position": 1,
"shopify_id": 10381440254245,
"shopify_product_id": 8184706793765,
"values": [
"Default Title"
]
}
],
"product_type": "",
"published_at": "2023-03-23T15:40:47-04:00",
"shopify_id": 8184706793765,
"tags": [
""
],
"title": "Box of apples",
"updated_at": "2023-03-27T15:15:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": null,
"created_at": "",
"fulfillment_service": "manual",
"grams": 5000.0,
"image": null,
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1997,
"option1": "Default Title",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "25.00",
"requires_shipping": true,
"shopify_id": 44751516336421,
"shopify_image_id": null,
"shopify_product_id": 8184706793765,
"sku": "apples",
"taxable": true,
"title": "Default Title",
"updated_at": "",
"weight": 5.0,
"weight_unit": "kg"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184706793765,
"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": null,
"order_day_of_week": null,
"order_interval_frequency_options": [
"1",
"2",
"3"
],
"order_interval_unit": "month",
"storefront_purchase_options": "subscription_and_onetime"
},
"title": "Box of apples",
"updated_at": "2023-03-23T16:40:51"
},
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"sku_override": false,
"status": "CANCELLED",
"updated_at": "2023-04-03T16:02:50",
"variant_title": ""
}
]
}
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": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"cart_note": null,
"city": "Los Angeles",
"company": "",
"country": "United States",
"country_code": "US",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"deleted_at": null,
"discount_id": null,
"first_name": "John",
"id": 119355268,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d9",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"note_attributes": [],
"phone": "",
"presentment_currency": "USD",
"province": "California",
"shipping_lines_override": null,
"subscriptions": [
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "7",
"created_at": "2023-04-03T15:24:20",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-27T00:00:00",
"has_queued_charges": 1,
"id": 349571928,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": false,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-27T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "7",
"order_interval_unit": "day",
"presentment_currency": "USD",
"price": 10.0,
"product_title": "Apple",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646621989,
"sku": "apple-2",
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-03T15:36:49",
"variant_title": "Red"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": "Other reason",
"cancellation_reason_comments": "",
"cancelled_at": "2023-04-03T16:02:50",
"charge_delay": null,
"charge_interval_frequency": "1",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-27T00:00:00",
"has_queued_charges": 0,
"id": 345824707,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": false,
"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",
"presentment_currency": "USD",
"price": 22.5,
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"sku_override": false,
"status": "CANCELLED",
"updated_at": "2023-04-03T16:02:50",
"variant_title": ""
}
],
"updated_at": "2023-04-03T15:37:07",
"zip": "90404"
}
],
"customer": {
"accepts_marketing": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d9",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 2,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-04-03T16:03:51"
},
"product": {
"collection_id": null,
"collection_ids": [
145532
],
"created_at": "2023-03-23T16:18:21-04:00",
"discount_amount": 0.0,
"discount_type": "percentage",
"handle": "apple",
"id": 3076510,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "",
"created_at": "2023-03-23T16:18:21-04:00",
"handle": "apple",
"image": {
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 2,
"shopify_id": 619018232580,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 3,
"shopify_id": 285814620818,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
}
],
"options": [
{
"name": "Color",
"position": 1,
"shopify_id": 10381482033445,
"shopify_product_id": 8184741265701,
"values": [
"Yellow",
"Red",
"Green"
]
}
],
"product_type": "",
"published_at": "2023-03-23T16:18:21-04:00",
"shopify_id": 8184741265701,
"tags": [
""
],
"title": "Apple",
"updated_at": "2023-03-27T09:35:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1999,
"option1": "Yellow",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646589221,
"shopify_image_id": 285814620818,
"shopify_product_id": 8184741265701,
"sku": "apple",
"taxable": true,
"title": "Yellow",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Red",
"option2": null,
"option3": null,
"position": 2,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646621989,
"shopify_image_id": 619018232580,
"shopify_product_id": 8184741265701,
"sku": "apple-2",
"taxable": true,
"title": "Red",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Green",
"option2": null,
"option3": null,
"position": 3,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646654757,
"shopify_image_id": 948690061543,
"shopify_product_id": 8184741265701,
"sku": "apple-3",
"taxable": true,
"title": "Green",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184741265701,
"subscription_defaults": {
"charge_interval_frequency": 7,
"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": [
"7"
],
"order_interval_unit": "day",
"storefront_purchase_options": "subscription_only"
},
"title": "Apple",
"updated_at": "2023-03-23T16:52:05"
},
"settings": {
"customer_portal": {
"collection_ids": [
145532
],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": false,
"edit_shipping_address": false,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": false,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-03T19:19:46.671Z\"}",
"cancellation_minimum_order_count": 1,
"cancellation_reason_optional": false,
"change_product": false,
"change_quantity": false,
"change_variant": true,
"edit_order_frequency": "Prohibited",
"edit_scheduled_date": false,
"reactivate_subscription": false,
"skip_prepaid_order": true,
"skip_scheduled_order": false,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": false,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Wed, 05 Apr 2023 14:39:47 GMT",
"use_single_payment_method": 0
}
}
This endpoint renders a template with a form for creating a 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 }}";
let data = {
shopify_variant_id: "44751646589221",
order_interval_frequency: "1",
order_interval_unit: "month",
charge_interval_frequency: 1,
next_charge_scheduled_at: "2023-12-26",
address_id: 119355268,
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 }}";
let data = {
shopify_variant_id: "44751646589221",
order_interval_frequency: "1",
order_interval_unit: "month",
charge_interval_frequency: 1,
next_charge_scheduled_at: "2023-12-26",
address_id: 119355268,
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 }}",
type: "post",
dataType: "json",
data: {
shopify_variant_id: "44751646589221",
order_interval_frequency: "1",
order_interval_unit: "month",
charge_interval_frequency: 1,
next_charge_scheduled_at: "2023-12-26",
address_id: 119355268,
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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "1",
"charge_interval_unit_type": "month",
"created_at": "2023-04-05T14:49:31",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-12-26T00:00:00",
"has_queued_charges": 1,
"id": 350437765,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": false,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-12-26T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 10.0,
"product_title": "Apple",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646589221,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-05T14:49:31",
"variant_title": "Yellow"
}
}
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": "1",
"next_charge_scheduled_at": "2023-05-09",
"order_interval_frequency": "1",
"order_interval_unit": "month",
"quantity": 1,
"shopify_variant_id": 44751646589221
},
{
"charge_interval_frequency": "2",
"next_charge_scheduled_at": "2023-05-10",
"order_interval_frequency": "2",
"order_interval_unit": "month",
"quantity": 1,
"shopify_variant_id": 44751646654757
},
]
}
*/
(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 = dataToSend;
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: "{{ 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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_interval_frequency": "1",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:16:37",
"customer_id": 108773672,
"email": null,
"expire_after_specific_number_of_charges": null,
"has_queued_charges": 1,
"id": 350748484,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-05-09T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 10.0,
"product_title": "Apple",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646589221,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:16:37",
"variant_title": "Yellow"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_interval_frequency": "2",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:16:37",
"customer_id": 108773672,
"email": null,
"expire_after_specific_number_of_charges": null,
"has_queued_charges": 1,
"id": 350748485,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-05-10T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "2",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 10.0,
"product_title": "Apple",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646654757,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:16:37",
"variant_title": "Green"
}
]
}
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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d9",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 1,
"number_subscriptions": 1,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-04-06T05:22:59"
},
"payment_sources": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"card_brand": "visa",
"card_exp_month": 11,
"card_exp_year": 2025,
"card_last4": "4242",
"cardholder_name": "Recharge Test",
"customer_id": 108773672,
"has_card_error_in_dunning": false,
"id": 1,
"payment_method_id": 86434505,
"payment_token": "6877048897829",
"payment_type": "credit",
"processor_name": "shopify_payments",
"status": "active",
"status_reason": null
}
],
"settings": {
"customer_portal": {
"collection_ids": [
145532
],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": false,
"edit_shipping_address": false,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": false,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-03T19:19:46.671Z\"}",
"cancellation_minimum_order_count": 1,
"cancellation_reason_optional": false,
"change_product": false,
"change_quantity": false,
"change_variant": true,
"edit_order_frequency": "Prohibited",
"edit_scheduled_date": false,
"reactivate_subscription": false,
"skip_prepaid_order": true,
"skip_scheduled_order": false,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": false,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Wed, 05 Apr 2023 14:39:47 GMT",
"use_single_payment_method": 0
},
"subscription": {
"address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"cart_note": null,
"city": "Los Angeles",
"company": "",
"country": "United States",
"country_code": "US",
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"deleted_at": null,
"discount_id": null,
"first_name": "John",
"id": 119355268,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d9",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"note_attributes": [],
"phone": "",
"presentment_currency": "USD",
"province": "California",
"shipping_lines_override": null,
"updated_at": "2023-04-06T05:22:58",
"zip": "90404"
},
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "1",
"created_at": "2023-04-06T05:22:58",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350750079,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": false,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 22.5,
"product": {
"collection_id": null,
"collection_ids": [],
"created_at": "2023-03-23T15:40:47-04:00",
"discount_amount": 10.0,
"discount_type": "percentage",
"handle": "box-of-apples",
"id": 3076505,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_small.jpg?v=1679600448",
"sort_order": 2
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "A box of red apples. 5 kilograms.",
"created_at": "2023-03-23T15:40:47-04:00",
"handle": "box-of-apples",
"image": {
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 2,
"shopify_id": 324204665638,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
}
],
"options": [
{
"name": "Title",
"position": 1,
"shopify_id": 10381440254245,
"shopify_product_id": 8184706793765,
"values": [
"Default Title"
]
}
],
"product_type": "",
"published_at": "2023-03-23T15:40:47-04:00",
"shopify_id": 8184706793765,
"tags": [
""
],
"title": "Box of apples",
"updated_at": "2023-03-27T15:15:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": null,
"created_at": "",
"fulfillment_service": "manual",
"grams": 5000.0,
"image": null,
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1997,
"option1": "Default Title",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "25.00",
"requires_shipping": true,
"shopify_id": 44751516336421,
"shopify_image_id": null,
"shopify_product_id": 8184706793765,
"sku": "apples",
"taxable": true,
"title": "Default Title",
"updated_at": "",
"weight": 5.0,
"weight_unit": "kg"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184706793765,
"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": null,
"order_day_of_week": null,
"order_interval_frequency_options": [
"1",
"2",
"3"
],
"order_interval_unit": "month",
"storefront_purchase_options": "subscription_and_onetime"
},
"title": "Box of apples",
"updated_at": "2023-03-23T16:40:51"
},
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:22:58",
"variant_title": ""
}
}
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 }}";
let data = {
charge_interval_frequency: "2",
order_interval_frequency: "2",
order_interval_unit: "month",
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 }}";
let data = {
charge_interval_frequency: "2",
order_interval_frequency: "2",
order_interval_unit: "month",
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 }}",
type: "post",
dataType: "json",
data: {
charge_interval_frequency: "2",
order_interval_frequency: "2",
order_interval_unit: "month",
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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "2",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:22:58",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350750079,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "2",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 22.5,
"product_title": "Box of apples",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:31:08",
"variant_title": ""
}
}
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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_interval_frequency": "3",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:22:58",
"customer_id": 108773672,
"email": null,
"expire_after_specific_number_of_charges": null,
"has_queued_charges": 1,
"id": 350750079,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 22.5,
"product_title": "Box of apples",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:36:42",
"variant_title": ""
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_interval_frequency": "3",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"email": null,
"expire_after_specific_number_of_charges": null,
"has_queued_charges": 1,
"id": 350752584,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 36.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:36:42",
"variant_title": ""
}
]
}
This endpoint bulk update subscription properties.
Methods accepted: POST
Embedded Route: /tools/recurring/portal/{{ customer.hash }}/addresses/<int:address_id>/subscriptions-bulk-update?token=${window.customerToken}
Hosted Route: /portal/{{ customer.hash }}/addresses/<int:address_id>/subscriptions-bulk-update?token=${window.customerToken}
Update quantity object:
Property | Type |
---|---|
id * | number |
quantity * | number |
Update address object:
Updating address using bulk update endpoint will delete all queued charges, since there are no more subscriptions tied to that address. As the address has been updated, new charges will have to be generated and calculated based on the frequencies and the date of the last success charge on that address.
Property | Type |
---|---|
id * | number |
address_id * | number |
Update frequency object:
Property | Type |
---|---|
id * | number |
order_interval_unit * | string |
order_interval_frequency * | number |
charge_interval_frequency * | number |
Update next charge date object:
Property | Type |
---|---|
id * | number |
next_charge_scheduled_at * | string |
Cancel subscriptions object:
Property | Type |
---|---|
id * | number |
status * | string |
cancellation_reason * | string |
cancellation_reason_comments * | string |
Reactivate subscriptions object:
Property | Type |
---|---|
id * | number |
status * | string |
[GET] - Cancel subscription
GET
/request_objects
(async () => {
let schema = '{ "subscription": { "id": <int:subscription_id> }, "retention_strategies": {}, "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> }, "retention_strategies": {}, "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> }, "retention_strategies": {}, "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": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d9",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 2,
"number_subscriptions": 2,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-04-06T05:32:18"
},
"retention_strategies": [
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "Other reason",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005873,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "Other reason",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I want a different product or variety",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005872,
"incentive_type": "swap_product",
"prevention_text": "Would you like to swap the product out for another item?",
"reason": "I want a different product or variety",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I no longer use this product",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005871,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "I no longer use this product",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I need it sooner",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005870,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "I need it sooner",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I already have more than I need",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005869,
"incentive_type": "skip_charge",
"prevention_text": "If you have more than you need, we can skip your upcoming order.",
"reason": "I already have more than I need",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "This was created by accident",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005868,
"incentive_type": "",
"prevention_text": "Would you care to provide any additional details?",
"reason": "This was created by accident",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "This is too expensive",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005867,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "This is too expensive",
"updated_at": "2023-03-23T16:35:13"
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-03T19:19:46.671Z\"}",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": false,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Limited",
"edit_scheduled_date": true,
"reactivate_subscription": false,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": false,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Thu, 06 Apr 2023 05:31:04 GMT",
"use_single_payment_method": 0
},
"subscription": {
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "3",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 36.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:36:42",
"variant_title": ""
}
}
This endpoint renders a template with all retention strategies for cancelling current subscription.
URL: {{ subscription_cancel_url }}
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel?token=${window.customerToken}
Template file: subscription_cancel.html
Schema: '{ "subscription": { "id": <int:subscription_id> }, "retention_strategies": {}, "customer": {}, "settings": {}, "store": {} }'
Available template objects:
[POST] - Cancel subscription
POST
/subscriptions/<int:subscription_id>/cancel
(async () => {
let url = "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/subscriptions/<int:subscription_id>/cancel" + '?token=' + window.customerToken;
let data = {
cancellation_reason: "cancellation_reason",
cancellation_reason_comments: "additional comment",
}
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 }}/subscriptions/<int:subscription_id>/cancel" + '?token=' + window.customerToken;
let data = {
cancellation_reason: "cancellation_reason",
cancellation_reason_comments: "additional comment",
}
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:
"{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash }}/subscriptions/<int:subscription_id>/cancel" + '?token=' + window.customerToken,
type: "post",
dataType: "json",
data: {
cancellation_reason: "cancellation_reason",
cancellation_reason_comments: "additional comment",
},
})
.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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": "cancellation_reason",
"cancellation_reason_comments": "additional comment",
"cancelled_at": "2023-04-06T05:41:34",
"charge_delay": null,
"charge_interval_frequency": "3",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 0,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": false,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": null,
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 36.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"sku_override": false,
"status": "CANCELLED",
"updated_at": "2023-04-06T05:41:34",
"variant_title": ""
}
}
This endpoint cancels current subscription for the customer.
URL: {{ subscription_cancel_url }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel?token=${window.customerToken}
Template file: subscription_cancel.html
Available template objects:
Arguments accepted:
Property | Type |
---|---|
cancellation_reason * | string |
cancellation_reason_comments | string |
* = required
[POST] - Activate subscription
POST
/subscriptions/<int:subscription_id>/activate
(async () => {
let url = "{{ subscription_activate_url }}";
try {
const response = await axios.post(url);
// Successful request made
console.log(response.data);
} catch (error) {
// Request failed
console.error(error);
}
})();
let url = "{{ subscription_activate_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: "{{ subscription_activate_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
{
"subscription": {
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "3",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 36.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:43:01",
"variant_title": ""
}
}
This endpoint activates or re-activates current subscription.
URL: {{ subscription_activate_url }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/activate?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/activate?token=${window.customerToken}
Template file: No template file
Available template objects: No available template objects
[POST] - Delay subscription
POST
/subscriptions/<int:subscription_id>/delay
(async () => {
let url = "{{ subscription_delay_url }}";
let data = {
delay_for: "2_month",
}
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_delay_url }}";
let data = {
delay_for: "2_month",
}
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_delay_url }}",
type: "post",
dataType: "json",
data: {
delay_for: "2_month",
},
})
.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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "3",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-06-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 36.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:43:01",
"variant_title": ""
}
}
This endpoint delays current subscription.
URL: {{ subscription_delay_url }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/delay?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/delay?token=${window.customerToken}
Template file: subscription_retention_strategy.html
Available template objects: No available template objects
Arguments accepted:
Property | Type |
---|---|
delay_for * | string |
* = required
[POST] - Subscription set next charge date
POST
/subscriptions/<int:subscription_id>/set_next_charge_date
(async () => {
let url = "{{ subscription_set_next_charge_date_url }}";
let data = {
date: "2023-10-01",
}
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_set_next_charge_date_url }}";
let data = {
date: "2023-10-01",
}
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_set_next_charge_date_url }}",
type: "post",
dataType: "json",
data: {
date: "2023-10-01",
},
})
.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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "3",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-10-01T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 36.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:43:01",
"variant_title": ""
}
}
This endpoint is used to change next charge date of subscription.
URL: {{ subscription_set_next_charge_date_url }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?token=${window.customerToken}
Template file: No template file
Available template objects: No available template objects
Arguments accepted:
Property | Type |
---|---|
Date * | string |
* = required
[POST] - Pause subscription
POST
/subscriptions/<int:subscription_id>/set_next_charge_date?pause=true
(async () => {
let url = "/tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?pause=true" + '&token=' + window.customerToken;
let data = {
date: "2023-11-01",
}
try {
const response = await axios.post(url, data);
// Successful request made
console.log(response.data);
} catch (error) {
// Request failed
console.error(error);
}
})();
let url = "/tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?pause=true" + '&token=' + window.customerToken;
let data = {
date: "2023-11-01",
}
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: "/tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?pause=true" + '&token=' + window.customerToken,
type: "post",
dataType: "json",
data: {
date: "2023-11-01",
},
})
.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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "3",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-11-01T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "3",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 36.0,
"product_title": "Box of pears",
"properties": [],
"quantity": 1,
"recharge_product_id": 3076509,
"shopify_product_id": 8184740184357,
"shopify_variant_id": 44751644295461,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:43:01",
"variant_title": ""
}
}
This endpoint is used to pause subscription.
URL: /subscriptions/<int:subscription_id>/set_next_charge_date?pause=true
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?pause=true&token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date?pause=true&token=${window.customerToken}
Template file: No template file
Available template objects: No available template objects
Arguments accepted:
Property | Type |
---|---|
date * | string |
* = required
[POST] - Skip subscription
POST
/subscriptions/<int:subscription_id>/skip
(async () => {
let url = "{{ subscription_skip_url }}";
try {
const response = await axios.post(url);
// Successful request made
console.log(response.data);
} catch (error) {
// Request failed
console.error(error);
}
})();
let url = "{{ subscription_skip_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: "{{ subscription_skip_url }}",
type: "post",
dataType: "json"
})
.done(function (response) {
// Successful request made
console.log(response);
})
.fail(function (response) {
// Request failed
console.log(response);
});
POST
/subscriptions/<int:subscription_id>/skip
(async () => {
let url = "{{ subscription_skip_url }}";
let data = {
date: "2023-06-06",
}
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_skip_url }}";
let data = {
date: "2023-06-06",
}
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_skip_url }}",
type: "post",
dataType: "json",
data: {
date: "2023-06-06",
},
})
.done(function (response) {
// Successful request made
console.log(response);
})
.fail(function (response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"charge": {
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-04-06T05:51:56",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": [],
"email": "john.Doe@gmail.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 792166719,
"last_name": "Doe",
"line_items": [
{
"grams": 0,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581_large",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581_medium",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581_small"
},
"original_price": "36.00",
"price": "36.00",
"properties": [],
"quantity": 1,
"shopify_product_id": "8184740184357",
"shopify_variant_id": "44751644295461",
"sku": "boxofpears",
"subscription_id": 350752584,
"tax_lines": [],
"title": "Box of pears",
"type": "SUBSCRIPTION",
"variant_title": "",
"vendor": "recharge-testing"
}
],
"note": "",
"note_attributes": [],
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-06-06T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"city": "Los Angeles",
"company": "",
"country": "United States",
"first_name": "John",
"last_name": "Doe",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": null,
"price": 4.9,
"source": "recharge",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": null,
"status": "SKIPPED",
"sub_total": null,
"subtotal_price": "36.0",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.0,
"total_discounts": "0.00",
"total_duties": 0.0,
"total_line_items_price": "36.00",
"total_price": "40.90",
"total_refunds": null,
"total_tax": 0.0,
"total_weight": 0.0,
"transaction_id": null,
"type": "RECURRING",
"updated_at": "2023-04-06T05:51:56"
}
}
This endpoint is used for skipping subscription.
URL: {{ subscription_skip_url }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/skip?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/skip?token=${window.customerToken}
Template file: No template file
Available template objects: No available template objects
[POST] - Unskip subscription
POST
/subscriptions/<int:subscription_id>/unskip
(async () => {
let url = "{{ subscription_unskip_url }}";
let data = {
charge_id: 792166719,
}
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_unskip_url }}";
let data = {
charge_id: 792166719,
}
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_unskip_url }}",
type: "post",
dataType: "json",
data: {
charge_id: 792166719,
},
})
.done(function (response) {
// Successful request made
console.log(response);
})
.fail(function (response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"charge": {
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-04-06T05:50:49",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": [],
"email": "john.Doe@gmail.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 792166461,
"last_name": "Doe",
"line_items": [
{
"grams": 5000,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448_large",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448_medium",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448_small"
},
"original_price": "22.50",
"price": "22.50",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"shopify_product_id": "8184706793765",
"shopify_variant_id": "44751516336421",
"sku": "apples",
"subscription_id": 350750079,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": "",
"vendor": "recharge-testing"
},
{
"grams": 0,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581_large",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581_medium",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-605745338-612x612_large.jpg?v=1679602581_small"
},
"original_price": "36.00",
"price": "36.00",
"properties": [],
"quantity": 1,
"shopify_product_id": "8184740184357",
"shopify_variant_id": "44751644295461",
"sku": "boxofpears",
"subscription_id": 350752584,
"tax_lines": [],
"title": "Box of pears",
"type": "SUBSCRIPTION",
"variant_title": "",
"vendor": "recharge-te-testing"
}
],
"note": "",
"note_attributes": [],
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-06T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"city": "Los Angeles",
"company": "",
"country": "United States",
"first_name": "John",
"last_name": "Doe",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": 0.0,
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": null,
"status": "QUEUED",
"sub_total": null,
"subtotal_price": "58.5",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.0,
"total_discounts": "0.00",
"total_duties": 0.0,
"total_line_items_price": "58.50",
"total_price": "58.50",
"total_refunds": null,
"total_tax": 0.0,
"total_weight": 5000.0,
"transaction_id": null,
"type": "RECURRING",
"updated_at": "2023-04-06T05:51:58"
}
}
This endpoint is used to unskip subscription.
URL: {{ subscription_unskip_url }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/unskip?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/unskip?token=${window.customerToken}
Template file: No template file
Available template objects: No available template objects
[POST] - Swap subscription
POST
/subscriptions/<int:subscription_id>/swap
(async () => {
let url = "{{ subscription_url }}";
let data = {
shopify_variant_id: 44751646589221,
"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 }}";
let data = {
shopify_variant_id: 44751646589221,
"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 }}",
type: "post",
dataType: "json",
data: {
shopify_variant_id: 44751646589221,
"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": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "1",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-11-01T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": null,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 10.0,
"product_title": "Apple",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646589221,
"sku": "apple",
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:59:29",
"variant_title": "Yellow"
}
}
This endpoint is used to swap subscription.
URL: {{ subscription_url }}
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/swap?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/swap?token=${window.customerToken}
Methods accepted: POST
Template file: subscription_swap.html
Available template objects:
Property | Type |
---|---|
Shopify variant ID * | number |
Properties | string |
* = required
[POST] - Update subscription address
POST
/subscriptions/<int:subscription_id>/move/address/<int:address_id>
(async () => {
let url = "{{ update_subscription_address }}";
try {
const response = await axios.post(url);
// Successful request made
console.log(response.data);
} catch (error) {
// Request failed
console.error(error);
}
})();
let url = "{{ update_subscription_address }}";
let options = {
method: "post"
}
fetch(url, options)
.then((response) => response.json())
.then((showData) => {
// Successful request made
console.log(showData);
})
.catch((error) => {
// Request failed
console.error(error);
});
$.ajax({
url: "{{ update_subscription_address }}",
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": "30 W Broadway",
"address2": null,
"cart_attributes": null,
"cart_note": null,
"city": "New York",
"company": "Recharge",
"country": "United States",
"country_code": "US",
"created_at": "2023-04-06T06:01:02",
"customer_id": 108773672,
"deleted_at": null,
"discount_id": null,
"first_name": "Jane",
"id": 120628498,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d3",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"note_attributes": null,
"original_shipping_lines": null,
"phone": "",
"presentment_currency": "USD",
"province": "New York",
"shipping_lines_override": null,
"updated_at": "2023-04-06T06:01:02",
"zip": "10007"
},
"path": "subscription",
"subscription": {
"address_id": 120628498,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "1",
"charge_interval_unit_type": "month",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 10.0,
"product_title": "Apple",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646589221,
"sku": "apple",
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T06:13:12",
"variant_title": "Yellow"
}
}
This endpoint updates the address that is tied to current subscription.
URL: {{ update_subscription_address }}
Methods accepted: POST
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/move/address/<int:address_id>?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/move/address/<int:address_id>?token=${window.customerToken}
Template file: No template file
Available template objects: No available template objects
[GET] - Subscription retention strategy
GET
/request_objects
(async () => {
let schema = '{ "customer": {}, "retention_strategies": {}, "subscription": { "id": <int:subscription_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": {}, "retention_strategies": {}, "subscription": { "id": <int:subscription_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": {}, "retention_strategies": {}, "subscription": { "id": <int:subscription_id> }, "settings": {}, "store": {} }',
},
})
.done(function (response) {
// Successful request made
window.console.log(response);
})
.fail(function (response) {
// Request failed
window.console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"customer": {
"accepts_marketing": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d3",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 2,
"number_subscriptions": 2,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-04-06T06:01:36"
},
"retention_strategies": [
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "Other reason",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005873,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "Other reason",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I want a different product or variety",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005872,
"incentive_type": "swap_product",
"prevention_text": "Would you like to swap the product out for another item?",
"reason": "I want a different product or variety",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I no longer use this product",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005871,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "I no longer use this product",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I need it sooner",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005870,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "I need it sooner",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "I already have more than I need",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005869,
"incentive_type": "skip_charge",
"prevention_text": "If you have more than you need, we can skip your upcoming order.",
"reason": "I already have more than I need",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "This was created by accident",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005868,
"incentive_type": "",
"prevention_text": "Would you care to provide any additional details?",
"reason": "This was created by accident",
"updated_at": "2023-03-23T16:35:13"
},
{
"cancellation_flow_type": "subscription",
"cancellation_reason": "This is too expensive",
"created_at": "2023-03-23T16:35:13",
"discount": null,
"discount_code": null,
"id": 2005867,
"incentive_type": "",
"prevention_text": "Please help us process your request by telling us why you're cancelling.",
"reason": "This is too expensive",
"updated_at": "2023-03-23T16:35:13"
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-03T19:19:46.671Z\"}",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": false,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Limited",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Thu, 06 Apr 2023 05:59:21 GMT",
"use_single_payment_method": 0
},
"subscription": {
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "1",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-11-01T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 10.0,
"product_title": "Apple",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646589221,
"sku": "apple",
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:59:29",
"variant_title": "Yellow"
}
}
This endpoint renders a template with retention strategy used for cancelling subscription.
URL: {{ retention_strategy_url }}
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel/<int:retention_strategy_id>?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel/<int:retention_strategy_id>?token=${window.customerToken}
Template file: subscription_retention_strategy.html
Schema: '{ "customer": {}, "retention_strategies": {}, "subscription": { "id": <int:subscription_id> }, "settings": {}, "store": {} }'
Available template objects:
[POST] - Update subscription bundle selections
POST
/subscriptions/<int:subscription_id>/bundles
(async () => {
let url = "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash}}/subscriptions/{{ subscription.id }}/bundles?token=" + window.customerToken;
let data = {
"bundle_selection": {
"selections": [
{
"collection_id": 285790863557,
"external_product_id": 7200063029445,
"external_variant_id": 41504993575109,
"quantity": 2
},
{
"collection_id": 288157827269,
"external_product_id": 7200061391045,
"external_variant_id": 41510929465541,
"quantity": 4
}
]
}
};
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}}/subscriptions/{{ subscription.id }}/bundles?token=" + window.customerToken;
let data = {
"bundle_selection": {
"selections": [
{
"collection_id": 285790863557,
"external_product_id": 7200063029445,
"external_variant_id": 41504993575109,
"quantity": 2
},
{
"collection_id": 288157827269,
"external_product_id": 7200061391045,
"external_variant_id": 41510929465541,
"quantity": 4
}
]
}
};
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: "{{ shopify_proxy_url if proxy_redirect else "" }}/portal/{{ customer.hash}}/subscriptions/{{ subscription.id }}/bundles?token=" + window.customerToken,
type: "post",
contentType: "application/json",
dataType: "json",
data: JSON.stringify({
"bundle_selection": {
"selections": [
{
"collection_id": 285790863557,
"external_product_id": 7200063029445,
"external_variant_id": 41504993575109,
"quantity": 2
},
{
"collection_id": 288157827269,
"external_product_id": 7200061391045,
"external_variant_id": 41510929465541,
"quantity": 4
}
]
}
}),
})
.done(function (response) {
// Successful request made
console.log(response);
})
.fail(function (response) {
// Request failed
console.log(response);
});
CLICK HERE TO SEE RESPONSE
{
"bundle_selection": {
"external_variant_id": 41507305652421,
"selections": [
{
"collection_id": 285790863557,
"external_product_id": 7200063029445,
"external_variant_id": 41504993575109,
"quantity": 2
},
{
"collection_id": 288157827269,
"external_product_id": 7200061391045,
"external_variant_id": 41510929465541,
"quantity": 4
}
]
}
}
This endpoint updates the bundle selections for a subscription.
The example request is updating the bundle selections for a bundle that requires two products from collection 285790863557
and four products from collection 288157827269
.
Bundle selections represent individual selections following the bundle rules configured in the admin.
Each bundle selection must contain the following attributes:
Property | Definition |
---|---|
selection.collection_id | The collection id from the external platform. The product must be present in the collection. |
selection.external_product_id | The product id from the external platform (e.g. Shopify product id). |
selection.external_variant_id | The variant id. It must belong to the product in external_product_id . |
selection.quantity | Quantity for this selection. |
Embedded Route: /tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/bundles?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/subscriptions/<int:subscription_id>/bundles?token=${window.customerToken}
Methods accepted: POST
Subscriptions FAQ
Num | Question | Answer |
---|---|---|
1. | Is it possible to link the charge and shipping frequency of one subscription product to another - i.e. I change the upcoming charge date or frequency of my main product, and the other falls in line to avoid them getting separated. Would this be achievable through TE? | Yes, this is achievable through TE if address_id is the same for both subscriptions as well as next_charge_scheduled_at . |
[GET] - Home overview page
GET
/request_objects
(async () => {
let schema = '{ "charges": [], "orders": [], "subscriptions": { "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 = '{ "charges": [], "orders": [], "subscriptions": { "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:
'{ "charges": [], "orders": [], "subscriptions": { "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
{
"charges": [
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-03-23T16:49:06",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": null,
"email": "john.doe@gmail.com",
"first_name": "Recharge",
"has_uncommited_changes": false,
"id": 781911618,
"include": {
"order_modifications": []
},
"last_name": "Test",
"line_items": [
{
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": "22.5",
"price": "22.5",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"processed_at": "2023-03-27T10:26:45",
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-23T00:00:00",
"shipments_count": 1,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": "19.90",
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": "5306443333925",
"status": "SUCCESS",
"subtotal_price": "22.5",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 2.31,
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": "44.71",
"total_refunds": null,
"total_tax": 2.31,
"total_weight": 5000,
"transaction_id": "26185564453",
"type": "RECURRING",
"updated_at": "2023-03-27T10:26:49"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": "87.116.133.224",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
},
"created_at": "2023-03-23T16:49:09",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": null,
"email": "test@rechargeapps.com",
"first_name": "Recharge",
"has_uncommited_changes": false,
"id": 781911636,
"include": {
"order_modifications": []
},
"last_name": "Test",
"line_items": [
{
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": "22.5",
"price": "22.5",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"processed_at": "2023-03-23T16:49:00",
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-03-23T00:00:00",
"shipments_count": 1,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": "19.90",
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": "5303853482277",
"status": "SUCCESS",
"subtotal_price": "22.5",
"tags": "Subscription, Subscription First Order",
"tax_lines": 2.32,
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": "44.72",
"total_refunds": null,
"total_tax": 2.32,
"total_weight": 5000,
"transaction_id": "Shopify Checkout",
"type": "CHECKOUT",
"updated_at": "2023-03-23T17:19:06"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-04-06T05:50:49",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": [],
"email": "john.Doe@gmail.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 792166461,
"include": {
"order_modifications": []
},
"last_name": "Doe",
"line_items": [
{
"grams": 5000,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": "22.50",
"price": "22.50",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"shopify_product_id": "8184706793765",
"shopify_variant_id": "44751516336421",
"sku": "apples",
"subscription_id": 350750079,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": "",
"vendor": "recharge-testing"
}
],
"note": "",
"note_attributes": [],
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-06T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"city": "Los Angeles",
"company": "",
"country": "United States",
"first_name": "John",
"last_name": "Doe",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": 19.9,
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": null,
"status": "QUEUED",
"subtotal_price": "22.5",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.0,
"total_discounts": "0.00",
"total_duties": 0.0,
"total_line_items_price": "22.50",
"total_price": "42.40",
"total_refunds": null,
"total_tax": 0.0,
"total_weight": 5000.0,
"transaction_id": null,
"type": "RECURRING",
"updated_at": "2023-04-06T06:13:15"
},
{
"address_id": 120628498,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-04-06T06:13:13",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": [],
"email": "john.Doe@gmail.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 792174490,
"include": {
"order_modifications": []
},
"last_name": "Doe",
"line_items": [
{
"grams": 0,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_small.jpg?v=1679602702"
},
"original_price": "10.00",
"price": "10.00",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"shopify_product_id": "8184741265701",
"shopify_variant_id": "44751646589221",
"sku": "apple",
"subscription_id": 350752584,
"tax_lines": [],
"title": "Apple",
"type": "SUBSCRIPTION",
"variant_title": "Yellow",
"vendor": "recharge-testing"
}
],
"note": "",
"note_attributes": null,
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-06T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "30 W Broadway",
"address2": null,
"city": "New York",
"company": "Recharge",
"country": "United States",
"first_name": "Jane",
"last_name": "Doe",
"phone": "",
"province": "New York",
"zip": "10007"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": 4.9,
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": null,
"status": "QUEUED",
"subtotal_price": "10.0",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.0,
"total_discounts": "0.00",
"total_duties": 0.0,
"total_line_items_price": "10.00",
"total_price": "14.90",
"total_refunds": null,
"total_tax": 0.0,
"total_weight": 0.0,
"transaction_id": null,
"type": "RECURRING",
"updated_at": "2023-04-06T06:13:17"
}
],
"customer": {
"accepts_marketing": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d3",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 2,
"number_subscriptions": 2,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-04-06T06:01:36"
},
"orders": [
{
"address_id": 119355268,
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"browser_ip": null,
"charge_id": 781911618,
"charge_status": "SUCCESS",
"created_at": "2023-03-27T10:26:39",
"currency": "USD",
"customer": {
"accepts_marketing": false,
"email": "john.doe@gmail.com",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"send_email_welcome": false,
"verified_email": true
},
"customer_id": 108773672,
"discount_codes": null,
"email": "john.doe@gmail.com",
"error": null,
"first_name": "Recharge",
"hash": "533c2671591dab35734e25b1d00140",
"id": 512504981,
"include": {
"order_modifications": []
},
"is_prepaid": 0,
"last_name": "Test",
"line_items": [
{
"external_inventory_policy": "decrement_obeying_policy",
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": 22.5,
"price": 22.5,
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"processed_at": "2023-03-27T10:26:45",
"scheduled_at": "2023-04-23T00:00:00",
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"price": "19.90",
"source": "shopify",
"title": "Economy"
}
],
"shopify_cart_token": null,
"shopify_customer_id": "6877048897829",
"shopify_order_id": "5306443333925",
"shopify_order_number": 1003,
"status": "SUCCESS",
"subtotal_price": 22.5,
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": [
{
"channel_liable": null,
"price": "0.51",
"price_set": {
"store_default": {
"amount": "0.51",
"currency_code": "USD"
}
},
"rate": 0.0225,
"title": "Los Angeles County Tax"
},
{
"channel_liable": null,
"price": "1.63",
"price_set": {
"store_default": {
"amount": "1.63",
"currency_code": "USD"
}
},
"rate": 0.0725,
"title": "California State Tax"
},
{
"channel_liable": null,
"price": "0.17",
"price_set": {
"store_default": {
"amount": "0.17",
"currency_code": "USD"
}
},
"rate": 0.0075,
"title": "Santa Monica City Tax"
}
],
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": 44.71,
"total_refunds": null,
"total_tax": 2.31,
"total_weight": 5000,
"transaction_id": "26185564453",
"type": "RECURRING",
"updated_at": "2023-03-27T10:26:49"
},
{
"address_id": 119355268,
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"browser_ip": "87.116.133.224",
"charge_id": 781911636,
"charge_status": "SUCCESS",
"created_at": "2023-03-23T16:49:09",
"currency": "USD",
"customer": {
"accepts_marketing": false,
"email": "test@rechargeapps.com",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"send_email_welcome": false,
"verified_email": true
},
"customer_id": 108773672,
"discount_codes": null,
"email": "test@rechargeapps.com",
"error": null,
"first_name": "Recharge",
"hash": "533c2671591dab35734e25b1d00140",
"id": 510852658,
"include": {
"order_modifications": []
},
"is_prepaid": 0,
"last_name": "Test",
"line_items": [
{
"external_inventory_policy": "decrement_obeying_policy",
"images": {
"large": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0736/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": 22.5,
"price": 22.5,
"product_title": "Box of apples",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"processed_at": "2023-03-23T16:49:00",
"scheduled_at": "2023-03-23T00:00:00",
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"price": "19.90",
"source": "shopify",
"title": "Economy"
}
],
"shopify_cart_token": null,
"shopify_customer_id": "6877048897829",
"shopify_order_id": "5303853482277",
"shopify_order_number": 1001,
"status": "SUCCESS",
"subtotal_price": 22.5,
"tags": "Subscription, Subscription First Order",
"tax_lines": [
{
"channel_liable": false,
"price": "0.06",
"price_set": {
"store_default": {
"amount": "0.06",
"currency_code": "USD"
}
},
"rate": 0.0025,
"title": "Los Angeles County Tax"
},
{
"channel_liable": false,
"price": "0.23",
"price_set": {
"store_default": {
"amount": "0.23",
"currency_code": "USD"
}
},
"rate": 0.01,
"title": "Santa Monica City Tax"
},
{
"channel_liable": false,
"price": "0.45",
"price_set": {
"store_default": {
"amount": "0.45",
"currency_code": "USD"
}
},
"rate": 0.02,
"title": "Los Angeles County District Tax Sp"
},
{
"channel_liable": false,
"price": "0.23",
"price_set": {
"store_default": {
"amount": "0.23",
"currency_code": "USD"
}
},
"rate": 0.01,
"title": "Los Angeles Co Local Tax Sl"
},
{
"channel_liable": false,
"price": "1.35",
"price_set": {
"store_default": {
"amount": "1.35",
"currency_code": "USD"
}
},
"rate": 0.06,
"title": "California State Tax"
}
],
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": 44.72,
"total_refunds": null,
"total_tax": 2.32,
"total_weight": 5000,
"transaction_id": "Shopify Checkout",
"type": "CHECKOUT",
"updated_at": "2023-03-23T17:19:06"
}
],
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-03T19:19:46.671Z\"}",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": false,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Limited",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "test@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Thu, 06 Apr 2023 05:59:21 GMT",
"use_single_payment_method": 0
},
"subscriptions": [
{
"address_id": 120628498,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "1",
"created_at": "2023-04-06T05:32:17",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": 6,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350752584,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": 10,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 10.0,
"product": {
"collection_id": null,
"collection_ids": [
145532
],
"created_at": "2023-03-23T16:18:21-04:00",
"discount_amount": 0.0,
"discount_type": "percentage",
"handle": "apple",
"id": 3076510,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "",
"created_at": "2023-03-23T16:18:21-04:00",
"handle": "apple",
"image": {
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 1,
"shopify_id": 948690061543,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 2,
"shopify_id": 619018232580,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T16:18:21-04:00",
"height": null,
"position": 3,
"shopify_id": 285814620818,
"shopify_product_id": 8184741265701,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"updated_at": "2023-03-27T09:35:13-04:00",
"width": null
}
],
"options": [
{
"name": "Color",
"position": 1,
"shopify_id": 10381482033445,
"shopify_product_id": 8184741265701,
"values": [
"Yellow",
"Red",
"Green"
]
}
],
"product_type": "",
"published_at": "2023-03-23T16:18:21-04:00",
"shopify_id": 8184741265701,
"tags": [
""
],
"title": "Apple",
"updated_at": "2023-03-27T09:35:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/yellow-apple_small.jpg?v=1679602703",
"sort_order": 3
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1999,
"option1": "Yellow",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646589221,
"shopify_image_id": 285814620818,
"shopify_product_id": 8184741265701,
"sku": "apple",
"taxable": true,
"title": "Yellow",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_large.jpg?v=1679602703",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_medium.jpg?v=1679602703",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple.jpg?v=1679602703",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/Red_Apple_small.jpg?v=1679602703",
"sort_order": 2
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Red",
"option2": null,
"option3": null,
"position": 2,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646621989,
"shopify_image_id": 619018232580,
"shopify_product_id": 8184741265701,
"sku": "apple-2",
"taxable": true,
"title": "Red",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
},
{
"barcode": "",
"compare_at_price": "13.00",
"created_at": "",
"fulfillment_service": "manual",
"grams": 0,
"image": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_small.jpg?v=1679602702",
"sort_order": 1
},
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 2000,
"option1": "Green",
"option2": null,
"option3": null,
"position": 3,
"presentment_prices": null,
"price": "10.00",
"requires_shipping": true,
"shopify_id": 44751646654757,
"shopify_image_id": 948690061543,
"shopify_product_id": 8184741265701,
"sku": "apple-3",
"taxable": true,
"title": "Green",
"updated_at": "",
"weight": 0.0,
"weight_unit": "lb"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184741265701,
"subscription_defaults": {
"charge_interval_frequency": 7,
"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": [
"7"
],
"order_interval_unit": "day",
"storefront_purchase_options": "subscription_only"
},
"title": "Apple",
"updated_at": "2023-03-23T16:52:05"
},
"product_title": "Apple",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076510,
"shopify_product_id": 8184741265701,
"shopify_variant_id": 44751646589221,
"sku": "apple",
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T06:13:12",
"variant_title": "Yellow"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"cancellation_reason": null,
"cancellation_reason_comments": null,
"cancelled_at": null,
"charge_delay": null,
"charge_interval_frequency": "1",
"created_at": "2023-04-06T05:22:58",
"customer_id": 108773672,
"cutoff_day_of_month_before_and_after": null,
"cutoff_day_of_week_before_and_after": null,
"email": "john.Doe@gmail.com",
"expire_after_specific_number_of_charges": null,
"first_charge_date": "2023-04-06T00:00:00",
"has_queued_charges": 1,
"id": 350750079,
"is_prepaid": false,
"is_skippable": true,
"is_swappable": true,
"locked_pending_charge_id": 0,
"max_retries_reached": 0,
"next_charge_scheduled_at": "2023-04-06T00:00:00",
"order_day_of_month": null,
"order_day_of_week": null,
"order_interval_frequency": "1",
"order_interval_unit": "month",
"presentment_currency": "USD",
"price": 22.5,
"product": {
"collection_id": null,
"collection_ids": [],
"created_at": "2023-03-23T15:40:47-04:00",
"discount_amount": 10.0,
"discount_type": "percentage",
"handle": "box-of-apples",
"id": 3076505,
"images": [
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448",
"sort_order": 1
},
{
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612_small.jpg?v=1679600448",
"sort_order": 2
}
],
"inventory_policy": null,
"shopify_details": {
"body_html": "A box of red apples. 5 kilogrames.",
"created_at": "2023-03-23T15:40:47-04:00",
"handle": "box-of-apples",
"image": {
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
"images": [
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 1,
"shopify_id": 787006419720,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
},
{
"alt": null,
"created_at": "2023-03-23T15:40:47-04:00",
"height": null,
"position": 2,
"shopify_id": 324204665638,
"shopify_product_id": 8184706793765,
"shopify_variant_ids": [],
"src": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351928-612x612.jpg?v=1679600448",
"updated_at": "2023-03-27T15:15:13-04:00",
"width": null
}
],
"options": [
{
"name": "Title",
"position": 1,
"shopify_id": 10381440254245,
"shopify_product_id": 8184706793765,
"values": [
"Default Title"
]
}
],
"product_type": "",
"published_at": "2023-03-23T15:40:47-04:00",
"shopify_id": 8184706793765,
"tags": [
""
],
"title": "Box of apples",
"updated_at": "2023-03-27T15:15:13-04:00",
"variants": [
{
"barcode": "",
"compare_at_price": null,
"created_at": "",
"fulfillment_service": "manual",
"grams": 5000.0,
"image": null,
"inventory_management": "shopify",
"inventory_policy": "deny",
"inventory_quantity": 1997,
"option1": "Default Title",
"option2": null,
"option3": null,
"position": 1,
"presentment_prices": null,
"price": "25.00",
"requires_shipping": true,
"shopify_id": 44751516336421,
"shopify_image_id": null,
"shopify_product_id": 8184706793765,
"sku": "apples",
"taxable": true,
"title": "Default Title",
"updated_at": "",
"weight": 5.0,
"weight_unit": "kg"
}
],
"vendor": "recharge-testing"
},
"shopify_product_id": 8184706793765,
"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": null,
"order_day_of_week": null,
"order_interval_frequency_options": [
"1",
"2",
"3"
],
"order_interval_unit": "month",
"storefront_purchase_options": "subscription_and_onetime"
},
"title": "Box of apples",
"updated_at": "2023-03-23T16:40:51"
},
"product_title": "Box of apples",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"recharge_product_id": 3076505,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": null,
"sku_override": false,
"status": "ACTIVE",
"updated_at": "2023-04-06T05:50:49",
"variant_title": ""
}
]
}
This endpoint renders a template that provides the customer a quick summary of their account.
URL: {{ home_overview_url }}
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/overview?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/overview?token=${window.customerToken}
Template file: home_overview.html
Schema: '{ "charges": [], "orders": [], "subscriptions": { "product": {} }, "customer": {}, "settings": {}, "store": {} }'
Available template objects:
[GET] - Manage order page
GET
/request_objects
(async () => {
let schema = '{ "charges": [], "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 = '{ "charges": [], "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:
'{ "charges": [], "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
{
"charges": [
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-03-23T16:49:06",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": null,
"email": "john.doe@gmail.com",
"first_name": "Recharge",
"has_uncommited_changes": false,
"id": 781911618,
"include": {
"order_modifications": []
},
"last_name": "Test",
"line_items": [
{
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": "22.5",
"price": "22.5",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"processed_at": "2023-03-27T10:26:45",
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-23T00:00:00",
"shipments_count": 1,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": "19.90",
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": "5306443333925",
"status": "SUCCESS",
"subtotal_price": "22.5",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 2.31,
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": "44.71",
"total_refunds": null,
"total_tax": 2.31,
"total_weight": 5000,
"transaction_id": "26185564453",
"type": "RECURRING",
"updated_at": "2023-03-27T10:26:49"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": "87.116.133.224",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
},
"created_at": "2023-03-23T16:49:09",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": null,
"email": "test@rechargeapps.com",
"first_name": "Recharge",
"has_uncommited_changes": false,
"id": 781911636,
"include": {
"order_modifications": []
},
"last_name": "Test",
"line_items": [
{
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": "22.5",
"price": "22.5",
"properties": [],
"quantity": 1,
"shopify_product_id": 8184706793765,
"shopify_variant_id": 44751516336421,
"sku": "apples",
"subscription_id": 345824707,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": ""
}
],
"note": null,
"note_attributes": [],
"processed_at": "2023-03-23T16:49:00",
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-03-23T00:00:00",
"shipments_count": 1,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": "19.90",
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": "5303853482277",
"status": "SUCCESS",
"subtotal_price": "22.5",
"tags": "Subscription, Subscription First Order",
"tax_lines": 2.32,
"total_discounts": 0.0,
"total_duties": 0.0,
"total_line_items_price": 22.5,
"total_price": "44.72",
"total_refunds": null,
"total_tax": 2.32,
"total_weight": 5000,
"transaction_id": "Shopify Checkout",
"type": "CHECKOUT",
"updated_at": "2023-03-23T17:19:06"
},
{
"address_id": 119355268,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-04-06T05:50:49",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": [],
"email": "john.Doe@gmail.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 792166461,
"include": {
"order_modifications": []
},
"last_name": "Doe",
"line_items": [
{
"grams": 5000,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_large.jpg?v=1679600448",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_medium.jpg?v=1679600448",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612.jpg?v=1679600448",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/istockphoto-604351742-612x612_small.jpg?v=1679600448"
},
"original_price": "22.50",
"price": "22.50",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"shopify_product_id": "8184706793765",
"shopify_variant_id": "44751516336421",
"sku": "apples",
"subscription_id": 350750079,
"tax_lines": [],
"title": "Box of apples",
"type": "SUBSCRIPTION",
"variant_title": "",
"vendor": "recharge-testing"
}
],
"note": "",
"note_attributes": [],
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-06T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": "",
"city": "Los Angeles",
"company": "",
"country": "United States",
"first_name": "John",
"last_name": "Doe",
"phone": "",
"province": "California",
"zip": "90404"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": 19.9,
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": null,
"status": "QUEUED",
"subtotal_price": "22.5",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.0,
"total_discounts": "0.00",
"total_duties": 0.0,
"total_line_items_price": "22.50",
"total_price": "42.40",
"total_refunds": null,
"total_tax": 0.0,
"total_weight": 5000.0,
"transaction_id": null,
"type": "RECURRING",
"updated_at": "2023-04-06T06:13:15"
},
{
"address_id": 120628498,
"analytics_data": {
"utm_params": []
},
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"client_details": {
"browser_ip": null,
"user_agent": null
},
"created_at": "2023-04-06T06:13:13",
"currency": "USD",
"customer_hash": "533c2671591dab35734e25b1d00140",
"customer_id": 108773672,
"discount_codes": [],
"email": "john.Doe@gmail.com",
"first_name": "John",
"has_uncommited_changes": false,
"id": 792174490,
"include": {
"order_modifications": []
},
"last_name": "Doe",
"line_items": [
{
"grams": 0,
"images": {
"large": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_large.jpg?v=1679602702",
"medium": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_medium.jpg?v=1679602702",
"original": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox.jpg?v=1679602702",
"small": "https://cdn.shopify.com/s/files/1/0730/8219/0629/products/farmbox_small.jpg?v=1679602702"
},
"original_price": "10.00",
"price": "10.00",
"properties": [
{
"name": "key-prop",
"value": "value-prop"
}
],
"quantity": 1,
"shopify_product_id": "8184741265701",
"shopify_variant_id": "44751646589221",
"sku": "apple",
"subscription_id": 350752584,
"tax_lines": [],
"title": "Apple",
"type": "SUBSCRIPTION",
"variant_title": "Yellow",
"vendor": "recharge-te-testing"
}
],
"note": "",
"note_attributes": null,
"processor_name": "shopify_payments",
"requires_shipping": true,
"scheduled_at": "2023-04-06T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "30 W Broadway",
"address2": null,
"city": "New York",
"company": "Recharge",
"country": "United States",
"first_name": "Jane",
"last_name": "Doe",
"phone": "",
"province": "New York",
"zip": "10007"
},
"shipping_lines": [
{
"code": "Economy",
"description": "",
"price": 4.9,
"source": "shopify",
"tax_lines": [],
"title": "Economy"
}
],
"shopify_order_id": null,
"status": "QUEUED",
"subtotal_price": "10.0",
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.0,
"total_discounts": "0.00",
"total_duties": 0.0,
"total_line_items_price": "10.00",
"total_price": "14.90",
"total_refunds": null,
"total_tax": 0.0,
"total_weight": 0.0,
"transaction_id": null,
"type": "RECURRING",
"updated_at": "2023-04-06T06:13:17"
}
],
"customer": {
"accepts_marketing": 0,
"analytics_data": {
"utm_params": []
},
"can_add_payment_method": false,
"created_at": "2023-03-23T16:49:05",
"deleted_at": null,
"email": "john.Doe@gmail.com",
"external_sync": null,
"first_charge_processed_at": "2023-03-23T16:49:00",
"first_name": "John",
"has_card_error_in_dunning": false,
"hash": "533c2671591dab35734e25b1d00140",
"id": 108773672,
"include": {
"payment_methods": [
{
"billing_address": {
"address1": "3030 Nebraska Ave. Santa Monica",
"address2": null,
"city": "Los Angeles",
"company": null,
"country": "United States",
"country_code": "US",
"first_name": "Recharge",
"last_name": "Test",
"phone": null,
"province": "California",
"zip": "90404"
},
"created_at": "2023-03-23T16:49:06",
"customer_id": 108773672,
"default": true,
"id": 86434505,
"include": {},
"payment_details": {
"brand": "visa",
"exp_month": 11,
"exp_year": 2025,
"last4": "4242"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "6877048897829",
"processor_name": "shopify_payments",
"processor_payment_method_token": "gid://shopify/CustomerPaymentMethod/b7d03f38229e50d9702c9af9e462d9d9",
"status": "valid",
"status_reason": null,
"updated_at": "2023-03-23T16:49:06"
}
]
},
"last_name": "Doe",
"number_active_subscriptions": 2,
"number_subscriptions": 2,
"phone": null,
"shopify_customer_id": "6877048897829",
"tax_exempt": false,
"updated_at": "2023-04-06T06:01:36"
},
"settings": {
"customer_portal": {
"collection_ids": [],
"custom_code": {
"backend_portal": "",
"credit_cart_update_page": "",
"footer": "",
"header": "<style></style>",
"header_logo_url": null
},
"discount_input": true,
"edit_shipping_address": true,
"enable_membership_programs": false,
"force_customer_portal_accounts": false,
"hosted_customer_portal": false,
"inventory_behaviour": "decrement_obeying_policy",
"membership": {
"allow_membership_cancellation_after": 0,
"membership_cancellation_reason_optional": 1
},
"onetime": {
"available_products": "recharge_products",
"enabled": true,
"shopify_collection_id": null,
"zero_inventory_purchase": true
},
"show_credits": false,
"subscription": {
"add_product": true,
"cancel_subscription": true,
"cancellation_email_contact": "",
"cancellation_enable_pause_options": true,
"cancellation_enable_pause_options_values": "{\"duration_options\":[{\"frequency\":1,\"unit\":\"months\"},{\"frequency\":2,\"unit\":\"months\"},{\"frequency\":3,\"unit\":\"months\"}],\"enabled\":1,\"last_toggled_at\":\"2023-04-03T19:19:46.671Z\"}",
"cancellation_minimum_order_count": 0,
"cancellation_reason_optional": false,
"change_product": true,
"change_quantity": true,
"change_variant": true,
"edit_order_frequency": "Limited",
"edit_scheduled_date": true,
"reactivate_subscription": true,
"skip_prepaid_order": true,
"skip_scheduled_order": true,
"zero_inventory_purchase": true
},
"view_memberships": true,
"view_order_schedule": true,
"view_recharge_payment_methods": true,
"view_subscriptions": true
},
"has_shopify_connector": true,
"multicurrency_enabled": false,
"shop_id": 177871
},
"store": {
"bundles_enabled": true,
"checkout_logo_url": null,
"checkout_platform": "shopify",
"created_at": "Thu, 23 Mar 2023 16:34:57 GMT",
"currency": "USD",
"customer_portal_domain": "",
"disabled_currencies_historical": [],
"domain": "recharge-testing.myshopify.com",
"email": "tesy@rechargeapps.com",
"enabled_presentment_currencies": [
"USD"
],
"enabled_presentment_currencies_symbols": [
{
"currency": "USD",
"location": "before",
"suffix": " USD",
"symbol": "$"
}
],
"external_platform": "shopify",
"has_preview_customer": true,
"iana_timezone": "America/New_York",
"id": 177871,
"migrated_to_shopify_checkout_integration": 0,
"my_shopify_domain": "recharge-testing.myshopify.com",
"name": "recharge-testing",
"payment_processor": "shopify_payments",
"platform_domain": "recharge-testing.myshopify.com",
"shop_email": "test@rechargeapps.com",
"shop_phone": null,
"subscriptions_enabled": 1,
"test_mode": true,
"timezone": "(GMT-05:00) America/New_York",
"updated_at": "Thu, 06 Apr 2023 05:59:21 GMT",
"use_single_payment_method": 0
}
}
This endpoint renders a template with information about specific order.
URL: {{ manage_order_url }}
Methods accepted: GET
Embedded Route: /tools/recurring/portal/<string:customer_hash>/manage/<int:charge_id>?token=${window.customerToken}
Hosted Route: /portal/<string:customer_hash>/manage/<int:charge_id>?token=${window.customerToken}
Template file: manage_order.html
Schema: '{ "charges": [], "customer": {}, "settings": {}, "store": {} }'
Available template objects:
VARIANTS
Variant is the different version of a product, such as size or color. You add variants to a product that comes in more than one option, such as size or color. Each combination of options for a product is a variant for that product.
For example, suppose that you sell T-shirts with two options: size and color. The size option has three values: small, medium, and large. The color option has two values: blue and green. One specific variant from these options is a small, blue T-shirt.
Getting the variant
EXAMPLE LOOP
{% for variant in subscription.product.shopify_details.variants %}
{{ variant.price | money }}
{% endfor %}
EXAMPLE RESPONSE
$3.00
$8.00
$15.00
You can access all variant objects by looping over the subscription.product.shopify_details.variants
parent object.
Variant object
The variant from Shopify with this additional property:
Property | Definition |
---|---|
variant.barcode string |
"barcode": " " Barcode of the variant. |
variant.compare_at_price string |
"compare_at_price": " " Original price before the change. |
variant.created_at string |
"created_at": "2019-07-16T08:43:00-04:00" Date when the variant is created. |
variant.fulfillment_service string |
"fulfillment_service": "manual" Type of fulfillment service. |
variant.grams number |
"grams": "manual" Type of weight unit. |
variant.image string |
"variant.image": None Variant image. |
variant.inventory_management string |
"inventory_management": "shopify" Property that shows who handles inventory management. |
variant.inventory_policy string |
"inventory_policy": "deny" Inventory policy settings. |
variant.inventory_quantity string |
"inventory_quantity": 7 Number of available variants. |
variant.option1 string |
"option1": "Default Title" Title of the variant option. |
variant.option2 string |
"option2": null Title of the variant option. |
variant.option3 string |
"option3": null Title of the variant option. |
variant.position number |
"position": null Position of the variant in the array. |
variant.presentment_prices number |
"presentment_prices": null Number of presentment price. |
variant.price number |
"price": "15.00" Current price of the variant. |
variant.requires_shipping boolean |
"requires_shipping": true Property that shows if the variant requires shopping or not. Boolean value. |
variant.shopify_id number |
"shopify_id": 17995879325491 Unique identifier that represents shopify id. |
variant.shopify_image_id number |
"shopify_image_id": null Unique identifier that represents shopify image id. |
variant.shopify_product_id number |
"shopify_product_id": 2019073521459 Unique identifier that represents shopify product id. |
variant.sku string |
"sku": "016" Stock keeping unit of the variant. |
variant.taxable boolean |
"taxable": true Shows if the variant is taxable or not. Boolean value. |
variant.title string |
"title": "Default Title" Title of the variant. |
variant.updated_at string |
"updated_at": "2019-11-29T08:51:48-05:00" Date when the variant was last updated. |
variant.weight number |
"weight": 100 Weight of the product. |
variant.weight_unit number |
"weight_unit": "g" Weight unit of the product. |
FILTERS
Filters are simple methods that modify the output of numbers, strings, variables and objects. They are placed within an output tag {{ }} and are denoted by a pipe character ∣.
Array filters
Array filters change the output of arrays.
Filter | Input | Output | Definition |
---|---|---|---|
join | {{ variant.title ∣ join (', ') }} | Pink, Red, Yellow | Joins the elements of an array with the character passed as the parameter. The result is a single string. |
first | {{ variant.title ∣ first }} | Pink | Returns the first element of an array. |
last | {{ variant.title ∣ last }} | Yellow | Returns the last element of an array. |
Math filters
Math filters allow you to apply mathematical tasks. Math filters can be linked and, as with any other filters, are applied in order of left to right.
Filter | Input | Output | Definition |
---|---|---|---|
abs | {{ -17 ∣ abs }} | 17 | Returns the absolute value of a number. |
ceil | {{ 4.6 ∣ ceil }} {{ 4.3 ∣ ceil }} |
5 5 |
Rounds an output up to the nearest integer. |
divided_by | <!-- subscription.price = 200 --> {{ 200 ∣ divided_by(10) }} |
20 | Divides an output by a number. The output is rounded down to the nearest integer. |
floor | {{ 4.6 ∣ floor }} {{ 4.3 ∣ floor }} |
4 4 |
Subtracts a number from an output. |
minus | <!-- subscription.price = 200 --> {{ 200 ∣ minus(15) }} |
185 | Subtracts a number from an output. |
plus | <!-- subscription.price = 200 --> {{ 200 ∣ plus(15) }} |
215 | Adds a number to an output. |
modulo | {{ 12 ∣ modulo(5) }} | 2 | Divides an output by a number and returns the remainder. |
round | {{ 4.6 ∣ round }} {{ 4.3 ∣ round }} {{ 4.5612 ∣ round(2) }} |
5.0 5.0 4.56 |
Rounds the output to the nearest integer or specified number of decimals. |
times | <!-- subscription.price = 200 --> {{ subscription.price ∣ times(1.15) }} |
230 | Multiplies an output by a number. |
Money filters
Filter | Input | Output | Definition |
---|---|---|---|
money | {{ 1450 ∣ money }} | $14.50 | This is money filter |
money_with_currency | {{ 1450 ∣ money_with_currency }} | $14.50 CAD | This is money_with_currency filter |
money_without_currency | {{ 1450 ∣ money_without_currency }} | 14.50 | This is money_without_currency filter |
money_without_trailing_zeros | {{ 1450 ∣ money_without_trailing_zeros }} {{ 1400 ∣ money_without_trailing_zeros }} |
$14.50 $14 |
This is money_without_trailing_zeros filter |
money_localized | {{ 1450 ∣ money_localized }} | 14,50 US$ | This is money_localized filter |
String filters
String filters are used to manipulate outputs and variables of the string type.
Filter | Input | Output | Definition |
---|---|---|---|
append | {{ 'sales' ∣ append('.jpg') }} | sales.jpg | Appends characters to a string. |
camelcase | {{ 'coming-soon' ∣ camelcase }} | ComingSoon | Converts a string into CamelCase. |
capitalize | {{ 'capitalize me' ∣ capitalize }} | Capitalize me | Capitalizes the first word in a string. |
upcase | {{ 'i want this to be uppercase' ∣ upcase }} | I WANT THIS TO BE UPPERCASE | This is upcase filter |
downcase | {{ 'UPPERCASE' ∣ downcase }} | uppercase | Converts a string into lowercase. |
escape | {{ ' coding is fun! '}} |
coding is fun! | Converts html tags into html entities. |
lstrip | {{ ' too many spaces ' ∣ lstrip }} | <!-- Highlight to see the empty spaces to the right of the string --> too many spaces |
Strips tabs, spaces, and newlines (all whitespace) from the left side of a string. |
prepend | {{ 'sale' ∣ prepend('Made a great ') }} | Made a great sale | Prepends characters to a string. |
remove | {{ 'Hello, world. Goodbye, world.' ∣ remove('world') }} | Hello, . Goodbye, . | Removes all occurrences of a substring from a string. |
remove_first | {{ 'Hello, world. Goodbye, world.' ∣ remove_first('world') }} | Hello, . Goodbye, world. | Removes only the first occurrence of a substring from a string. |
replace | <!-- product.title = "Awesome Shoes" --> {{ product.title ∣ replace('Awesome', 'Mega') }} |
Mega Shoes | Replaces all occurrences of a string with a substring. |
replace_first | <!-- product.title = "Awesome Awesome Shoes" --> {{ product.title ∣ replace_first('Awesome', 'Mega') }} |
Mega Awesome Shoes | Replaces the first occurrence of a string with a substring. |
rstrip | {{ ' too many spaces ' ∣ rstrip }} | <!-- Notice the empty spaces to the left of the string --> too many spaces |
Strips tabs, spaces, and newlines (all whitespace) from the right side of a string. |
strip | {{ ' too many spaces ' ∣ strip }} | too many spaces | Strips tabs, spaces, and newlines (all whitespace) from the left side of a string. |
strip_html | {{ '<h1> Hello</h1> World' ∣ strip_html }} |
Hello World | Strips all HTML tags from a string. |
strip_newlines | {{'strip\r new\n lines'}} | strip new lines | Strips all HTML tags from a string. |
truncate | {{ 'The cat came back the very next day' ∣ truncate(13) }} | The cat ca… | Truncates a string down to the number of characters passed as the first parameter. An ellipsis (...) is appended to the truncated string and is included in the character count. |
truncatewords | {{ 'The cat came back the very next day' ∣ truncatewords(4) }} | The cat came back... | Truncates a string down to the number of characters passed as the first parameter. An ellipsis (...) is appended to the truncated string and is included in the character count. |
upcase | {{ 'The cat came back the very next day' ∣ truncatewords(4) }} | The cat came back... | Converts a string into uppercase. |
Route generators
Filter | Input | Output |
---|---|---|
show_customer_url | {{ subscription ∣ show_customer_url }} | tools/recurring/portal/<string:customer_hash>/customer |
payment_source_list_url | {{ subscription ∣ payment_source_list_url }} | tools/recurring/portal/<string:customer_hash>/payment_sources |
payment_source_url | {{ subscription ∣ payment_source_url }} | tools/recurring/portal/<string:customer_hash>/payment_source |
payment_source_form_url | {{ payment_source_form_url }} | tools/recurring/portal/<string:customer_hash>/payment_source |
payment_source_address_url | {{ subscription ∣ payment_source_address_url }} | tools/recurring/portal/<string:customer_hash>/payment_source/address |
schedule_url | {{ subscription ∣ schedule_url }} | tools/recurring/portal/<string:customer_hash>/schedule |
product_search_url | {{ subscription ∣ product_search_url }} | tools/recurring/portal/<string:customer_hash>/products/search |
address_list_url | {{ subscription ∣ address_list_url }} | tools/recurring/portal/<string:customer_hash>/addresses |
address_new_url | {{ subscription ∣ address_new_url }} | tools/recurring/portal/<string:customer_hash>/addresses/new |
address_url | {{ subscription ∣ address_url }} | tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id> |
subscription_list_url | {{ subscription ∣ subscription_list_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions |
subscription_url | {{ subscription.id ∣ subscription_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id> |
subscription_new_url | {{ subscription ∣ subscription_new_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions/new |
subscription_activate_url | {{ subscription.id ∣ subscription_activate_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/activate |
subscription_cancel_url | {{ subscription.id ∣ subscription_cancel_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel |
retention_strategy_url | {{ subscription.id ∣ retention_strategy_url(strategy) }} | tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/cancel/<int:retention_strategy_id> |
subscription_set_next_charge_date_url | {{ subscription.id ∣ subscription_set_next_charge_date_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/set_next_charge_date |
subscription_skip_url | {{ subscription.id ∣ subscription_skip_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/skip |
subscription_unskip_url | {{ subscription.id ∣ subscription_unskip_url }} | tools/recurring/portal/<string:customer_hash>/subscriptions/<int:subscription_id>/unskip |
discount_apply_url | {{ subscription ∣ discount_apply_url }} | tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/apply_discount |
discount_remove_url | {{ subscription ∣ discount_remove_url }} | tools/recurring/portal/<string:customer_hash>/addresses/<int:address_id>/remove_discount |
order_list_url | {{ subscription ∣ order_list_url }} | tools/recurring/portal/<string:customer_hash>/orders |
order_url | {{ subscription ∣ order_url }} | tools/recurring/portal/<string:customer_hash>/orders/<int:order_id> |
onetime_list_url | {{ subscription ∣ onetime_list_url }} | tools/recurring/portal/<string:customer_hash>/onetimes |
onetime_url | {{ subscription.id ∣ onetime_url }} | tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id> |
onetime_set_next_charge_date_url | {{ subscription.id ∣ onetime_set_next_charge_date_url }} | tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>/set_next_charge_date |
onetime_cancel_url | {{ subscription.id ∣ onetime_cancel_url }} | tools/recurring/portal/<string:customer_hash>/onetimes/<int:onetime_id>/cancel |
img_url | {{ subscription.shopify_product ∣ img_url('300x300') }} {{ subscription.shopify_product.image ∣ img_url('200x200') }} {{ subscription.shopify_product.image.src ∣ img_url }} |
https://cdn.shopify.com/s/files/1/1/1/products/IconTShirt_300x300.jpg https://cdn.shopify.com/s/files/1/1/1/products/IconTShirt_200x200.jpg https://cdn.shopify.com/s/files/1/1/1/products/IconTShirt_100x100.jpg |
url_encode | {{ "https://rechargepayments.com" ∣ url_encode }} | https%3A%2F%2Frechargepayments.com |
url_escape | {{ "https://rechargepayments.com/!@#$%^&*()" ∣ url_escape }} | https://rechargepayments.com/!@%23$%25%5E&*() |
url_param_escape | {{ "support@rechargeapps.com" ∣ url_param_escape }} | support%40rechargeapps.com |
Additional filters
General filters serve many different purposes.
Filter | Input | Output | Definition |
---|---|---|---|
json | {{ subscription.shopify_product.variants[0] ∣ json }} | { "compare_at_price": null, "fulfillment_service": "manual", "id": 542182250910, "weight": 32.0 } |
Converts a string into JSON format. |
date | {{ order.processed_at ∣ date('%B, %-d, %Y') }} | August 5, 2018 | Converts a timestamp into another date format. date accepts the same parameters as Python's time strftime method. You can find a list of the shorthand formats on a site like strfti.me. |
ERRORS
Error is under development and object properties are subject to change.
Getting an error
EXAMPLE LOOP
{{ errors }}
EXAMPLE RESPONSE
{
'address_id': [
'This field is required.',
'Cannot add this product, already belongs to this address'
],
'shopify_variant_id': [
'This field is required.'
],
'order_interval_frequency': [
'This field is required.'
],
'next_charge_date': [
'This field is required.'
],
'order_interval_unit': [
'This field is required.'
],
'quantity': [
'Number must be at least 1.'
],
'field_name': [
'must be at least 3 characters',
'cannot contain a space'
]
}
Loop through the Errors dictionary to access individual Error object.
Error object
Object contains the different variables of information you may want to access when rendering an object.
Property | Definition |
---|---|
error.input string |
"input": "email" |
error.message string |
"message": "["must be at least 3 characters", "cannot contain a space"]" {'quantity': [u'Not a valid integer value', u'Number must be at least 1.']} |
TEMPLATE SYNTAX AND SEMANTICS
There are a few possible types of delimiters that can used in our templates. The delimiters are configured as follows:
{% ... %} for Statements
{{ ... }} for Expressions to print to the template output
{# ... #} for Comments not included in the template output
Control Flow Tags
Control Flow Tags determine which block of code should be executed.
if
Executes a block of code only if a certain condition is met (that is, if the result is true
).
{% if store.name == 'Bare Supplements' %}
Welcome to Bare Supplements!
{% endif %}
elif / else
Adds more conditions within an if
or unless
block.
<!-- If customer.first_name is equal to 'Michael' -->
{% if customer.first_name == 'Jon' %}
Hey Jon!
{% elif customer.first_name == 'Michael' %}
Hey Michael!
{% else %}
Hi Stranger!
{% endif %}
escaping
Recharge uses its own form of liquid syntax called Jinja. Sometimes it is desireable — even necessary — to use Shopify’s liquid, if you need access to Shopify objects or filters. In order to invoke Shopify code, you’ll need to wrap the specific block of code in {% raw %} tags, so our renderer will ignore it and Shopify will instead attempt to parse it.
For more information on Shopify liquid, see Shopify liquid objects
{% raw %}
{% for product in collections.frontpage.products %}
{{ product.title }}
{% endfor %}
{% endraw %}
Iteration Tags
Iteration Tags are used to run a block of code repeatedly.
for
Repeatedly executes a block of code.
{# input #}
{% for order in orders %}
{{ order.id }}
{% endfor %}
{# output #}
1001
Theme Tags
Theme Tags have various functions including: leaving comments, including files, extending files, etc.
comment
Allows you to leave un-rendered code inside a Theme Editor files. Any text within the {# ... #} will not be output, and any other code within will not be executed.
{# input #}
My name is {# some comment #} Recharge.
{# output #}
My name is Recharge.
extends
The extends
tag should be the first tag in the template as it tells the engine that this template “extends” another template.
{% extends "base.html" %}
include
The include
statement is useful to include a template and return the rendered contents of that file into the current namespace.
{% include '_errors.html' %}
Variable Tags
Variable Tags are used to create new Liquid variables.
set
Creates a new variable.
{# input #}
{% set favorite_food = 'apples' %}
My favorite food is {{ favorite_food }}.
{# output #}
My favorite food is apples.
{# input #}
{% set my_variable = false %}
{% if my_variable != true %}
This statement is valid.
{% endif %}
{# output #}
This statement is valid.
Note: Your set
variables can be strings or booleans (true or false). Remember not to use quotation marks around the value if it is true
or false
.
FAQ
Question | Answer |
---|---|
I'm getting 404 error when using AJAX calls | If you are getting 404 errors when using AJAX calls, most probably you haven't published any of the Theme Engine themes. In order to correct this, you would need to append ?preview_theme= Example url used for retrieving information: '/tools/recurring/portal/{{ customer.hash }}/request_objects?preview_theme= |
I've published the theme but my portal still looks the same | For Theme Engine to function properly, you would need to switch Customer portal location to Theme Editor in Recharge Admin portal and publish the theme you are developing. One of the reasons why your customer portal still looks the same might be due to incorrect link used in account.liquid Shopify template. In order to correct this, please navigate to account.liquid Shopify template and make sure Manage subscriptions link includes tools/recurring/login, and Recharge will handle redirect to current customer portal location. |
I'm getting undefined variables error in Theme Editor | If you are getting undefined variables error in Theme Editor, it means that you are probably trying to render object that is not supported by the template. Under Available object section of the documentation, you could find more information about what objects are available for each template. In case you are getting undefined variables error, you could retrieve any object and render it in desired template using our request schema. As the schema is very flexible, it lets you combine and retrieve multiple objects at once. More info on requesting objects could be found here. |
I would like to create and modify Novum Theme | In order to create Novum Theme, navigate to Theme Editor, click Create New Theme button, select Novum for theme to use, and click create theme button to generate a new theme based on Novum. When the new theme is generated, click on the options button next to the theme name and select Edit, Theme Editor will open where you could make changes to your theme. |
I am getting an error when using {{ subscription.address.discount.code }} in subscription.html template | {{ address.discount.code }} can be used in subscriptions.html template only. In subscription.html template, address object is nested in subscription object and doesn't have a discount object nested. |
HOW-TO GUIDES
Adding one-time products to existing subscriptions with Theme Editor
Using the Recharge Theme Engine, merchants can enable their customers to add One-Time Products (OTP) to upcoming subscription orders through the customer portal. This guide will take you through the steps to get it set up.
Bulk update subscriptions using Theme Engine
Using the Recharge Theme Engine, merchants can bulk update or create multiple subscriptions tied to the same customer address, all at once. The new functionality includes updating subscription details such as the next charge date or quantity, canceling multiple subscriptions and re-activating subscriptions. This guide will take you through the steps to get it set up.
Creating subscription Order Now functionality using Theme Engine
Using the Recharge Theme Engine, merchants can enable their customers to process their order immediately by selecting the Order Now button in the customer portal. With the proper HTML, JavaScript and CSS code in place, your customer portal will have the ability to add Order Now button for future subscription orders. This guide will take you through the steps to get it set up.
Billing country flow available on Base and Novum themes in Theme Engine
Using the Recharge Theme Engine, merchants can differentiate when it comes to showing shipping and billing country information. If your store had a setting that defined only a couple of countries to ship to, our code only recognized those same countries as billing options. With the proper JavaScript and CSS code in place, your customer portal will have the ability to manipulate with billing countries object in your Theme Engine templates. This guide will take you through the steps to get it set up.
CHANGELOG
Date: 2020-11-23
Settings object implemented in Base theme
- As of 2020-11-23 settings object is now a default feature in Base theme. The changes you make in Customer portal settings within Recharge Admin portal will now be reflected in your Base theme.
Date: 2020-11-09
New language options available in Theme Engine docs
- As of 2020-11-09 a new feature is available in TE docs. We have introduced axios calls as a foundation of communication with our API. This additional options will allow merchants greater flexibility when it comes to making HTTPS requests. From now on, axios and fetch will be primarily used for creating, updating and retrieving the desired data in template files.
Date: 2020-11-04
Customer token duration changed
- Due to a security reasons, token duration has been changed from 24 hours time to 12 hours.
Date: 2020-11-03
Billing countries variable available
- Base and Novum Themes have billing countries variable available.
Date: 2020-07-24
Novum Theme
- Ability to create Novum Theme is now available in Theme Engine.
Date: 2020-07-01
Token security
- Token security is required in the url for making successful AJAX calls within the Theme Engine.
Date: 2020-06-01
New charges endpoint
- New charges endpoint has been added. It allows the ability to process the charge immediatelly using Order Now button in Theme Engine.
Date: 2020-05-22
General
- settings object is now a global variable. It can be accessed within any Theme Engine template.
Date: 2020-04-29
Performance Improvements
Several updates were made to the Theme Engine to increase performance and reduce page load times.
The performance improvements have resulted in the Theme Engine being an overall 30+% faster for page load times.
Below are listed the 5 most visited pages and their associated performance improvement (decrease in page load time).
- Subscriptions List: 54% faster
- Subscription View: 33% faster
- Delivery Schedule: 34% faster
- Orders List page: 13% faster
- Product Search: 23% faster
Date: 2020-04-14
Bulk create / Bulk update
- Abilities to bulk create and bulk update subscriptions are now live.
Date: 2020-02-21
Removing property
- product.subscription_defaults.order_interval_frequency has been deprecated.
Date: 2020-02-05
Download and import:
- Added ability to download and import a theme.
Date: 2020-01-24
Custom properties:
- Now you are able to pass custom properties when creating, updating or swapping a subscription.
Date: 2020-01-17
Prepaid subscriptions:
- The ability to skip prepaid subsciptions is unavailable.
Date: 2019-12-12
Token Security:
- Added token to strengthen a customer's account security.
Date: 2019-07-25
Swap Subscription:
- The ability to swap a product on a subscription is now live. All themes generated after 07/25/2019 will include the new swap logic. If your template was generated before this date then you can either generate a new theme or follow the guide below to update your existing theme.
Skip Subscription:
The ability to skip future dates on a subscription is now live. All themes generated after 07/25/2019 will include the new skip logic. If your template was generated before this date then you can either generate a new theme or follow the guide below to update your existing theme.
Date: 2019-06-27
General:
- Added new Functionality in Development section. This section identifies the functionality that is currently in development and unavaiable.