#clutch-dotnet-paymentintent
1 messages ยท Page 1 of 1 (latest)
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.
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.
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.
I have attached another screenshot. While the method isn't a Stripe method per se, I use LatestCharge within
Okay, so the error you're seeing is a compilation issue that the method you're trying to call doesn't exist?
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
Which version of our SDK are you using?
- However I am getting the same error when using the latest 43.12
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?
Just updated to 43.12
The call I want to make is:
paymentIntent.LatestCharge.BalanceTransactionId
I'm not finding the function you're trying to use in our repo.
So am I correct in saying that there is no such function: Stripe.Charge Stripe.PaymentIntent.get_LatestCharge()
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?
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
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?
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
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
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.
clutch-dotnet-paymentintent
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
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.
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
you forgot to expand latest_charge. See https://stripe.com/docs/expand
Interesting and I appreciate that. Let me try
@rustic bay did it work?
Let me share what I got.. not sure whether I need to Expand with this approach
About to share the error
That code should work but I don't really get why you do that instead of Expand which is way better
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
Okay let's take this one step at a time.
First, create a PaymentIntent and print its id, nothing else, and share that id
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
yes
I need some time, pulled into a meeting, sorry