#ibgoldbergs

1 messages · Page 1 of 1 (latest)

humble kettleBOT
thorny tulip
#

Hello! Creating a Payment Method will succeed as long as the card number passes basic checks (like length, LUHN, etc.). It sounds like you're expecting transaction-related errors to be surfaced at that time, but that won't happen because no transaction has been attempted at that point.

alpine plume
#

Got it, so just because we are able to generate a paymentMethod does not mean the card is valid?

#

What is the best practice to validate that the card is okay so we can quickly give feedback to client

thorny tulip
#

Can you describe your payment flow in a bit more detail?

#

Like is there a delay between when the payment info is provided and when the Subscription is created?

alpine plume
#

So we have a credit card component which creates a payment method

#

then we use payment method and hit an endpoint which creates a customer if one does not already exist... and if a subscription is warranted we create a subscription as well

#

we don't always create the subscription right away, depending on circumstances of business logic

thorny tulip
#

To clarify, though, you're always collecting payment info even though you're only creating a Subscription sometimes? If you don't create a Subscription what do you use the payment info for?

alpine plume
#

if we dont create subscription right away, we just add the payment method to the customer and we have a daily lambda that will create the subscription when its time to

#

sort of like we implemented our own trial system, and we aren't using stripe trials yet

thorny tulip
alpine plume
#

Got it. So for our use case, it sounds like you recommend:

  1. Create paymentMethod on front end
  2. Hit our endpoint
  3. This endpoint will create the customer, attach payment method to customer
  4. you recommend adding this step to create a SetupIntent (will validate card and we can pass back errors to front end)

  5. If credit card is validated we can create subscription right then and there OR create at a later date
#

does that seem right?

thorny tulip
#

No. You should create a Setup Intent and pass its client secret to your frontend so the Setup Intent can be confirmed client-side.

#

After that you can attached the Payment Method to a new or existing Customer, then use it now or later for Subscriptions.

alpine plume
#

The SetupIntent documentation looks like it wants customer_id though, so don't we need the customer first?

thorny tulip
#

You can create and use a Setup Intent without a Customer, then attach the resulting Payment Method to a Customer after the fact.

#

We recommend you create the Customer first in the docs, but you don't need to do it in that order.

alpine plume
#

Roger that. I think I have enough info to work on. Very helpful, thanks.

thorny tulip
#

No problem! If you need anything else let us know!