#Jerald
1 messages · Page 1 of 1 (latest)
[ERROR] Failed to POST: Post "https://pwc-fin-bat.co.uk/api/webhook": EOF
this error occur when payment intent succeeded event trigger in CLI
I can't access this endpoint, are you sure your CLI can? Is this on your internal network?
yes
How are you running your command?
I configure it using cli
Stripe listen --events {list of events} --forward-to https://pwc-fin-bat.co.uk/api/webhook
This looks like your CLI can't access the host.
But please share your webhook endpoint code.
How we can test the webhook endpoint is configured correctly
You can share your code with me.
[HttpPost]
public async Task<IHttpActionResult> WebhookAsync()
{
var stripeInput = await new StreamReader(HttpContext.Current.Request.InputStream).ReadToEndAsync();
var webhookSecretKey = ConfigurationManager.AppSettings["WebhookSecretKey"];
try
{
var stripeEvent = EventUtility.ParseEvent(stripeInput);
var stripeSignature = HttpContext.Current.Request.Headers["Stripe-Signature"];
stripeEvent = EventUtility.ConstructEvent(stripeInput, stripeSignature, webhookSecretKey);
var healthcarePayment = new HealthcarePayment();
switch (stripeEvent.Type)
{
case Events.PaymentIntentProcessing:
healthcarePayment.Status = PaymentStatus.Processing;
BuildHealthcarePayment(stripeEvent, healthcarePayment);
await UpdatePaymentAsync(stripeInput, stripeSignature, healthcarePayment);
break;
case Events.PaymentIntentSucceeded:
healthcarePayment.Status = PaymentStatus.Succeeded;
BuildHealthcarePayment(stripeEvent, healthcarePayment);
await UpdatePaymentAsync(stripeInput, stripeSignature, healthcarePayment);
break;
case Events.PaymentIntentPaymentFailed:
healthcarePayment.Status = PaymentStatus.Failed;
BuildHealthcarePayment(stripeEvent, healthcarePayment);
await UpdatePaymentAsync(stripeInput, stripeSignature, healthcarePayment);
break;
}
return Ok();
}
what is the meaning of EOF? in stripe
It's a general term, not Stripe-related: https://en.wikipedia.org/wiki/End-of-file
It is coming from your endpoint, not Stripe.
in my code why its throw EOF error? do you have any idea
By looking at it, no.
What docs have you been following?
Stripe docs
I understand, which one exactly?
I don't see anything unusual.
Could you try putting logs in your code to see if the program even reaches your webhook code.
what you think when the inputstraem is empty then I think we will get EOF error
not sure, there's not really enough information to work with here
sometimes you get this if for example you are trying to visit your URL in your browser directly instead of actually sending a POST request, for example.
is this because https?