If checkout doesnt work well can use the payment intents API
Simple Difference Comparison: https://stripe.com/docs/payments/payment-intents/migration/charges Code Example: https://gist.github.com/westonganger/6ac28553b13a0bc7fe07dcf8d86ce3bd
Seems to be usable for our cases and has a fairly simple code structure.
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items
https://stripe.com/docs/billing/prices-guide
https://stripe.com/docs/api/invoices
https://stripe.com/docs/billing/subscriptions/customer-portal
gst_tax_rate = Stripe::TaxRate.create({
display_name: ‘GST (Canada)’,
description: 'GST Canada',
jurisdiction: 'CA',
percentage: 5,
inclusive: false,
})
pst_tax_rate = Stripe::TaxRate.create({
display_name: ‘PST (Canada)’,
description: 'PST Canada',
jurisdiction: 'CA',
percentage: 7,
inclusive: false,
})
Stripe::Checkout::Session.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
payment_method_types: ['card'],
mode: 'payment',
customer_email: “customer@example.com”,
line_items: [
{
quantity: 1,
adjustable_quantity: {enabled: false},
### Documentation says if you don’t set a tax_code on a product, we apply your default product tax code
### Else
tax_rates: [gst_tax_rate.id, pst_tax_rate.id],
tax_behaviour: “exclusive”,
price: price.id, ### if managing price info within Stripe,
price_data: { ### OR adhoc pricing info
Product: product.id, ### if managing product info with Stripe
product_data: { ### OR adhoc product info
name: “Product Name”,
description: “The product description”, ### optional
tax_code: “txcd_10103000”, ### optional, this example code is for SaaS
},
currency: “CAD”,
unit_amount: “9999, ### in cents == $99.99
### OR
unit_amount_decimal: “99.99”,
recurring: {
interval: “month”,
interval_count: 1, ### every 1 month
},
},
},
{
… Product 2 details ....
},
],
});