#evan_09475

1 messages · Page 1 of 1 (latest)

blissful cliffBOT
spare summit
#

Hi! Let me help you with this.

#

How are you collecting the new Payment Methods?

scarlet coyote
#

I am collecting the new Pm with the same payment element when user clicks on an edit button in my website.

I generate payment method from createPaymentMethod in the client, and then I send the PM to my API.

#

In my API, in the edit request, I use the the new Pm to attach it to the customer and detach the old one

#

this works fine when changing payment methods from card to card or from card to google pay

#

But when I try to change to stripe

#

Am not sure how the flow will work

#

Because initialy when I create subscription with paypal I have to handle nextActions in my client in order to verify the payment

spare summit
#

Then you can use the created Payment Method and attach it to Subscription.

scarlet coyote
#

but when I edit the subscriptions, you mean using the attach and detach payment methods is not ideal?

#

I should use set up intent when I edit

#

?

spare summit
#

No, I mean using createPaymentMethod is not the ideal way.

spare summit
scarlet coyote
#

I actually followed the doc I sent earlier

spare summit
spare summit
scarlet coyote
#

When I set the setup intent, it should need the payment method the user selected on the client right ?

spare summit
#

What do you mean by "payment method selected"?

#

You mean selecting an existing Payment Method, or choosing a Payment Method type?

scarlet coyote
#

Lets say the user in the edit mode, selected paypal and clicked submit, in the client I have to create PM and then forward it the API so I create the setup Intent based on the payment method passed from the client

spare summit
#

No, if you follow the guide, you will see that it's more like:

  1. You create a SetupIntent on the backend.
  2. You send the client_secret to the frontend.
  3. The customer selects a Payment Method type and provides the details.
  4. The customer clicks Submit.
  5. You call confirmSetup() on the frontend.
  6. You can listen to webhook events and get the Payment Method ID from setup_intent.succeeded and use it to update your Subscription.