#Dai
1 messages · Page 1 of 1 (latest)
👋 happy to help
Hi tarzan
would you mind sharing the error please?
of course
to clarify the sequence of operations
the code is called within the webhook for a successful processing of a payment intent.
from the payment intent the charge is queried
then the balanceTransaction is queried using the Charge's BalanceTransactionId
the error that occured is...
System.Web.HttpUnhandledException (0x80004005): The resource ID cannot be null or whitespace. Parameter name: id ---> System.ArgumentException: The resource ID cannot be null or whitespace. Parameter name: id at Stripe.Service`1.InstanceUrl(String id) in /_/src/Stripe.net/Services/base/Service.cs:line 365 at Stripe.BalanceTransactionService.GetAsync(String id, BalanceTransactionGetOptions options, RequestOptions requestOptions, CancellationToken cancellationToken) in //src/Stripe.net/Services/BalanceTransactions/BalanceTransactionService.cs:line
I suspect the charge.BalanceTrabsactionID was unavailable at the time the webjook was called?
taking a look
This is the first time this error has occured. When the webhook was resent it worked the second time around
would you mind adding logging for the BalanceTransactionID and resend the event so we can see whether the value is being passed or not
btw which event you're listening to?
paymentintentprocesssuccess
payment_intent.succeeded?
correct
I can't really resend the event and add logging right now as it is a production system
I can see that the event has that data
it's really unfortunate, but I can see that the event did succeed afterwards
maybe this is just a hickup
yes, unfortunately from our side though when it was processed again it duped an order
because the first webhook did not complete
if this is a possibility in any way of occuring again I need to reconsider that
I'm terribly sorry about that
I don't really know what the issue was to be honest
and the fact that it "fixed itself" is a bit odd
I guess my question is - balance transaction's should be available at the time of a payment_intent.succeeded event webhook being triggered
right?
If so I just need to make it fail gracefully incase it ever happens again
if not I need to reconsider the logic and osequence of operations
correct
ok thanks
hi karllekko - was there anything to add on this?
not that I was aware of, I'm just joining as my colleague's shift is over. Did you have any outstanding questions I can help with?
@lament rapids did you have a followup?
Hi yes
I did some furtehr digging
the error was thrown in the InstanceUrl method of the Stripe.Service class that the BalanceTransactionSevice class inherits from
I realised I was already catching any erro from querying the balance transaction so the code obviously didn;t get that far
Actually it did get this far
I see that the GetEntityAsync method of the base Service class calls that method and that this is called by the GetAsync method of the balancetransactionservice class
However, I wrapped the GetAsync in a try / catch so I should have caught that error its very weird
the error basically said the id was null that is the id passed into the GetAsync method for the BalanceTransactionService
Looking at the source for InstanceUrl it just throws an argument exception
But as I said I should catch that
the reason I know there is an error is that the inhandled exception log caighgt it
*caught it
it's hard to say, BTs are meant to be available immediately always
there is a new integration mode where they are async(https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async) but I don't think you used that on that PaymentIntent.
no I'm a bit behind in vesrions so it wouldn;t be new
not sure what else I can say
if i deliberately feed a null id into a BalanceTransactionService.GetAsync() call
it throws an error that does not get trapped by a try / catch structure
interesting
unfortuantely I don't have my .NET environment set up right now to test/replicate this, it might just be that when using GetAsync you're supposed to handle the error a different way, but not sure
you can write to https://support.stripe.com/?contact=true or open a Github issue on the stripe-dotnet repository to ask about how errors on that function should be handled