#Hritik_9
1 messages · Page 1 of 1 (latest)
Hi, how can I help?
👋
Every Event will be created and sent to your Webhook if it is listening for those Event types
You can either update the Event types so you don't listen for the ones you don't care about, or you can ignore the ones you receive that you don't care about and just return a 200 response and not ingest the data.
But after success of checkout->session why its calling payment_intent.succeeded webhook
Becuase the PaymentIntent is succeeding
So that webhook also fires.
Both things are happening
I explained above how you handle that
I have two different webhooks events
one for payment intent which I am using to make payment from our mobile app
other for the checkout session which I am using to make payment from our website
Scenario 1: when I am making payment from my mobile app the webhook for the payment intent is called and not the one for the checkout session
Scenario 2: when I am making payment form the website both webhooks - payment intent and checkout session are called.
This should not be the case, as the webhook for the checkout session only should be called and not the webhook for the payment intent, why is it?
It should absolutely be the case -- the Event will be created whenever relevant and sent to your endpoint. To handle this you can set metadata on your Checkout Session PaymentIntents using payment_intent_data.metadata (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata) and then when you see a Webhook with this metadata you can ignore it.
how i can pass values of payment.intent.metadata in checkoutsession
Are you the developer for your integration here?
YES
Okay so then you pass a metadata key/value pair to the payment_intent_data hash
I can't write your code for you
$checkoutSession = $stripe->checkout->sessions->create([
'success_url' => 'https://staging.prosperty.in/my-wallet', // Define your success route
'cancel_url' => 'https://staging.prosperty.in/my-wallet', // Define your cancel route
'payment_method_types' => ['card'], // Use 'card' for credit/debit card payments
'mode' => 'payment', // Set mode to 'payment'
'customer' => $isAlreadyExist->stripe_customer_id, // The customer's Stripe ID
'payment_intent_data'=>['userId'=>$userData->id,'userEmail'=>$userData->email],
'line_items' => [
[
'price_data' => [
'currency' => 'inr', // Replace with your desired currency
'unit_amount' => $depositAmount, // Amount in the smallest currency unit (e.g., cents)
'product_data' => [
'name' => 'Deposit', // Name for the deposit
],
],
'quantity' => 1, // Quantity is 1 for a single payment
],
],
]);
yes i tried to add payment_intent_data but it throws error
'metadata' => [
'key' => 'value' ]
]```
Thanks a lot bro!!...It perfectly worked for both.. WEB and Mobile app