#FyreXIV- subscriptions
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
what you can do is instead of using PaymentIntents is to use SetupIntents
aahh,, but how to save the google pay as a payment method for the customer ?
when you create a SetupIntent instead of PaymentIntent what you're trying to achieve is attaching a payment method for the customer
and you use it the same way with PaymentElement
ill try
let me know if you need any more help
Invalid value for stripe.confirmSetup(): elements should be an Elements group.
for some reason, i got an error
i just passed the variable from here var elements = stripe.elements();
did you pass the clientSecret?
where should i get the clientsecret ? because i can only get the clientsecret from here https://stripe.com/docs/api/payment_intents/create which is required to charge the customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
you could take a look at this guide https://stripe.com/docs/payments/save-and-reuse
let me know if you need any more help
to be honest im lost, after creating a setupintent and then ?
when you create a SetupIntent there will be a client_secret field on it that you should pass to your front end
did you follow the guide I sent you? where are you stuck? at which step?
yes i follow the guide, but still lost since im using google pay not a card element
you can use Payment Element
this would give the ability to choose your payment method types
sorry, what I want to achieve is when the customer click the Pay using google pay, it will automatically subscribe to my product
because on my other projects, i achieved that but i used stripe default credit cards field only.
- when customer fills up,
- backend, will create a customer and pass the token on it. and then subscribed.
it can be used the same way as cards
the Google Pay is a payment method the same way as a card
ah okay, then how can i generate tokens in google pay ? to save on customer?
You can do better
You can create a PaymentIntent and use the setup_future_usage to off_session and collect the money which all automatically save the PaymentMethod to the Customer passed to that PaymentIntent
but create a PaymentIntent required to charge the customer immediately right?
yes
which is i dont want hahaha
you can do an auth and capture
what do you mean by that?
you could set the capture_method to manual on the PaymentIntent and once the user clicks Pay you could then in the back-end call capture on the PaymentIntent
but what if the user applied 100% coupon? still zero charge
I'm not sure to be honest, I'll try it and get back to you
just a quick question before, are you using Checkout or Payment Elements?
im using elements
any news @junior geyser ?
sorry I was going to test this but didn't have the chance yet, could you give me a couple of minutes please?
yes sure thanks
can you please guide me ?
just let me summarize your need so I could give you the appropriate steps
You want to create a subscription and have the user set up their payment method for future usage right?
hhhmm yes?
- when the customer click google pay,
- on backend will create a customer and pass the token (containaining the google pay card details) on it. and then automatically create a subscription for them.
1- Create SetupIntent on the backend
2- Send the client_secret to the PaymentElement on the FrontEnd
3- Confirm Setup Intent on the frontend
4- Create a Customer with payment_method and invoice_settings.default_payment_method (value you can get from the stripe.confirmSetup from previous step)
5- Create a Subscription for that customer
aha!!!
let me try this
1- https://stripe.com/docs/api/setup_intents/create
3- https://stripe.com/docs/js/setup_intents/confirm_setup
4- https://stripe.com/docs/api/customers/create#create_customer-payment_method and https://stripe.com/docs/api/customers/create#create_customer-invoice_settings-default_payment_method
5- https://stripe.com/docs/api/subscriptions/create#create_subscription-customer
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.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
3- https://stripe.com/docs/js/setup_intents/confirm_setup
quick question: for this the elemets is from here right ? var elements = stripe.elements();
paymentRequest: paymentRequest,
});```
ahh same with here ^
@junior geyser it works.. another question var prButton = elements.create('paymentRequestButton', { paymentRequest: paymentRequest, }); i want to use this.. is it possible ?
Hello, tarzan had to step out. I cam catching up...
If Google or Apple Pay are the only payment method you want to take, you can certainly use the PaymentRequest button
this will not workin if i do that
all good now thanks @junior geyser for helping to until the end ๐ kudos!
Actually there is another flow that you might want to consider that we typically recommend here
- Create subscription
And then if payment is required: - pass latest_invoice.payment_intent.client_secret to the frontend
- Call confirmPayment with the PaymentElement.
If it is not required: - If payment is not required(trial or coupon), instead pass subscription.pending_setup_intent.client_secret to the frontend
- Call confirmSetup with the PaymentElement
This flow is very similar, but as you can see it is less steps and it helps more directly do things like start the subscription automatically when the user enters their details on your page