#mudassir.dev
1 messages · Page 1 of 1 (latest)
customer: customer.id,
items: [
{
price: priceId,
},
],
coupon: coupon ? coupon.id : null,
default_payment_method: cardId,
payment_behavior: "error_if_incomplete",
expand: ["latest_invoice.payment_intent"],
metadata: {
discount: amountOff / 100,
for: "new subscription",
},
});```
You are setting the metada on the subscription object, not the payment intent object
This code creates a payment intent that's paid right here. I want the payment intent to have metadata before its paid
Your code creates a subscription, and the paymentIntent is created by the invoice that the subscription creates.
Yes, I want that payment intent to have metadata before it's paid
You can listen to the invoice.created event, and manually set the metadata on the paymentIntent of the invoice.
Any other way around this
No