Fieldtype template
The Stripe Checkout Fieldtype acts as a field in your form that allows the user to choose how they want to pay: either as a one-off payment (such as a purchase) or a subscription (great for recurring donations).
Each fieldtype instance can be configured to do one of:
only be a one-time payment, or
only be a subscription, or
let the user choose
All of this is managed within the Fieldtype Configuration for each instance.
If the user is able to choose, the fieldtype will include options that allow the user to pick their preference. Check out the installation instructions for details on how to publish this to your site.
When using this fieldtype, you will always need to style your fieldtype, but more importantly, know the goal. So keep reading.
Style your fieldtype
The styles in the default template are purposely bland. Maybe you use Tailwind... maybe you write your own CSS... this addon won't get in your way. We've provided enough styles to make the out-of-the-box fieldtype template be usable, but they are definitely not pretty.
Maybe you want to use buttons... perhaps a select box... perhaps radio buttons. That is your choice - and you can make the template work your way.
Rather than have you needlessly strip away opinionated styles, the bare minimum is included. You can adjust these to suit the style and layout of your site.
It is important to know the goal of the template though so you can ensure it still functions correctly.
The goal
The fieldtype template has a single hidden field that stores the user preference - "payment" for one-time payment or "subscription" for, well, subscription. These are special Stripe words, so keep using them.
Your fieldtype template can do whatever you want it to do... as long as it populates the hidden field with the appropriate value.
Refer to the source template for a full working example.