#ilamathi-setup

1 messages ยท Page 1 of 1 (latest)

winter gate
#

Hi there! I will try my best to assist you!

#

I was wondering if this payment was one-off or subscription?

worn dirge
#

it's for recurring, but after sometime user want to stop to use that payment method kind of scenario

winter gate
#

If there is a subscription created for the customer, in order to update the payment method, there are 2 updates required:

  • The default payment method for the customer
  • The payment method for the subscription
worn dirge
#

I am using the stripe platform only for the payment process and not using the subscription feature from stripe.. So here we are using the prebuilt checkout page from stripe and there we collected card details for future payment usage purpose as well.. From the checkout session i get the payment method id and will store in our platform.. Then i will use this payment method id for the future usage by creating the payment intent with this Id.. Now customer want to stop this payment method and use some other for the future payment.. So only just i am looking for the option to remove this future usage authorization for that payment method..

winter gate
#

I see, in this case, you can detach the PaymentMethod from the customer object.

#

And attach the new PaymentMethod and use this for the future payments ๐Ÿ™‚

worn dirge
#

Actually detach, will just remove/detach this payment method from the customer, still the source will be there in the stripe right?

#

Or the entire payment_method & saved card details will be deleted?

worn dirge
#

Hi

winter gate
#

Hello, sorry for the delay, just came back from a meeting

#

I have just tested, detaching payment method from customer will remove it

#

It will also disappear from the dashboard

#

Hope this helps ๐Ÿ™‚

worn dirge
#

ok so this detach will remove the payment_method & card details from the stripe platform itself right?

winter gate
#

Yes

#

Even if you try to attach it to the same customer object again, the following error will result:

  "error": {
    "message": "This PaymentMethod was previously used without being attached to a Customer or was detached from a Customer, and may not be used again.",
    "type": "invalid_request_error"
  }
}```
#

Meaning you can't reuse it again ๐Ÿ™‚

worn dirge
#

Ok..

#

Also i came to know, the stripe prebuilt checkout page doesn't display all the user saved card & it only pre-populate with most recent card (mode: payment) is it true? If i want to provide a option to customer to select any one of the saved card, do we any option for that?

winter gate
#

This is a good question, let me double check

#

Checkout Session itself does not allow a selection of the different PaymentMethod attached to a Customer object.

#

There are a number of other ways where the customer can select the card details, e.g.

  • via Google Pay/Apple Pay and the card details are saved in their account for selection
  • it is saved in the user's browser's cache
worn dirge
#

Ok from the checkout page we won;t have option to choose different card.. Either we can go with pre-populated card or click cahnge card and enter new card and go.. is that correct?

winter gate
#

Yes

worn dirge
#

Do we have this listing all the saved card options in the stripe UI elements?

winter gate
#

Unfortunately Payment Element does not have a card listing option for a specific customer either

#

But there is nothing stopping you from building a drop down list in your UI

worn dirge
winter gate
#

Awesome! We are thinking on the same page ๐Ÿฅณ

worn dirge
#

But in this Payment API Listing for example customer saved 5 card and in that only one are set up for future usage.. But this payment_methods api response doesn't have that flag to identify.. Can u pls confirm?

winter gate
#

There can be 2 options in your UI:

  1. To select an existing PaymentMethod from the drop down list via the above API.
  2. To enter a new payment method via Payment Element
#

Good point! Let me test this out!

winter gate
#

Good news! If the setup_future_usage is not defined, the card is not saved to the customer!

#

Even when I list the PaymentMethods, the card is not there!
i.e. Only if setup_future_usage: true when attempting payment, the PaymentMethod is saved to the Customer object, otherwise we do not attach it to the customer.

#

Hope this helps! ๐Ÿ˜„

worn dirge
#

Actually this setup_future_usage have multiple value like offline, online..etc.. if this is mentioned as offline, we can use for future payment without user interaction ...

#

so i need to differentiate that out of other payment method

#

that's y i looking for this setup_future_usage flag or any other falg for this purpose

winter gate
#

Thank you for your feedback!

#

You are right, this on_session and off_session info is only available in the PaymentIntent object itself, it is not exposed on the PaymentMethod

worn dirge
#

So i can not identify that offline future usage with this API

#

IS any other suggestion/option for this?

opal matrix
#

Hey, taking over here! Let me catch-up

#

So I understand, you're looking for a field on a pm_xxx object that determines whether it is setup for on/off session payments?

worn dirge
#

yes

opal matrix
#

That's not currently available I'm afraid

#

Why not just use off-session in every instance?

worn dirge
#

We have plan to offer both one time purchase & recurring payment as well.. For one time purchase flow no need to go with off-line instance & that will notify user with terms. "This card saved and will be used for future payment as well like that"

opal matrix
#

Then I recommend you set something on the metadata of the Payment Method

worn dirge
#

While creating the session i can set the metadata and that can be get it in this pm call?

opal matrix
#

That's not possible, no

worn dirge
#

ok.. then no other way.. i have to go with offline for all use case

opal matrix
#

That would be recommendation for the time being, yes

worn dirge
#

Ok thanks..
Is there any option to delete the saved payment_method other than detach pm from the customer API ?

opal matrix
#

Payment Methods cannot be deleted no

#

But once detached, they're not reusable

worn dirge
#

ok fine

#

Thanks for your support and answering to all the question

opal matrix
#

Sure, np!

worn dirge
#

one more QQ, For save card expiry case, stripe will send mail to customer before 30 days.. Even the customer didn't update the card details on the next auto payment with payment-intent we will get the card expiry error right? Also is this notified with webhook events?

opal matrix
#

stripe will send mail to customer before 30 days
If you have that configured, yes
Even the customer didn't update the card details on the next auto payment with payment-intent we will get the card expiry error right
Assuming the bank declines the payment, yes. The recurring PI will fail
Also is this notified with webhook events?
Likely https://stripe.com/docs/api/events/types#event_types-invoice.payment_failed