#pankaj-webhooks

1 messages ยท Page 1 of 1 (latest)

nimble frigate
#

hi there! can you share more on what isn't working? Are you receiving an error message?

torn narwhal
#

Notice: Undefined index: HTTP_STRIPE_SIGNATURE in

#

I am getting this error

nimble frigate
torn narwhal
#

$endpoint_secret

#

where i can get its value

nimble frigate
#

are you using a webhook endpoint defined in the Dashboard or via the API? Or are you using the Stripe CLI to test webhooks?

torn narwhal
#

whsec_...

nimble frigate
#

did you define your webhook endpoint via the Dashboard? I'll need to know the answer to this to be able to help you

torn narwhal
#

No I did not set

nimble frigate
#

please don't share your code with the secret key

torn narwhal
#

I was trying to get payment intent

#

ok

#

\Stripe\Stripe::setApiKey();

$payload = file_get_contents('php://input');
$event = null;

try {
$event = \Stripe\Event::constructFrom(
json_decode($payload, true)
);
\Drupal::logger('stripe_description')->warning('<pre><code>' . print_r($payload, TRUE) . '</code></pre>');

//\Drupal::logger->debug('<pre>@payload</pre>', ['@payload' => $payload]);

} catch(UnexpectedValueException $e) {
// Invalid payload
http_response_code(400);
exit();
}

// Handle the event
switch ($event->type) {
case 'payment_intent.succeeded':
$paymentIntent = $event->data->object; // contains a \Stripe\PaymentIntent

    handlePaymentIntentSucceeded($paymentIntent);
    \Drupal::logger('stripe_description')->notice("111");
    break;
case 'payment_method.attached':
    $paymentMethod = $event->data->object; // contains a \Stripe\PaymentMethod
    handlePaymentMethodAttached($paymentMethod);
    \Drupal::logger('stripe_description')->notice("222");
    break;
// ... handle other event types
default:
    echo 'Received unknown event type ' . $event->type;
    \Drupal::logger('stripe_description')->notice("d");

}

#

This is the code that I was trying

nimble frigate
torn narwhal
#

No i dont have created endpoint

#

Endpoint URL

#

URL where I need to get the call?

#

Alex??

nimble frigate
#

it's up to you where you want to define the endpoint URL. You may want to take a look at this page for a basic understanding of webhooks: https://stripe.com/docs/webhooks?

torn narwhal
#

where i can see the webhook secret

#

aftre create an endpoint

nimble frigate
#

if you've created it in the Dashboard, click into the endpoint, you should be able to see a section that looks like

#

click on Reveal and you'll be able to see the endpoint secret

torn narwhal
#

I used quick start

nimble frigate
#

if you're using that guide, it looks like you're planning to use the Stripe CLI - you'll see the webhook secret when you run stripe listen --forward-to localhost:4242/webhook

torn narwhal
#

Webhook error while validating signature.

#

no

#

i dont want Stripe CLI

nimble frigate
torn narwhal
#

Yes I created a endpint

#

I paste the endpoint_secret in code

nimble frigate
torn narwhal
#

acct_102dHa2svt92FOo9

hardy gulch
#

๐Ÿ‘‹ stepping in and catching up

#

Ok I see you have https://dev-inscopixstore.pantheonsite.io/webhook setup, correct?

#

And you have taken its secret and use in your code?

#

which part isn't working? the $_SERVER['HTTP_STRIPE_SIGNATURE'];?

torn narwhal
#

Yes

#

orakaro

#

??

hardy gulch
#

๐Ÿ‘‹ Are you sure $_SERVER has other values?

#

I doubt that maybe your framework or your web hosting service stripped out HTTP_STRIPE_SIGNATURE

torn narwhal
#

ok LMC

torn narwhal
#

Is it required to use libratry

hardy gulch
#

Yes but maybe the library striped out some header