paymentForm

The paymentForm tag will Output your Stripe Form with a single line of code. Pass the handle of your Stripe Payment Form as parameter:

{{ craft.enupalStripe.paymentForm('handle') }}

# Options

Additionally, you can pass the following options to the paymentForm variable. These options are only available for one-time payment forms.

  • quantity
  • amount
  • calculateFinalAmount
  • itemName
  • itemDescription
  • checkoutSuccessUrl
  • checkoutCancelUrl
  • checkoutImages (overrides images for one-time payments, for recurring payments, images should be added on Stripe when creating the plan)
  • customAmountStep (0.01, 1) Value for the step attribute of the number input element (for custom donations, etc)

The calculateFinalAmount setting is enabled by default so if you pass false, we don't calculate quantity * amount as the final amount, you can apply any discount to the amount that you want to charge and will override the amount saved in your Stripe Payment Form

The itemName and itemDescription are useful if you're using Stripe Checkout

The checkoutSuccessUrl and checkoutCancelUrl options are for when SCA is enabled and using with Stripe Checkout.

{% set options = {
    amount: 99.99, 
    quantity: 2, 
    calculateFinalAmount: false,
    itemName : 'Test Name',
    itemDescription : 'Test Description',
    checkoutImages: {0:"https://yourdomain.com/assets/docs/nice-image-product.png"},
    checkoutSuccessUrl: '/thank-you?number={number}',
    checkoutCancelUrl: '/uh-oh'
} %}

{{ craft.enupalstripe.paymentForm('handle', options) }}

# Custom Line Items

If you're using the New Stripe checkout (opens new window) you can easily pass custom Line Items (opens new window) this is useful to pass fees or any custom item. Please make sure that the currency is the same as the paymentForm or the plan (for subscriptions)

Additionally, you can pass removeDefaultItem via options to remove the item from your PaymentForm (this will only work if you pass lineItems)

{% set options = {
        removeDefaultItem: true,    
        lineItems : [
            {
                name : 'T-shirt',
                description : 'Comfortable cotton t-shirt',
                amount : 1500,
                currency : 'usd',
                quantity : 2,
            },
            {
                name : 'Hidden fee :)',
                description : 'There is always a fee',
                amount : 100,
                currency : 'usd',
                quantity : 1,
            }   
        ] 
    } 
%}
{{ craft.enupalStripe.paymentForm('handle', options) }}

# Custom Plans Options

You can pass the following options when you're creating Custom Plan Amounts (opens new window)

{# customFrequency could be: year, month, week, day #}
{# customInterval should not be more than 1 year in total #}
{% set options = { 
    "customFrequency" : "month", 
    "customInterval" : 4,
    "customTrialPeriodDays" : 19
    } 
%}
{{ craft.enupalstripe.paymentForm('handle', options) }}

# Tiered Plans

For plans with Tiered Pricing (opens new window), you need to pass the quantity and Stripe Payments will calculate and charge the final amount.

{{ craft.enupalstripe.paymentForm('handle', {quantity: 20}) }}

# Promotional codes (Subscriptions)

For subscriptions forms, you can enabled Promotional codes (opens new window), you need to pass the allowPromotionCodes setting to enabled this feature. This is only available on the New Stripe Checkout (SCA enabled)

{% set options = { 
    "allowPromotionCodes" : true
    } 
%}
{{ craft.enupalstripe.paymentForm('handle', options) }}

# Trial Days when Stripe Checkout and SCA is enabled

For subscriptions forms on the new Stripe Checkout you can pass singlePlanTrialDays to set the trial days to the subscription

{% set options = { 
    "singlePlanTrialDays" : 15
    } 
%}
{{ craft.enupalstripe.paymentForm('handle', options) }}