blazor-ecommerce icon indicating copy to clipboard operation
blazor-ecommerce copied to clipboard

Stripe payment not working - missing UserId on webhook call

Open rgamage opened this issue 11 months ago • 0 comments

When a stripe payment is processed, Stripe calls back on /api/payment to FullFillOrder() method. This should fetch the shopping cart items and add an Order to the Order table, then clear the shopping cart items.

However, as the stripe client is not an authenticated / logged in user, the PaymentController has no identity for it, therefore the CurrentUser is null, or rather the _currentUser.UserId is null, and therefore no shopping cart items are retrieved.

I believe we need to pass in a UserId when we create the checkout session (PaymentService.CreateCheckoutSession()), using some stripe field like ClientReferenceId. Then, on the callback processing side, we need to parse this UserId and pass it to the GetDbCartProductsQueryRequest.

Has this workflow ever been tested, has it ever worked? Am I missing something fundamental?

Thanks, Randy

rgamage avatar Dec 09 '24 23:12 rgamage