Skip to content

This Javascript API makes it easy to add subscriptions to the cart and navigate to the Bold Subscriptions or Cashier checkout.

License

Notifications You must be signed in to change notification settings

bold-commerce/bold-subscriptions-js

Repository files navigation

BoldSubscriptions.js

⚠️ This package is meant for Bold Subscriptions v1 which is no longer installable and has been replaced by Bold Subscriptions v2. See the Bold Developer Portal for the latest developer documentation.

About

Use these Javascript APIs to easily build custom subscription flows, add subscriptions to the cart and navigate to the Bold Subscriptions or Cashier checkout. The available methods are a fast alternative to and largely based off of our Custom Subscription Flow and Widget API documentation. Included with these API methods are detailed exceptions and error messages to help you quickly and reliably develop custom subscription flows.

Browser Support

Chrome Firefox Safari Opera Edge IE
Latest ✔ Latest ✔ Latest ✔ Latest ✔ Latest ✔ 11 ✔

Installing

Using npm:

$ npm install @boldcommerce/bold-subscriptions-js

Using yarn:

$ yarn add @boldcommerce/bold-subscriptions-js

Using CDN:

<script src="https://unpkg.com/@boldcommerce/bold-subscriptions-js"></script>

API Reference

To view our full documentation on the available methods head over to our BoldSubscriptions.js API reference.

Example Node.js usage

import { cart } from '@boldcommerce/bold-subscriptions-js';
cart.standard.addToCart({
	'id': 1250183643165,
	properties: {
		'group_id': 1234,
		'frequency_num': 1,
		'frequency_type': 3,
		'frequency_type_text': 'Every 1 Month(s)',
	}
})
	.then(() => alert('Successfully added!'));

Example CDN usage

<form>
	<input type="hidden" name="group_id" value="1234">
	<input type="hidden" name="frequency_num" value="1">
	<input type="hidden" name="frequency_type" value="3">
	<input type="hidden" name="frequency_type_text" value="Every 1 Month(s)">
	<input type="hidden" name="quantities[]" value="1">
	<input type="hidden" name="variant_id[]" value="1250183643165">
	<input type="hidden" name="product_id[]" value="103180140573">
	<button onclick="BoldSubscriptions.cart.standard.directlyToCheckout(event)">Checkout</button>
</form>

Contributing

This project is read only. Please contact Bold Commerce with any changes or additions you would like to make.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

This Javascript API makes it easy to add subscriptions to the cart and navigate to the Bold Subscriptions or Cashier checkout.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published