Need Webhook help and clarrifications
PaqHelp
New Community Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Aug-17-2020
08:34 AM
Hello,
I am trying to implement a paypal subscription service on my site.
I use Angular as front end, ASP.net as backend.
I have added a webhook to my site.
[HttpPost]
public IActionResult Post()
{
bool isValid;
try
{
// The APIContext object can contain an optional override for the trusted certificate.
var apiContext = new APIContext();
// Get the received request's headers
var requestheaders = HttpContext.Request.Headers;
// Get the received request's body
var requestBody = string.Empty;
using (var reader = new StreamReader(HttpContext.Request.Body))
{
requestBody = reader.ReadToEnd();
}
NameValueCollection nvc = new NameValueCollection();
foreach (var item in requestheaders)
{
nvc.Add(item.Key, string.Join(",", item.Value));
}
// We have all the information the SDK needs, so perform the validation.
isValid = WebhookEvent.ValidateReceivedEvent(apiContext, nvc, requestBody, ConfigurationManager.AppSettings["paypal.webhook.id"]);
}
catch (Exception ex)
{
isValid = false;
}
if (isValid)
{
return Ok();
}
else
{
return BadRequest("Could not validate request");
}
}
So far I can get the sandbox user to login, subscribe and I see the event in the Sandbox webhooks events.
But, the events are all listed as 'Pending'.
What am I missing?
0 REPLIES 0

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Assistance Needed: Passing and Retrieving Custom Data in PayPal Webhook Payload in PayPal Payments Standard
- Unable to issue a refund from our business sandbox account in Sandbox Environment
- How to get the custom field from a payment with webhook/API? in REST APIs
- CHECKOUT.ORDER.APPROVED webhook event not triggered if payment_source is passed in in REST APIs
- Paypal Sandbox webshook (SANDBOX WEBHOOKS) not working Real time issue not trigger in Sandbox Environment