#FyreXIV- subscriptions

1 messages ยท Page 1 of 1 (latest)

junior geyser
#

๐Ÿ‘‹ happy to help

#

what you can do is instead of using PaymentIntents is to use SetupIntents

tawdry ridge
#

aahh,, but how to save the google pay as a payment method for the customer ?

junior geyser
#

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

tawdry ridge
#

ill try

junior geyser
#

let me know if you need any more help

tawdry ridge
#

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

junior geyser
#

did you pass the clientSecret?

tawdry ridge
junior geyser
#

let me know if you need any more help

tawdry ridge
#

to be honest im lost, after creating a setupintent and then ?

junior geyser
#

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?

tawdry ridge
#

yes i follow the guide, but still lost since im using google pay not a card element

junior geyser
#

you can use Payment Element

#

this would give the ability to choose your payment method types

tawdry ridge
#

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.
junior geyser
#

it can be used the same way as cards

#

the Google Pay is a payment method the same way as a card

tawdry ridge
#

ah okay, then how can i generate tokens in google pay ? to save on customer?

junior geyser
#

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

tawdry ridge
junior geyser
#

yes

tawdry ridge
#

which is i dont want hahaha

junior geyser
#

you can do an auth and capture

tawdry ridge
#

what do you mean by that?

junior geyser
#

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

tawdry ridge
#

but what if the user applied 100% coupon? still zero charge

junior geyser
#

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?

tawdry ridge
#

im using elements

tawdry ridge
#

any news @junior geyser ?

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?

tawdry ridge
#

yes sure thanks

junior geyser
#

ok so yes you can

#

even if the coupon is for 100%

tawdry ridge
#

can you please guide me ?

junior geyser
#

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?

tawdry ridge
#

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.
junior geyser
#

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

tawdry ridge
#

aha!!!

let me try this

junior geyser
#
tawdry ridge
junior geyser
#

you need to create a payment element

tawdry ridge
#
            paymentRequest: paymentRequest,
        });```

ahh same with here ^
junior geyser
#

but you shouldn't be using paymentRequestButton

#

you should be using payment

tawdry ridge
#

@junior geyser it works.. another question var prButton = elements.create('paymentRequestButton', { paymentRequest: paymentRequest, }); i want to use this.. is it possible ?

shadow thunder
#

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

tawdry ridge
tawdry ridge
#

all good now thanks @junior geyser for helping to until the end ๐Ÿ˜„ kudos!

shadow thunder
#

Actually there is another flow that you might want to consider that we typically recommend here

#
  1. Create subscription
    And then if payment is required:
  2. pass latest_invoice.payment_intent.client_secret to the frontend
  3. Call confirmPayment with the PaymentElement.
    If it is not required:
  4. If payment is not required(trial or coupon), instead pass subscription.pending_setup_intent.client_secret to the frontend
  5. 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