#clutch-dotnet-paymentintent

1 messages ยท Page 1 of 1 (latest)

brisk gobletBOT
solemn compass
#

Hi ๐Ÿ‘‹ can you share the ID of the Payment Intent that you're trying to retrieve the associated Charge for? I'm curious if it hasn't processed a payment yet and doesn't have a Charge associated with it.

rustic bay
#

That's what's really weird. I split the charging for card elements and payment elements and it does on the split function call. About to share a screenshot

#

It fails right here. Without even attempting a paymentIntent.

solemn compass
#

What's the failure? The highlighted code doesn't look like a Stripe function to me offhand. So I'm not sure what it's expected to do or why it wouldn't run.

rustic bay
#

I have attached another screenshot. While the method isn't a Stripe method per se, I use LatestCharge within

solemn compass
#

Okay, so the error you're seeing is a compilation issue that the method you're trying to call doesn't exist?

rustic bay
#

Its a RunTime error that is confounding me ever since I updated the Stripe API. The error message indicates a missing function in the API, could be wrong though

solemn compass
#

Which version of our SDK are you using?

rustic bay
#
  1. However I am getting the same error when using the latest 43.12
solemn compass
#

Sorry, I'm having trouble lining that version up with our libraries, do you mind also telling which of our libraries you're trying to use?

rustic bay
#

Just updated to 43.12

#

The call I want to make is:
paymentIntent.LatestCharge.BalanceTransactionId

solemn compass
#

I'm not finding the function you're trying to use in our repo.

rustic bay
#

So am I correct in saying that there is no such function: Stripe.Charge Stripe.PaymentIntent.get_LatestCharge()

solemn compass
#

Yeah, I'm not seeing one. When you retrieve the Payment Intent, does the structure of that object not contain the latest_charge (casing may be different) field with the ID of the associated Charge?

rustic bay
#

It doesn't allow me to create a PaymentIntent. If I comment out all references to LatestCharge, everything works. So at this point I'm beginning to believe that the issue is with LatestCharge

solemn compass
#

Wait, what do you mean it won't let you create a Payment Intent? Maybe I'm not understanding correctly. How are you looking for the latest Charge on a Payment Intent if an intent hasn't already been created and processed?

#

Do you have more specifics about the problems and errors you're running into? Are you encountering failed requests with error messages?

rustic bay
#

that's what's so confounding. I want to get the LatestCharge after doing a PaymentIntent. However my code would error out (screenshot from earlier) before I could event attempt a payementintent (no breakpoints hit)

#

When I stopped using the LatestCharge property, everything worked as expected

brisk gobletBOT
rustic bay
#

But for our workflow we need the LatestCharge. In earlier versions of the API, I was able to do:

                charge = paymentIntent.Charges.Data.Single();

But since we need to upgrade the API, I am forced to use the LatestCharge (property/method) and replace the above statement with:

                charge = paymentIntent.LatestCharge;

And all calls to LatestCharge fail

solemn compass
#

Alright, then let's reset. What is the code that you're trying to run to create a Payment Intent, and what is the error/problem you're encountering.

rotund pendant
#

clutch-dotnet-paymentintent

rustic bay
#

Ok. Simply put (and my apologies for the long windedness from earlier), I would like to do this:

                        paymentIntent = ( Task.Run( async () => await new StripeApi.PaymentIntentService().CreateAsync( options ) ) ).Result;

                            payoutDate = GetExpectedPayoutDate( paymentIntent.LatestCharge.BalanceTransactionId );

                    charge = paymentIntent.LatestCharge;
#

However, any calls/use of LatestCharge and I see errors of the type shared in screenshots from earlier

rotund pendant
#

I got it @solemn compass I renamed the thread

#

@rustic bay can you please share exact and full code? Right now your code has options and we don't know what it is.

rustic bay
#

Scratch that. Stand by

rotund pendant
#

Okay so you create a PaymentIntent. The response will have latest_charge: 'ch_123' as a string by default.
And then you go and do paymentIntent.LatestCharge.BalanceTransactionId as if LatestCharge was a full Charge object, which it isn't

rustic bay
#

Interesting and I appreciate that. Let me try

rotund pendant
#

@rustic bay did it work?

rustic bay
#

Let me share what I got.. not sure whether I need to Expand with this approach

#

About to share the error

rotund pendant
#

That code should work but I don't really get why you do that instead of Expand which is way better

rustic bay
#

Hmm guess I couldn't get the Expand working. Anyways, the above code throws the following error:

System.MissingMethodException: Method not found: 'System.String Stripe.PaymentIntent.get_LatestChargeId()'.
at

rotund pendant
#

Okay let's take this one step at a time.
First, create a PaymentIntent and print its id, nothing else, and share that id

rustic bay
#

Okay, so just like before I am unable to create a PaymentIntent with any reference to LatestChargeId (weird, I know and normally one would expect a compile time error).

#

So what I will do is comment out that code and get a PaymentIntentId for now and then try to add it back during the run

rotund pendant
#

yes

rustic bay
#

I need some time, pulled into a meeting, sorry

brisk gobletBOT