This sample app demonstrates how to Programmatically Create Subscriptions with the Bold Commerce Subscriptions API.
This project uses a custom checkout frontend based on the BigCommerce OS Checkout.
- Custom BigCommerce Checkout to add Bold Subscription meta data into checkout.
- A Payment Gateway Account and API credentials [Braintre, Stripe, Authorize.net]
- A BigCommerce account and API credentials.
- A BoldCommerce account and API credentials.
- Node.js, version 14 or later.
- NPM, version 6 or later.
Use the following steps to install this repo (containing the Bold Subscriptions logic) and run the demo store locally:
-
Clone this repository:
git clone [email protected]:bold-commerce/bigcommerce-create-subscription.git cd bigcommerce-create-subscription
-
Create a .env file from the sample file:
cp sample-env .env
-
Install the required dependencies:
npm install
-
Test the local environment:
npm run dev
-
Add and start ngrok. Note: use port 8000 to match your Express server.
npm install ngrok ngrok http 8000
-
Register a webhook with BigCommerce using the ngrok domain in your destination and webhook header using your BigCommerce Auth Token for security.
- After the initial order is placed, a BigCommerce Webhook is used to capture the order contents, filter the payments API, and create a Bold Subscription.
Use the following steps to ensure that the project is set up correctly:
-
Add a BigCommerce Order Id in your
.env
file. -
Run the following command:
npm run test
- This example is using the Braintree Sandbox environment, which can be updated to production within the
.env
file.- Please see the
sample-env
file for more details.
- Please see the
Bold provides a demo store that allows you to see this example in action before getting started. Use the following steps to observe the functionality that this example enables:
- Visit the store.
- Visit a product page, and select Subscribe to this product today! Configure the order frequency, and add the product to your cart.
- Click Proceed to checkout.
- Since you have a subscription item in cart, the store prompts you to create an account. Create an account with sample customer and shipping information.
- Use 4111 1111 1111 1111 for the credit card number. Use any name, CVV, and expiration date (in the future).
- After you place the order, navigate to the Manage Subscriptions page to view your subscription.