#Dai

1 messages · Page 1 of 1 (latest)

placid sonnetBOT
spring basalt
#

👋 happy to help

lament rapids
#

Hi tarzan

spring basalt
#

would you mind sharing the error please?

lament rapids
#

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?

spring basalt
#

would you mind sharing the charge ID?

#

or the event ID

lament rapids
#

one moment

#

"id": "ch_3Nus97FyuEVpH6pT1Bh8dIfO",

spring basalt
#

taking a look

lament rapids
#

This is the first time this error has occured. When the webhook was resent it worked the second time around

spring basalt
#

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?

lament rapids
#

paymentintentprocesssuccess

spring basalt
#

payment_intent.succeeded?

lament rapids
#

correct

#

I can't really resend the event and add logging right now as it is a production system

spring basalt
#

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

lament rapids
#

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

spring basalt
#

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

lament rapids
#

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

lament rapids
#

ok thanks

placid sonnetBOT
lament rapids
#

hi karllekko - was there anything to add on this?

queen geode
#

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?

queen geode
#

@lament rapids did you have a followup?

lament rapids
#

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

queen geode
#

it's hard to say, BTs are meant to be available immediately always

lament rapids
#

no I'm a bit behind in vesrions so it wouldn;t be new

queen geode
#

not sure what else I can say

lament rapids
#

opk

#

ok

#

will keep digging

#

I just tested this in dev

placid sonnetBOT
lament rapids
#

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

queen geode
#

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

lament rapids
#

i think i got it

#

InstanceUrl is not throwing a StripeException

#

its throwing a regular exception for argument type

#

yep that was it

#

ok no prob

#

I was only catching stripe exceptions

#

at least I know whats going on now