Home > front end >  Blazor Javascript Drop-In Script Not Working
Blazor Javascript Drop-In Script Not Working

Time:06-17

I am working on integrating Chargebee into a Blazor app. The way the drop-in script for Chargebee works is I need to include a javascript script, which I am doing in my index.html file.

<script src="https://js.chargebee.com/v2/chargebee.js" data-cb-site="sitename-test"></script>

Then, in theory I should be able to just include a drop in link in one of my razor views like this.

<a href="javascript:void(0)" data-cb-type="checkout" data-cb-item-0="Product-Name" data-cb-item-0-quantity="1"> Subscribe </a>

But when I do this and run the site, click the link, nothing happens, no error, no drop-in popup. Is there something about Blazor that doesn't allow this action to work the way it would work with another framework? I have tested this with plain HTML files and it works fine.

Thanks in advance for any help.

CodePudding user response:

You will need to call Chargebee.init(options); via JSInterop. See the documentation linked below for more details on the Chargebee JS API.

https://www.chargebee.com/checkout-portal-docs/api.html#chargebee-object

  • Related