#Gizmo-Payment Element

1 messages ยท Page 1 of 1 (latest)

cold cedar
#

๐Ÿ‘‹ happy to help

stoic yoke
#

HI tarzan, thank you

cold cedar
#

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

stoic yoke
#

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?

cold cedar
#

not the same PaymentIntent

#

you would have to do that in steps

stoic yoke
#

Steps for me as a developer, but the customer would only need to enter their payment details once, right?

cold cedar
#

unless 3DS is needed yes the customer would only have to set their details once

stoic yoke
#

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?

cold cedar
#

the PaymentIntent doesn't create a customer for you

stoic yoke
#

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.

cold cedar
#

I'm not familiar with Laravel Cashier unfortunately

stoic yoke
#

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.

cold cedar
#

actually it was more of me sending them to your thread than the other way around ๐Ÿ™‚

stoic yoke
#

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?

cold cedar
#

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

stoic yoke
#

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())?

cold cedar
#

No you should do that on the backend, that's why I suggested to do it before creating the Payment Intent

stoic yoke
#

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?

cold cedar
#

good point

#

but I think there's a good tradeoff here

stoic yoke
#

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?

cold cedar
#

once a payment method is used it cannot be attached to a customer after the fact

stoic yoke
#

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.

cold cedar
#

you can but you won't be able to attach that Payment Method afterwards if you create the customer after the PaymentIntent succeeded

stoic yoke
#

I see, so I could do the one-off charge, but I wouldn't be able to also do a subscription.

cold cedar
#

You can if you create the customer first

stoic yoke
#

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.

cold cedar
#

yes, and then you can update the info of the user

stoic yoke
#

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?

white drum
#

that way there's only one payment so it's generally cleaner

white drum
stoic yoke
#

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?

white drum
#

yes

stoic yoke
#

Could the one-off charge and the subscription be refunded independently if I do it the way tarzan is suggesting?

white drum
#

yes

stoic yoke
#

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?

  1. Create a Stripe customer whether or not I have any information for the customer
  2. Create a PaymentIntent with setup_future_usage set to off_session for the customer I created in step 1 and set the amount to the amount of my one-off charge
  3. Call confirmPayment() to bill for the one-off charge amount
  4. I can then create the subscription for the customer without any additional action on the customer's part
  5. 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?

white drum
#

yep, those are the steps!