Coupons (alpha)

Loop supports the ability to pass external coupon codes for Chargebee to Loop at the time of checkout, which will then be applied to the Chargebee plan object when checkout is completed.

When a customer authorizes payment via the modal or checkout page, Loop will create or update the customer in Chargebee and note the use of the coupon code. Then, when Chargebee creates the invoice, it will include such a code.

This functionality is in alpha, thus there are a few important considerations to note:

  • We currently do not validate the coupon codes. Thus, you may want to add validation on your end. Using an incorrect code will result in the end-user not being able to provide authorization via Loop.

Below we outline the steps to using coupon codes and offer suggestions on the best configuration.

Steps:

  1. Create coupon codes in Chargebee & grab the ID.

Once you have created the code, you see it creates an ID - this is the code that you will need to pass to Loop.

  1. Collect payment authorization, passing through the code to Loop

Loop allows you to collect payment authorization either through our modal or hosted checkout page. Currently it is recommended to use the modal and your own custom checkout page.

Company checkout page + Loop modal

You will need to pass the coupon code to the modal upon initialization. You can read how in the modal's NPM package readme. Thus, you will need to provide a way for the customer to input the coupon code and then pass through to Loop.

Please note, the cart will not update to display the discount code. Thus, we recommend that you set cartEnabled: false in the modal (or you can not set the cartEnabled option at all, because false is the default value).

Hosted checkout page (coupon code passed via URL)

You can use Loop’s checkout page and append the code at the end if the URL. You can use this link to send directly to customers that you are offering the discount to or embed in a link.

https://checkout.loopcrypto.xyz/<entity ID>/<item ID>?coupon=<couponID>

Please note, we are not validating the code and it will not be reflected on the cart on the checkout page, and if shown for the modal, at this time. Thus, if the code or ID is incorrect, the subscription creation will fail. Thus, we recommend that you add in the price metadata a description noting the discount.

Hosted checkout page (coupon code entered in cart)

If you've generated a coupon code in Chargebee and shared it with your customers, they can also input that code directly into Loop's checkout cart for the discount to be applied. Once the code is added, the customer will see the amount due update as shown below. After the customer completes the checkout, they will be billed the discounted amount as per the logic of the Chargebee coupon.

Invoice

After a customer provides authorization, Loop will automatically create that customer in Chargebee or update an existing customer. At this time, we will tell Chargebee that the coupon should be applied. When Chargebee generates the invoice, it will include the logic of the coupon and this will be pulled into Loop just like all invoices are.

Last updated