#razvi-subscription-creation
1 messages ยท Page 1 of 1 (latest)
So that's expected then
If there's no payment upfront then there's no PaymentIntent. On that expand line you want to expand pending_setup_intent too and use that client_secret to collect card details
I got that, but I don't know how I should go about doing that in the front-end, so that I get only the popup for Google/Apple pay without needing any other input from the user.
I only need the user to press the button and then click the button from the popup without any other card/email/name inputs
It works the exact same way though
you say "I got that" but you don't. Your code does not expand the pending_setup_intent. What I am saying is all you need is expand both and then return the client secret value for the one that is present
i am returning the pending_setup_intent
then problem is I don't understand what I should do with it in the fron-end
I tried something like this but i need a payment method, which I don't have because i don't know how to collect it with google/apple pay
Please don't share pictures like this
You're not really reading my exact words because you think you're already doing it
why is your code fetching that SetupIntent later when for PaymentIntent you expand? I'm struggling to follow
does it make a difference?
Also I'm unclear what the problem is with the rest. You just shared a picture of code with no context at all. We have dozens of ways to integrate our product and APIs. Is this React Native? Why are you using paymentSheetData.paymentIntent if it's a SetupIntent, what's the context, which doc are you following?
It's an angular app with a nodeJS backend. I am not following any docs now as I have not found the one I need for this specific case.
why do you have payment_method: 'google_pay' in that picture? Shouldn't it be res.id or something? I'm sorry I have never seen code like yours
I don't know, this was the attempt to try to somehow get the payment_method using the pending_setup_intent retrieved from the back-end.
ah gotcha
So you don't do that for a real PaymentIntent?
Like really my point is: as long as you have a valid client_secret (whether PaymentIntent or SetupIntent) it should work similarly.
How exactly should it work?
so if we go back to the beginning: you have a client_secret for the SetupIntent, you return it client-side: what is the problem?
The code that runs well, for the yearly subscription that returns the client_secret for the PaymentIntent, is using a library called @capacitor-community/stripe that checks which payment method is available and then presents the google or apple payment methods with presentGooglePay(). I don't know how I should implement the same thing only using stripe.js and the pending_setup_intent.client_secret
I've never heard of that community library unfortunately
It also says it's a wrapper for Mobile SDKs which seems extremely advanced. Our Mobile SDKs are really complex to use. But you mentioned you're just using Angular so I admit I'm a thoroughly lost with your overall set up unfortunately
I explained why and how it to work for the yearly. I just need help with the angular part that handles the weekly subscription, and how exactly I should go about getting the user info from the google pay popup.
I am using that library because it works both on the web and on mobile with my setup, whick is a ionic capacitor app. But on the web it's only an angular app
So I only need the weekly subscription part to work on the web for now, so stripe.js would suffice.
But how should i go about implementing something like that?
https://stripe.com/docs/stripe-js/elements/payment-request-button is the doc I would follow if you only want ApplePay and GooglePay
I need to start the payment from my custom Pay Now button. From what I have seen this doc does not have something for this case.
๐
can you just give just a quick explanation about what the flow should be from this point of having the client secret of the pending_setup_intent , so that the user only clicks the pay now button and the gets the google pay pupup and that's it?
๐ stepping in as koopajah needed to step away
Sounds like you are trying to use Payment Request Button with a Subscription on trial?
I think so, but with a custom payment button, not from a checkout form, just from my web page.
Sure so as you noted you are going to get a pending_setup_intent and you expand that to pass the client_secret to your frontend. When using PaymentRequstButton you are going to do the same thing that we show in our docs here: https://stripe.com/docs/stripe-js/elements/payment-request-button?client=html#html-js-complete-payment except you would use confirmCardSetup() (https://stripe.com/docs/js/setup_intents/confirm_card_setup) instead of confirmCardPayment()
I got to that point but i don't know what the payment_method should be and how I should get it.
Did you take a look at the linked doc? After Google Pay or Apple Pay is completed there is a callback: paymentRequest.on('paymentmethod', async (ev) => {
That callback will contain the PaymentMethod (ev.paymentMethod)
that i get from await paymentRequest.canMakePayment();?
What is that?
What method is sending the paymentmethod that the callback is listening for?
All you have to do is create/mount the Payment Request Button. It automatically has a click handler that handles the rest of showing the payment sheet.
So you don't call any method beyond canMakePayment() and then mounting the PaymentRequestButton.
I need the custom button so from what i read i only need to call the paymentRequest.show(); when the button is clicked?
Ok, i will try, thank you