"stripe payment gateway integration in asp.net core" Code Answer's
You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "stripe payment gateway integration in asp.net core" answered properly. Developers are finding an appropriate answer about stripe payment gateway integration in asp.net core related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like stripe payment gateway integration in asp.net core. Enter your desired code related query in the search bar and get every piece of information about C# code related question on stripe payment gateway integration in asp.net core.
stripe payment gateway integration in asp.net core
private readonly string WebhookSecret = "whsec_OurSigningSecret";
//Previous actions
[HttpPost]
public IActionResult ChargeChange()
{
var json = new StreamReader(HttpContext.Request.Body).ReadToEnd();
try
{
var stripeEvent = EventUtility.ConstructEvent(json,
Request.Headers["Stripe-Signature"], WebhookSecret, throwOnApiVersionMismatch: true);
Charge charge = (Charge)stripeEvent.Data.Object;
switch (charge.Status)
{
case "succeeded":
//This is an example of what to do after a charge is successful
charge.Metadata.TryGetValue("Product", out string Product);
charge.Metadata.TryGetValue("Quantity", out string Quantity);
Database.ReduceStock(Product, Quantity);
break;
case "failed":
//Code to execute on a failed charge
break;
}
}
catch (Exception e)
{
e.Ship(HttpContext);
return BadRequest();
}
return Ok();
}
Source: blog.elmah.io
All those coders who are working on the C# based application and are stuck on stripe payment gateway integration in asp.net core can get a collection of related answers to their query. Programmers need to enter their query on stripe payment gateway integration in asp.net core related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about stripe payment gateway integration in asp.net core for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of stripe payment gateway integration in asp.net core while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "stripe payment gateway integration in asp.net core". Visit this developer's friendly online web community, CodeProZone, and get your queries like stripe payment gateway integration in asp.net core resolved professionally and stay updated to the latest C# updates.