3

I'm trying to set up a simple subscription based site using the Awesome Charge plugin and am wondering if I can change the button text using Stripe Checkout.

There doesn't seem to be any documentation around Checkout Options on the Squarebit site that indicates I can pass a value, through the options list, that changes the text 'Pay with card' to something else.

I understand I could customise the whole process using the Strip.js method but was hoping to just use the out of the box version.

Thanks.

2

Developer of Charge here.

Yes - you absolutely can control the label generated for the checkout button.

When setting the details for the checkout option, you just need to pass a sub-array called checkout, along with the extra parameters that get passed straight down the modal js.

Specifically you'd want do some thing like this :

{% set options = {
    planAmount : 99.99,
    description : 'This is an optional description for the modal',
    checkout : {
        name: 'Company Name ltd.',
        image: 'https://s3.amazonaws.com/stripe-uploads/hSYxIZGM3U0DbmPKsJszRHm3OU3D4CtHmerchant-icon-641868-add-on-icon.png',
        label: 'Pay with Stripe Checkout'
    }
 } %}

 {{ craft.charge.setCheckoutOptions(options) }}

In that above example you can see we're passing values for name, image and label to the Checkout modal.

That'll return a button that looks something like this :

Example Stripe Checkout button with custom label

The full details of all the configuration options you can pass through to the checkout modal are detailed in the Stripe Checkout documentation. Just pass the values you want within that checkout array in the twig.

NB. We're working on updating the docs on this usage right now, and they'll be up shortly too here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.