Stripe Webhooks
Using Stripe Webhooks you can receive status updated about payments posted via API.
Webhooks: Documentation
See Documentation: Check the Webhook signatures
Here are the steps:
- Create a controller (Grant Access to the Guess user to it).
- Configure the Webhook in Stripe Dashboard or via API: See how to create the Webhook via API from Magentrix example code below.
- Before you can verify signatures, you need to retrieve your endpoint's secret from your Dashboard's Webhooks settings. Select an endpoint that you want to obtain the secret for, then click the Click to reveal button. Stripe generates a unique secret key for each endpoint.
- On your Connected App, set the Webhook Signing Secret as the Password.
Create an Action to be called once, manually. Set the Webhook information:
public ActionResponse CreateWebhook()
{
var enableEventsList = new List<string>() {
"payment_intent.succeeded",
"payment_intent.payment_failed"
};
var model = new Stripe2.Webhook() {
Description = "Force Portal Webhook",
EnabledEvents = enableEventsList,
Url = "https://<portal-domain>/acls/stripewebhook/updatepaymentintent",
};
try
{
var stripe = new Stripe2.StripeHelper('<STRIPE_CONNECTED_APP>');
var webhook = stripe.CreateWebhook(model);
if (webhook == null)
return Json(new { Message = "Webhook cannot be created." }, true);
return Json(new { Webhook = webhook }, true);
}
catch (Exception ex)
{
return Json(new {
Message = "Webhook cannot be created. Error: " + ex.Message
}, true);
}
}
The Webhook will be created, the response will contain the Signing Secret you need to set as password on the Connected App.

You can get it from the Stripe Dashboard as well:

Signing Secret you need to set as password on the Connected App:

Webhook callback example:
[MasterName("Public")]
publicclassStripeWebhookController : AspxController
{
[HttpPost]
public ActionResponse UpdatePaymentIntent()
{
try
{
var stripe = new Stripe2.StripeHelper();
Stripe2.WebhookResponseObject response = stripe.ValidateWebHook();
}
catch (StripeValidationException ex)
{
}
catch (Exception e)
{
SystemInfo.Debug($"[2. StripeWebhookController] [UpdatePaymentIntent] [Error: {e.Message}]")
}
return Json(new { Response = "Done!" }, true);
}
}