BoldSubscriptions.js
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
Latest |
Latest |
Latest |
Latest |
Latest |
11 |
Installing
Using npm:
$ npm install bold-subscriptions-js
Using yarn:
$ yarn add bold-subscriptions-js
Using CDN:
<script src="https://unpkg.com/bold-subscriptions-js/dist/bold-subscriptions-js.min.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 '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.