#sashabelonogov-save-and-reuse

1 messages · Page 1 of 1 (latest)

ornate torrent
#

👋 happy to help

thick trellis
#

great, thanks!

#

Just to be even more precise, the reference of the setupIntent in iOS is sent with the setup result, on Android, it just pretty much says "Completed" and doesn't attach a setupIntent reference, even though the documentation says that I can get the paymentMethodId from there

ornate torrent
#

setupIntent.getPaymentMethodId() is part of the backend code

#

and assigning that PaymentMethod to the customer is something that happens automatically without having to do any other action that confirming the SetupIntent

thick trellis
#

I'm sorry, but nope it's not

#

getPaymentMethodId() is a java method

#

the documentation for Ruby would even have a different style. And I can see this method for the Android SDK library SetupIntent class

#

in fact, in the similar iOS documentation, there is a Swift variable mentioned at the same spot, e.g. setupIntent.paymentMethodID

ornate torrent
#

I hear you, but what I'm trying to say is that you don't need to use it

thick trellis
#

it's great that the assigning of the PaymentMethod happens automatically, but in our implementation, we keep the track of the payment method ids to query them separately, therefore we save the payment_method_id on the backend.

It works perfectly on iOS

#

but when it comes to Android, I believe, the only way is to redo it all using websockets or some fancy mechs on backend

ornate torrent
#

you can use webhooks for both

thick trellis
#

so, is there no way to simply fetch the paymentMethodId for Android to simplify the flow?

ornate torrent
ornate torrent
thick trellis
#

Alrighty! Thanks anyways! Then I will keep cracking the Android SDK to make sense of it, not relying on the documentation

ornate torrent
#

but IMO it's better not to duplicate the logic across your apps, and if you can handle saving the PM directly using the webhooks it's already neater since you don't have to do a call

#

@thick trellis I will try to find a solution for you, but I was just suggesting another route that seems to me a better solution

#

please give me a moment

thick trellis
#

webhooks mean that the backend payments service will be opened to the public and that's something we don't want to do because of the security reasons. And webhooks is a completely different complexity

ornate torrent
#

that's not really true

#

because we already provide a way of verifying the signature of our events

thick trellis
#

ah, true, makes sense

ornate torrent
#

this means that any request that fails this verification isn't coming from Stripe and thus you can ignore

#

I'll try to poke around for the Android SDK thing and I'll be back shortly with an answer

thick trellis
#

Thanks a lot for poking it with me!

ornate torrent
#

If you see on line 125 this is how you get your Setup Intent

thick trellis
#

Oh, I see the alternative flow.

Thank you very much!

ornate torrent
#

no worries, but again, I would strongly advise you to consider webhooks, it's really easier and more scalable than having to maintain the same logic in both of your apps and it removes this processing from the mobile app to your server

#

but feel free to adopt either, both approaches work