#jerz_intent-mandate

1 messages Β· Page 1 of 1 (latest)

untold rootBOT
#

πŸ‘‹ Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

πŸ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1479525608487780564

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

shell ginkgo
#

πŸ‘‹

agile spindle
#

πŸ‘‹

shell ginkgo
#

You'll want to pass SetupFutureUsage = "off_session" when creating the Payment Intent

https://docs.stripe.com/api/payment_intents/object?lang=dotnet#payment_intent_object-setup_future_usage
"If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don’t provide a Customer, you can still attach the payment method to a Customer after the transaction completes."

agile spindle
shell ginkgo
#

Thats a good call out.

#

Looks like the same omission is made in our other language examples as well. I'll let our Doc's team know this needs to be corrected.

agile spindle
#

The payment method still has a null customer on it

shell ginkgo
#

Do you have an example Payment Intent ID i can peak at?

#

This is after the Payment Intent was confirmed correct?

agile spindle
#

The payment intent is still processing/pending

#

Ah I see

#

So I have to wait for it to confirm before I can use the mandate

#

Does the mandate transition to active once the payment is confirmed then?

#

and I can get that webhook?

#

pi_3T826UQsYE31k0JV0b3YaMTA

shell ginkgo
agile spindle
#

Doesn't seem like I have ... I'll check it again .....

shell ginkgo
#

The resulting PM pm_1T826XQsYE31k0JVqKFY2c8V also appears to have a customer attached

agile spindle
#

Ok, so since changing the setupFutureUsage off_session the mandate comes through active on the first event. But when I get paymentmethod from the API in that webhook, the customer is null

#

So, I don't get another updated event on the mandate once the payment intent is confirmed

#

When I process the confirmed payment intent, can I get the payment method, see that it's direct debit and then find the mandate?

shell ginkgo
#

When the PI is confirmed and all customer actions are complete, it's attached to the customer, if the status of the mandate was already active and it does not change there would not be another event.

#

"when I get paymentmethod from the API in that webhook" Could you clarify, which webhook, and by "from the API" are you making an additional retrieve call or inspecting the data.object on the webhook?

agile spindle
#

the initial mandate.updated webhook ... I make an additional http call to get the payment method using the ID on the mandate

shell ginkgo
agile spindle
#

So, if I store (mandateid, paymentmethodid) on the first event, then listen for the above event I'll be able to join it all up

shell ginkgo
#

The PM should have a mandate_ID and a type you can insepct

#

correct!

agile spindle
#

I couldn't see a mandate reference on the PM

#

(that would make it easier)

#

Can you think of any reason why I couldn't add the mandateId to the PM metadata in the first event and use that in the attached event (as opposed to storing that reference locally)?

shell ginkgo
#

Sorry about the mix up (time for more coffee) , you're right the mandate wouldn't be directly accessible from the PM but from the Payment Intent,

#

Trying to think of any reason it wouldn't be reasonable to just stash the id on in the PM metadata

#

The main thing is a Payment Method can have more than one active mandate for different scenarios. So if the metadata is just used to store it temporarily, I don't see an issue but if you intended to use it as a source of truth for what mandates exist down the road that might not be the best route.

agile spindle
#

It's not very clear is it?!
What I want to be able to do is store a direct debit payment method to re-use in the future. But ideally I'd like to know if the mandate (or any of??) is actually active so that I know that it should work. What do most people do, just try the paymentintent and if it fails, due to an inactive mandate, they go chase the customer? Feels like it would be nice to know that ahead of time. For instance, if I know I have an active mandate I can prompt the customer to re-use it on a future (on_session) payment but not knowing if it will work is not great!

#

Hang on....

#

I've just spotted a typo

shell ginkgo
#

Just submitted that feedback for our Docs.

agile spindle
#

paymentMethod.Customer is not the same as paymentMethod.CustomerId

shell ginkgo
#

Yeah it should just be Customer.

untold rootBOT
royal elbow
#

jerz_intent-mandate

agile spindle
#

No, I was wrong ... in .Net the Customer property is only populated if you expand the customer object. Otherwise, you only get the CustomerId property (a string) and a null Customer property

#

I've confirmed ... it's actually working as expected

#

Really sorry about that ... wasted a whole bunch of your time

shell ginkgo
#

No it's all good! Yes it's expandable so by default it will just be an ID

#

We're here to help, even if that's just talking through it.

agile spindle
#

Well, thanks for your help and, again, apologies for not spotting that

#

Excellent support as always

#

Hope you have a great weekend