#Reyansh Sharma
1 messages ยท Page 1 of 1 (latest)
hi! I don't understand what you're asking. Could you elaborate?
๐ We have a webhook that updates our back end as soon as subscriptions invoice got charged on stripe.
Though subscription invoice with ID in_1N4Y34JdeZNZxtt5iVRsP67E failed to do so on our end with an exception message
The resource ID cannot be null or whitespace.
While going through the request object we received not able to find the Charge object (Its null).
the charge field on an invoice can be null , that is normal
for example if the Invoice is for $0 or a small amount(which can happen due to proration or coupons or applied balances).
if you have some code assuming it must not be null and throwing an error in that case, that code is incorrect
๐ Haha I Agree will add an extra check for the same if that is the case.
Thanks for the same.
One more thing I am using Strpe.Net (41.2.0).
Was having issues with the stripe webhook version while using EventUtility.ParseEvent so used the event with [throwOnApiVersionMismatch]
Everything seems to be working fine but any issues it could cause in future?
yes it could cause issues in future
the correct approach is to create the webhook endpoint using the API version that your version of the library expects
the easiest way is to make sure you're using the latest version of stripe-dotnet, and make sure your account is using the latest API version in your Developer settings, and then create the endpoint selecting the option to have it use the 'latest version'
In our case, the scenario is one app to many stripe accounts & hard to keep track of all the accounts.
then you can use https://stripe.com/docs/api/webhook_endpoints/create#create_webhook_endpoint-api_version on each account when your app is installed on them to create the endpoint with the version you need
So in this case recommendation is to provide the version during Webhook creation on stripe and then use the same while processing the requests in app again I belive.
Thanks I see there is a discount added for the same amount as the Invoice for this so amount_paid was 0 hence chargeId was null ๐ฆ