#pedrofumero

1 messages ยท Page 1 of 1 (latest)

restive hamletBOT
modern forge
#

๐Ÿ‘‹ happy to help

#

would you mind sharing an example? with IDs

peak slate
#

Of course, for example:
When I create a payment link using my backend I send something like this:
this.stripe.paymentLinks.create({
line_items: [
{
price: price.id,
quantity: 1,
},
],
after_completion: {
type: 'hosted_confirmation',
hosted_confirmation: {
custom_message: 'Thank you for your purchase!',
},
},
// application_fee_percent: 15,
metadata: {
ticketId: '65b98c633e4c5d09a2353072',
saleNumber: 85236,
},
transfer_data: {
destination: 'acct_1JQ4Zz2Z22230Z8Z0Z',
},
currency: 'eur',
});

Well, I got the url for the payment link, and all is good at the moment.

Now I want to create a payment, so I open the url, and fill in the form to send the payment, for the example I'm using this card: 4000000000004954 (it triggers a high risk so it blocks the payment), and at the moment of pay using this card I receive some events in my webhook endpoint: charge.failed,payment_intent.created,payment_intent.payment_failed

I would expect these events to come with the same metadata the original object has, but it does not, instead, I receive the metadata property as an empty object, and thus I can't update my: ticketId: '65b98c633e4c5d09a2353072' in DB because I don't know at which element this event corresponds.

modern forge
#

ok so basically Payment Link metadata are copied to the Checkout Session but not to the underlying payment Intent

peak slate
#

Is there any way to achieve what I'm looking for? at least in this case, I want to be able to update the related entity in my DB. Is there a strategy to achieve it? or a common use case?

modern forge
#

then you can look at the metadata there

#

and for the future you can listen to the checkout.session.completed and copy the metadata from the Checkout Session to the underlying PaymentIntent object