#sraka-paymentelement-subscription
1 messages · Page 1 of 1 (latest)
These are the only API calls we make (first 2 from backend, 3rd one is from Stripe Elements)
And this is the latest_invoice.payment_intent that is generated on the POST /v1/subscriptions (subscription creation)
Hello! Sorry the Discord server is really busy and there isn't much I can do from just pictures. Can you explain how you create the Subscription and how you initialize Stripe.js/PaymentElement exactly (without pictures)
Explain as in text or with code?
We first create a Stripe customer and then a subscription using
stripe_subscription_data = %{
customer: stripe_customer_id,
items: [%{ price: product.stripe_price_id }], # Basic Box price id
payment_behavior: "default_incomplete",
payment_settings: %{ save_default_payment_method: "on_subscription" },
expand: ["latest_invoice.payment_intent"]
} ||| stripe_discount_payload,```
Then we return the client_secret from the expanded latest_invoice.payment_intent and use confirmPayment on Stripe Elements
How do you initialize Elements client-side exactly
sraka-paymentelement-subscription
<Elements stripe={stripePromise} options={{
mode: 'payment',
amount: 1800,
currency: 'eur',
setup_future_usage: 'off_session',
setupFutureUsage: 'off_session',
}}>
<Checkout />
</Elements>
oh
Does mode: 'subscription' make a difference?
Just saw it in the docs
Whoa, it worked!
Thanks for rubber-duckying 😄
I do have another question
Looking at the payment methods https://dashboard.stripe.com/settings/billing/invoice - I don't see Google Pay and Apple Pay
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Are those not supported for subscriptions?
Sorry the server is super busy, but yes that's wht I was getting at. You're using what we call the "defer intent flow" which is newer and usually mapped to developers using automatic payment methods.
Today though this feature (autoPMs) doesn't work for Subscriptions/Invoices just yet, so they have a separate list of enabled payment methods and it makes the overall integration a bit more confusing
Honestly in your case you're doing it wrong I think: you already have a Subscription and it has a latest_invoice Invoice that has a PaymentIntent. Really you should be passing that PaymentIntent's client_secret to PaymentElement in this case on initialization
But how does the user enter their details then...
Isn't the point of this deferral that I don't need a PaymentIntent just to initialise the Elements
We have a one step checkout...user enters their email and address and whatnot in the top and then payment info in the bottom and then there's a single "Pay" button
Any ideas why Apple Pay is not showing as an available payment method in the Invoice settings list even though we have it in the main payment method settings?
this is the canonical doc for "I collect payment method upfront and then I confirm the underlying PaymentIntent of my Subscription"
but you do have to be clear about the mode in that case
Yes, in that page they specify the mode: subscription and amount, not the clientSecret when init-ing the Elements
Apple Pay comes with its own set of restrictions: domain registration in Live mode, HTTPS required, etc. See https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#apple-pay-and-google-pay
Yes, we have Apple Pay enabled already in https://dashboard.stripe.com/settings/payments, but we're not seeing it in https://dashboard.stripe.com/settings/billing/invoice as Payment methods
Yeah that's normal, it works as a card so it will just work
Mkay
And then another thing - is PayPal still in beta?
I'm not seeing it under available payment methods and we'd really like to integrate with it
Paypal is publicly released but with some limitations and it doesn't support recurring payments yet. See https://stripe.com/docs/payments/paypal
It says
Recurring payments
Requires approval
Not unsupported. Does this mean approval from Stripe or PayPal?
recurring payments require approval from Stripe and are still in beta
No I can't, and there's a long waiting list, you wouldn't get access now so you should just plan without it. But you'd ask our support team: https://support.stripe.com/contact
Okay, thanks
Hm, it's pretty critical as our entire product offering is subscription based...
sure but it wouldn't be different from a month ago when Paypal was not public. We want to support it, but it comes with restrictions and it's a small beta right now that's all