#Gizmo-Payment Element
1 messages ยท Page 1 of 1 (latest)
HI tarzan, thank you
What you can basically do is create a PaymentIntent with setup_future_usage https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage set to off_session and make that payment method the default for the customer https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method and then create the subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thanks, tarzan, I'll read this documentation. To be sure, I'll be able to use this payment intent to, say, charge the customer $27.43 once and subscribe them to a $9.99 annual subscription?
Steps for me as a developer, but the customer would only need to enter their payment details once, right?
unless 3DS is needed yes the customer would only have to set their details once
Terrific, thank you, I'll give this a try.
If the one-off charge creates the customer, will. the payment method automatically be the default for the customer?
the PaymentIntent doesn't create a customer for you
I see, thanks. I'm trying to use Laravel Cashier, so it isn't entirely clear without digging deeper which parts of things it's facilitating vs Stripe default functionality.
I'm not familiar with Laravel Cashier unfortunately
Does setting the payment intent to off_session mean a charge is any less likely to go through? I didn't digest the entire thread you pinged me on, but it seemed that fellow was having issues and I want to make sure using off_session wouldn't risk impeding transactions.
actually it was more of me sending them to your thread than the other way around ๐
An unrelated question, but I understand the preference is to keep all of a person's questions in the same thread: I understand Stripe uses coupons. How can I use coupons with Payment Element?
Also, related to my first question, if the PaymentIntent doesn't create the Stripe customer, do I create the Stripe customer after I call confirmPayment() using the PaymentIntent?
do I create the Stripe customer after I call confirmPayment() using the PaymentIntent?
IMO it's better to create the customer before creating the Payment Intent and pass the Customer Id to the Payment Intent
I see, thanks. Is there a way to create a Stripe customer on the frontend/via JS, since the payment is made via JS (via confirmPayment())?
No you should do that on the backend, that's why I suggested to do it before creating the Payment Intent
If I create a Stripe customer on the backend prior to the customer checking out on the frontend, what happens if the customer never completes the payment/checkout? Wouldn't my Stripe account fill up with "customers" who never complete purchases in that case?
Would there be a downside to creating a Stripe customer after a successful transaction and attaching the payment method to the customer once the customer is created?
once a payment method is used it cannot be attached to a customer after the fact
I see, so I have somewhat of a chicken and egg problem. I don't want a customer until there is a successful payment, but I can't have a successful payment until there is a customer.
you can but you won't be able to attach that Payment Method afterwards if you create the customer after the PaymentIntent succeeded
I see, so I could do the one-off charge, but I wouldn't be able to also do a subscription.
You can if you create the customer first
Does Stripe let you create customers with no information about the customer? Since users are created in my application after a successful purchase, I know nothing about the site visitor before they've made a purchase.
yes, and then you can update the info of the user
Ahh, so I can fill in details for the customer once the payment is successful and my application creates their account. ๐
Is there a way to purge / remove Stripe customers who never complete a payment from my account?
for what it's worth my suggestion here would be different, instead of using two PaymentIntents, roll the one time payment into the subscription's first invoice. https://stripe.com/docs/billing/invoices/subscription#first-invoice-extra
that way there's only one payment so it's generally cleaner
not automatically but you can call https://stripe.com/docs/api/customers/delete directly
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thanks for the additional suggestion, karllekko. Would doing it the way you suggest mean the one-off charge and the subscription couldn't be refunded independently, it would be all or nothing?
yes
Could the one-off charge and the subscription be refunded independently if I do it the way tarzan is suggesting?
yes
Ok, thank you. It seems I'll need to do it the way tarzan suggested in that case, though I appreciate your suggestion.
Just to recap, this is what it would look like, right?
- Create a Stripe customer whether or not I have any information for the customer
- Create a PaymentIntent with
setup_future_usageset tooff_sessionfor the customer I created in step 1 and set the amount to the amount of my one-off charge - Call confirmPayment() to bill for the one-off charge amount
- I can then create the subscription for the customer without any additional action on the customer's part
- I can update the Stripe customer's details once the customer completes their account in my application
Is this an accurate list of the steps?
yep, those are the steps!