#razvi-subscription-creation

1 messages ยท Page 1 of 1 (latest)

olive jacinthBOT
grizzled talon
#

@thin pier do you have a trial period or something?

#

razvi-subscription-creation

thin pier
#

Yes, a 3 day trial period

#

This is how i create the subscription

grizzled talon
#

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

thin pier
#

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

grizzled talon
#

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

thin pier
#

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

grizzled talon
#

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

thin pier
#

does it make a difference?

grizzled talon
#

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?

thin pier
#

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.

grizzled talon
#

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

thin pier
#

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.

grizzled talon
#

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.

thin pier
#

How exactly should it work?

grizzled talon
#

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?

thin pier
#

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

grizzled talon
#

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

thin pier
#

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?

olive jacinthBOT
grizzled talon
thin pier
#

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.

thin pier
#

๐Ÿ™

#

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?

tall night
#

๐Ÿ‘‹ stepping in as koopajah needed to step away

#

Sounds like you are trying to use Payment Request Button with a Subscription on trial?

thin pier
#

I think so, but with a custom payment button, not from a checkout form, just from my web page.

tall night
thin pier
#

I got to that point but i don't know what the payment_method should be and how I should get it.

tall night
#

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)

thin pier
#

that i get from await paymentRequest.canMakePayment();?

tall night
#

What is that?

thin pier
#

What method is sending the paymentmethod that the callback is listening for?

tall night
#

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.

thin pier
#

I need the custom button so from what i read i only need to call the paymentRequest.show(); when the button is clicked?

tall night
#

Oh yes sorry

#

That's correct

#

Since you are using your own button

thin pier
#

Ok, i will try, thank you