#ShubhamDev

1 messages · Page 1 of 1 (latest)

mild valveBOT
worn rampart
#

Hi there!

#

I'm not sure I understand your question. Can you clarify what you are trying to do?

jolly basin
#

Once Payment is succeed, How we can capture the response?

#

I had created a webhook endpoint by webhook.site url. Now I want to capture the response as an api.

worn rampart
#

How we can capture the response?
What does this mean? You want to be notified when the PaymentIntent is successfull? If so, you need to listen to payment_intent.succeeded webhook event. And you can learn more about webhooks here: https://stripe.com/docs/webhooks/quickstart

jolly basin
#

I am passing the metadata while creating the subscription. But I am not getting the metadata response once payment is succeed, Could you please help me how to get metadata details after payment successfull ?

worn rampart
#

I'm guessing the metadata is on the subscription object, not the PaymentIntent. So on the PaymentIntent object, find the invoice property. And then on the Invoice object, find the subscription property. And then on the subscription you'll find the metadata.

#

Also you could directly listen to invoice.paid instead of payment_intent.succeeded

#

This way you can direclty look at the subscription property to find the subscription ID.

jolly basin
#

We are using subscription create api for creating the client secret, this client secret is using for the payment completion from the frontend, from there only we are creating the payment intent, If we want to add metadata to the payment intent, Do we need to use create payment intent api for subscription flow?

worn rampart
#

from there only we are creating the payment intent,
You don't create the PaymentIntent. When you create the subscription, it automatically contains an invoice with a PaymentIntent and a client_secret.
If we want to metadata to the payment intent, Do we need to use create payment intent api for subscription flow?
No, if you want to add metadata to the PaymentIntent of the subscription, you just need to update the existing PaymentIntent with the metadata you want. You could lisent to the payment_intent.created event to know when a new PaymentIntent was created.