#chrisdedev

1 messages · Page 1 of 1 (latest)

ionic zincBOT
flint falcon
#

Can you provide a little more context

#

That completely depends on what data you need to access at a later date

sleek dagger
#

So I got the setup working to save payment for later

#

I have only done curl requests for testing

#

what I want to know is what should I save to be able to charge the customer later

flint falcon
#

You'd need customer id and payment method id at minimum

#

Whatever else you want to store depends on your integration and what you need to access

sleek dagger
#

It is fine to save the payment id in the database

#

It looks like in the sample that you lookup the payment id

flint falcon
#

You should probably store pm_ and cus_ id's yourself

#

Yep you can look it up if you want

#

But if you save the pm_ id yourself, that saves an api call and it'll be faster

sleek dagger
#

I'm just confirming that is fine. Cause It could be possible for my customer to add multiple cards and I would like to allow them to specify a default one to charge.

#

So thanks for confirming that I can save the pm_id

flint falcon
#

Yep no prob

sleek dagger
#

So in the sample code it looks up "type=card" is it possible to save other payment types like apple pay for later charges

flint falcon
#

Yeah. Not all payment methods support future usage, but many do. The payment method docs page for each payment method should indicate whether it's supported

ionic zincBOT
sleek dagger
#

So I added the sample Insufficient funds decline card. It seems to fail before I get a payment method

#

I'm wondering is it not possible to add the decline cards as payment methods

viscid badger
#

Hi 👋

I"m taking over as @flint falcon had to go.

  1. You can add declined cards as payment methods using the PaymentMethod strings (e.g. pm_card_visa_chargeDeclined).
  2. What is the context here? Where/how do you want to add the card?
sleek dagger
#

Use test cards to validate your Stripe integration without moving real money. Test a variety of international scenarios, including successful and declined payments, card errors, disputes, and bank authentication. You can also test non-card payment methods.

#

I was adding the 9995 card

viscid badger
#

If you click the Payment Method tab at the top of that table you will see the pm_ tokens you can use to attach to a customer

sleek dagger
#

So I can't just add the card with the numbers. Is that the issue

viscid badger
#

How are you trying to add them?

sleek dagger
#

I'm using flutter_stripe

#
        paymentIntentClientSecret: clientSecret,
        params: PaymentMethodParams.card(
          paymentMethodData: PaymentMethodData(
            billingDetails: billingDetails,
          ),
        ),
      );```
#

that seems to be where it fails.

viscid badger
#

Okay so you are attempting to use it in a Setup Intent.

sleek dagger
#

_$_StripeException (StripeException(error: LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: Your card has insufficient funds., message: Your card has insufficient funds., stripeErrorCode: card_declined, declineCode: insufficient_funds, type: card_error)))

viscid badger
#

Is this with the Payment Element?

sleek dagger
#

that is the error I get

viscid badger
#

Because that's the error you would expect

sleek dagger
#

So what I'm wondering is does stripe check cards before adding them as payment methods

#

I'm creating a SetupIntent

viscid badger
#

The SetupIntent validates the card

#

when you attempt to confirm

#

Of course, with an error like insufficient funds, the card may validate successfully when you set it up but still fail when you attempt to charge it

sleek dagger
#

That was the scenerio I wanted to create by using a insufficient funds card

viscid badger
#

In that case I would recommend you create a Customer object and directly attach the payment method to them

#

Then attempt payment with that method

sleek dagger
#

So since I'm making SetupIntents I will just need to use the payment methods ids

viscid badger
#

If tha tis the way you want to test it. I think creating the Customer directly with the PM and then attempting payment is a bit more straightforward

sleek dagger
#

I want to test how the app behaves with my test accounts. Can I just attach the payment method ids to the customer in the stripe dashboard then make the charges?