#Chee Hong-Payment

1 messages · Page 1 of 1 (latest)

wraith pivot
#

Hello, yes you can have multiple PaymentMethod attached to a Customer. But you only can have 1 default PaymentMethod

sweet gulch
#

If i refer to

  {{customer_id}},
  {type: 'card'}
);```
I only manage to get one
#

What do you mean by default payment method?

wraith pivot
#

If that API returns only 1 result, that means only 1 PaymentMethod is attached currently

sweet gulch
#

My flow is

  1. Server side create payment intent with setup_future_usage=on_session and attach customerId.
  2. Client side confirmCardPayment by pass in the element.(card_info). Once success, card info become a payment method attach to customer
wraith pivot
#

Ah, you mean if the customer repeat the flow, the new card is replaced the old card ?

sweet gulch
#

Yup

#

The old card payment method will not retrieavable

#

Meaning i not able to let customer choose other previous card

wraith pivot
#

Just a quick confirm, why using confirmCardPayment instead of confirmPayment?

sweet gulch
#

In fact, this is a part of code done by other developer. Before that is using handleCardPayment

#

There is a new requirement that would like to save the credit card. And i found that handleCardPayment is deprecated. And now thinking to change the method to be confirmCardPayment

wraith pivot
#

thanks

#

I was thinking you are following the exact same flow as the link you provided

#

Can you give an example request id?

sweet gulch
#

No. We kind of implement the credit card payment in Production

#

And just enrich the flow

#

You mean the payment intentId?

wraith pivot
#

Yes PI id could work

#

like pi_xxx

#

I just quick tried it and I think the confirmCardPaymentshould preserve multiple Payment Methods as well

#

I receive multiple PMs when retrieving from a Customer

#

It would be helpful if I can see your requests flow, so a PaymentIntent Id would be helpful

sweet gulch
#

pi_3K1MP1HsXhzGaeTv0p5t9zTz

#

above is the payment intent id

wraith pivot
#

I see quite a number of Detach requests (for example: req_wCwJAncaIGow1N) Isn't it because of those requests?

sweet gulch
#

I purposely detach the card

#

just for testing purpose

#

Do you want me to provide you the customerId for better tracking purpose?

wraith pivot
#

cus_KeBygrKzRQJoQY this one, right?

#

I think you would want to debug by a fresh setup

sweet gulch
#

there is a testing card 4242 attach now

#

I can attach another card

#

for your tracking

wraith pivot
#
  1. Create a new Customer
  2. Create a PI from that Customer
  3. Confirm it with card A
  4. Repeat step 2 and 3 with card B
  5. Check the Customer and pasting the ID
sweet gulch
#
        customer: 'cus_KeBygrKzRQJoQY',
        type: 'card',
      }) as any```
#

I have try again to attach a new card

#

And it show me only the new card

#

Here is the payment intent pi_3K1it6HsXhzGaeTv04SwKgvd

sweet gulch
#

{"object":"list","data":[{"id":"pm_1K1iwUHsXhzGaeTvjQYFeUoW","object":"payment_method","billing_details":{"address":{"city":null,"country":null,"line1":null,"line2":null,"postal_code":null,"state":null},"email":null,"name":"Test","phone":null},"card":{"brand":"visa","checks":{"address_line1_check":null,"address_postal_code_check":null,"cvc_check":"pass"},"country":"DE","exp_month":8,"exp_year":2023,"fingerprint":"7XN8542ZKNZgNOfi","funding":"credit","generated_from":null,"last4":"3184","networks":{"available":["visa"],"preferred":null},"three_d_secure_usage":{"supported":true},"wallet":null},"created":1638327190,"customer":"cus_KeBygrKzRQJoQY","livemode":false,"metadata":{},"type":"card"}],"has_more":false,"url":"/v1/payment_methods"}

#

Another payment intent pi_3K1jTlHsXhzGaeTv1uPdjwAd which attach a new card

#

{"object":"list","data":[{"id":"pm_1K1jWfHsXhzGaeTvpcgUUFbj","object":"payment_method","billing_details":{"address":{"city":null,"country":null,"line1":null,"line2":null,"postal_code":null,"state":null},"email":null,"name":"Demo","phone":null},"card":{"brand":"visa","checks":{"address_line1_check":null,"address_postal_code_check":null,"cvc_check":"pass"},"country":"FR","exp_month":8,"exp_year":2025,"fingerprint":"LdWp4LEh4eLTnKU7","funding":"credit","generated_from":null,"last4":"3155","networks":{"available":["visa"],"preferred":null},"three_d_secure_usage":{"supported":true},"wallet":null},"created":1638329434,"customer":"cus_KeBygrKzRQJoQY","livemode":false,"metadata":{},"type":"card"}],"has_more":false,"url":"/v1/payment_methods"}

wraith pivot
#

I am a bit confused. In the most recent 2 Payments, you confirmed the card 3184 -> it is attached and became default. Then you confirmed the card 3155 -> it is attached and became default. The 3184 still attached but is not default anymore. After that you detached the 3184 card, now the Customer only has 3155 as the only one and default.

#

It's expected, I think

sweet gulch
#

I did not detach 3184 card

#

May I know what trigger the detach of 3184 card?

wraith pivot
#

I think there is a request: req_gjpitenkHxEv9n

sweet gulch
#

All right. It really has such request being triggered. I have overlook the hidden logic in another process.!

#

And one more question is about charge again the payment method. A bit different with the sample given in doc

Here is my flow:

For create payment intent(server side), set the

stripeOptions.payment_method = {{pmId}}
stripeOptions.customer = {{customerId}}
stripeOptions.off_session = false 
stripeOptions.confirm = false

Above request will require the user to confirmCardPayment in client

In client will be

        stripeApiClient
          .confirmCardPayment(clientSecret, {payment_method:{{pmId}})

So just to confirm that if the customer will be in the checkout flow. We should set off_session =false instead of true to complete the payment in client, am I right?

#

I ask this is because I afraid that the card issuer will request for TAC number/reauthenticate if use the payment method

wraith pivot
#

yes, and I think its default is false

#

You only need to set it to true if you confirm on server

#

I will step down for the day. Feel free to open another thread and my colleague would be able to assist 🙂