Checkout Twig Tag
The checkout
twig tag is a new functionality to create a Stripe Checkout session just passing the Stripe Price and quantity in an array of items
The checkout
twig tag will return a Stripe Checkout object, use the url
attribute to redirect the user to the Stripe Checkout page
TIP
Stripe will always provide the amount
and unit_amount
in the smallest common currency unit (i.e. for USD or EUR, 100 cents instead of $1.00). However, for zero-decimal currencies (i.e. JPY, Japanese Yen), the smallest currency is the regular denomination (¥1 for 1 Yen)
{# The price id could be a One-Time or Recurring price #}
{% set items = [
{
"price": "price_1KErstLLWVlbcCFQEGHbAgdl",
"quantity": 2
}
]
%}
{% set checkoutSession = craft.enupalStripe.checkout(items) %}
<a href="{{ checkoutSession.url }}">Pay</a>