Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Stripe Webhooks work in test mode, but fail in Live mode #11046


User avatar
0
rvanwoezik created

ASP.NET CORE & Angular (single solution) .NET 6.0 v11.1.0

When register a new tenant with stripe in live mode the payment get stuck on:

https://www.fitpeopleusa.com/account/stripe-payment-result?sessionId=cs_live********** Please Wait Receiving payment result. Please wait

When using stripe in test mode in local debug with Stripe CLI Listener it works

Tenant is created, but is not active.

Webhook Log in Stripe gives an 405 Error for both checkout.session.completed and invoice.paid <!DOCTYPE html><html><head><title>UnsupportedHttpVerb</title></head><body><h1>The resource doesn't support specified Http Verb.</h1><p><ul><li>HttpStatusCode: 405</li><li>ErrorCode: UnsupportedHttpVerb</li><li>RequestId : 181beb7c-601e-0018-39ad-585e8a000000</li><li>TimeStamp : 2022-04-25T14:02:22.0604296Z</li></ul></p></body></html>

Stripe API version: 2020-08-27

No errors in log file

Please help!


9 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
  • User Avatar
    0
    rvanwoezik created

    Hi, I already checked that and it worked before, looks like transfer from .NET 5.0 to .NET 6.0 made it stop working, but i am not sure. Funny thing when i debug local with Stripe CLI listener it works. Any other AZN users experience the same?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Maybe you can write a log here just to confirm if Webhook request reaches to your method or not. It might be blocked before reaching to your app.

  • User Avatar
    0
    rvanwoezik created
     [HttpPost]
            public async Task<IActionResult> WebHooks()
            {
                string json;
                using (var streamReader = new StreamReader(HttpContext.Request.Body))
                {
                    json = await streamReader.ReadToEndAsync();
                }
    
                Logger.debug("Json = " + json);
    

    To be sure, does Logger.debug show when in production?

    Meanwhile i found out it gets timed-out in the getPaymentResult loop in stripe-payment-result.component.ts

    getPaymentResult(): void {
            this._stripePaymentService.getPaymentResult(this.paymentId).subscribe(
                (paymentResult) => {
                    if (paymentResult.paymentDone) {
                        this._router.navigate(['account/payment-completed']);
                    } else {
                        this.controlAgain();
                    }
                },
                (err) => {
                    this.controlAgain();
                }
            );
        }
    

    Checking the database record in dbo.AppSubscriptionPayments Is says Status = 1 (NotPaid)

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @rvanwoezik

    To be sure, does Logger.debug show when in production?

    This depends on your log4net.config file but you can use Logger.Warn just to be sure. Yes, if the payment status doesn't change to Paid, UI will wait for it to finish and will never return the result page. Maybe we can add a timeout on our side here.

  • User Avatar
    0
    rvanwoezik created

    But the question is, why doesn't change the payment status to Paid? While it works local in debug with the Stripe CLI Listener

    Is it because of Azure handling? Is it i because i have Sign In without specifying Tenant Or is it i have one user per tenant for billing

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @rvanwoezik

    There might be several problems here. If the webhook doesn't hit to your application, then the payment status will not be changed. So, first, you need to be sure if webhook in production hits your app or not. In order to do that, it is better to write a log on your app as I suggested above. You can also check webhook request status on your Stripe portal.

    If webhook hits your app, then it might be related to item 2 or 3 you shared above. We can dig further after being sure about webhook reaches your app or not.

  • User Avatar
    0
    rvanwoezik created

    I have send you an email directly on 5th of May, 2022 to [email protected] Maybe you have missed it.

    Can you please check!

    Kind Regards Rene van Woezik

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @rvanwoezik

    Sorry, we have replied to your email.

    Thanks,