#mudassir.dev

1 messages · Page 1 of 1 (latest)

stoic yokeBOT
serene wasp
#
          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",
          },
        });```
wanton narwhal
#

You are setting the metada on the subscription object, not the payment intent object

serene wasp
#

This code creates a payment intent that's paid right here. I want the payment intent to have metadata before its paid

wanton narwhal
#

Your code creates a subscription, and the paymentIntent is created by the invoice that the subscription creates.

serene wasp
#

Yes, I want that payment intent to have metadata before it's paid

wanton narwhal
#

You can listen to the invoice.created event, and manually set the metadata on the paymentIntent of the invoice.

serene wasp
#

Any other way around this

wanton narwhal
#

No