Skip to content

akaliszuk/stacking-promotions

Repository files navigation

  1. About Voucherify Example
  2. How Voucherify works
  3. Demo
  4. Quickstart
  5. How to run Voucherify samples locally
  6. Get support

Stacking-promotions with Voucherify

This sample shows you how to stack different types of promotions with Voucherify. This is achieved by integrating validate stackable and redeem stackable endpoints. The stacking mechanism allows you to combine up to 5 promo codes or cart-level promotions with a single request.

Validating and accepting promo codes in your checkout from scratch might be tricky — calculating discounted prices, error message handling, and localization are just a few things to think about when building a simple promo code redemption flow.

This is where Voucherify promotion engine kicks in. Together with our Promo UI Kit you can quickly build the best promotion experience for your customers.

This example introduce online coffee shop and many vouchers in your dashboard are about it.

How Voucherify works

Note: while calling the redeem stackable endpoint is enough to satisfy a basic promo code flow, it's useful to add validate stackable to the flow every time the promo code or cart changes. Validation performs 1-3 points but it doesn't marks the code as used one.

Demo

Live demo on:

The demo is running with a Sandbox project. Sandbox comes with several test vouchers you can apply in the checkout, e.g.:

FREE-SHIPPING - You find it in your Vouchers dashboard but if there is not Free Shipping Voucher you have to create code with free shipping on Sandbox.

BLCKFRDY 50%OFF and many other vouchers you find in your Sandbox > Vouchers.

Some codes have a validation rules or different discount effects so do not use them or you will not be charged a discount.

The promo code box accepts Amount and Percentage discount types, more coming soon.

This sample calls three endpoints:

Quickstart

Before you run this example locally let's check how to started with Voucherify API and dashboard by redeeming your first coupon code by going to Quickstart. This informations helps you understand conception about Voucherify product.

How to run Voucherify samples locally?

This sample is built with Node.js and our JS SDK on the server side and HTML + Vanilla JavaScript on the front (with React version coming soon).

Follow the steps below to run locally.

  1. Clone repository.
git clone https://github.com/voucherify-samples/stacking-promotions.git
  1. Create your Voucherify account (free tier, no credit card required).

  2. Go to the Sandbox project’s settings and get your Application ID and Secret Key, see Authentication.

  3. Rename .env.example to .env and paste your API keys:

VOUCHERIFY_APP_ID=<replace-with-your-application-id>
VOUCHERIFY_SECRET_KEY=<replace-with-your-secret-key>
  1. Install dependencies.
npm install / yarn install
  1. Start the Node server by entering one of the commands in the terminal.
npm run start / npm run dev || yarn start / yarn run dev 
  1. Go to http://localhost:3000 in your browser.

Get support

If you found a bug or want to suggest a new sample, please file an issue.

If you have questions, comments, or need help with code, we’re here to help:

For more tutorials and full API reference, visit our Developer Hub.

Authors

@patricioo1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published