Base solution for your next web application
Open Closed

ASP.NET Core/Angular Stripe Webhooks problem #8671


User avatar
0
denis.karovic created

Hello ASP.NET Zero,

I am trying to make Stripe payment proccess work. So far, I've created Stripe developer account, installed Stripe CLI, created Webhook to my local machine. Subscriptions purchased from Angular side are shown on stripe dashboard. But payment proccess cannot be finished, because in StripePaymentAppService.GetPaymentResult() this condition is never met payment.Status == SubscriptionPaymentStatus.Completed, no matter how many times action is called from Angular side.

I think the problem is that stripe cli listen and forward command is not configured correctly, so StripeControllerBase.WebHooks() method is never called. I tried running this command with various ports, but i cannot make it work : stripe listen --forward-to https://localhost:XXXXXX/Stripe/WebHooks

**This is the output of stripe cli after making purchase from angular side **

	2020-03-13 14:08:39   --> payment_intent.created [evt_1GMDFiARA5glizJOChWcBlF6]
	2020-03-13 14:08:40            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

	2020-03-13 14:09:18   --> payment_intent.succeeded [evt_1GMDGLARA5glizJOWvG9Qyvo]
	2020-03-13 14:09:19            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

	2020-03-13 14:09:20   --> checkout.session.completed [evt_1GMDGLARA5glizJOKbCq8Cxy]
	2020-03-13 14:09:20   --> charge.succeeded [evt_1GMDGLARA5glizJOtdfj9rra]
	2020-03-13 14:09:21   --> customer.created [evt_1GMDGLARA5glizJOKjNr21oK]
	2020-03-13 14:09:21   --> payment_method.attached [evt_1GMDGLARA5glizJOiWYJjJ9x]
	2020-03-13 14:09:22            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

	2020-03-13 14:09:22            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

	2020-03-13 14:09:22            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

	2020-03-13 14:09:22            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.
	

This is output of stripe cli after running stripe trigger payment_intent.created

    2020-03-13 14:11:19   --> payment_intent.succeeded [evt_1GMDIJARA5glizJO60AfGW7C]
    2020-03-13 14:11:19   --> charge.succeeded [evt_1GMDIJARA5glizJOGc2Wt9bv]
    2020-03-13 14:11:19   --> payment_intent.created [evt_1GMDIJARA5glizJOMhZux29M]
    2020-03-13 14:11:21            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

    2020-03-13 14:11:21            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

    2020-03-13 14:11:21            [ERROR] Failed to POST: Post https://localhost:57743/Stripe/WebHooks: dial tcp [::1]:57743: connectex: No connection could be made because the target machine actively refused it.

launchSetting.json from Web.Host:

    {
      "iisSettings": {
        "windowsAuthentication": false,
        "anonymousAuthentication": true,
        "iisExpress": {
          "applicationUrl": "http://localhost:22742/",
          "sslPort": 0
        }
      },
      "profiles": {
        "IIS Express": {
          "commandName": "IISExpress",
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        },
        "EkhartYoga.Web.Host": {
          "commandName": "Project",
          "launchUrl": "http://localhost:22742",
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        }
      }
    }

launchSetting.json from Web.Core:

    {
      "iisSettings": {
        "windowsAuthentication": false,
        "anonymousAuthentication": true,
        "iisExpress": {
          "applicationUrl": "http://localhost:57741/",
          "sslPort": 0
        }
      },
      "profiles": {
        "IIS Express": {
          "commandName": "IISExpress",
          "launchBrowser": true,
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        },
        "EkhartYoga.Web.Core": {
          "commandName": "Project",
          "launchBrowser": true,
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          },
          "applicationUrl": "http://localhost:57743/"
        }
      }
    }

2 Answer(s)
  • User Avatar
    0
    denis.karovic created

    I find out what was the problem, out project is set up to use http no https, so stripe cli command should be called like this: stripe listen --forward-to http://localhost:22742/Stripe/WebHooks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @denis.karovic :)