#farfa7886

1 messages ยท Page 1 of 1 (latest)

patent oysterBOT
distant quiver
#

Hello! Can you clarify what you mean by "it doesn't get sent"?

#

Do you have an example request ID I can take a look at?

buoyant stone
# distant quiver Hello! Can you clarify what you mean by "it doesn't get sent"?

In this code

    switch (event.type) {
      case "payment_intent.succeeded":
        const paymentIntentSucceeded = event.data.object;
        console.log(paymentIntentSucceeded.metadata.userId);
        try {
          let userData = await User.findById(
            paymentIntentSucceeded.metadata.userId
          );
          userData.balance += Number(paymentIntentSucceeded.metadata.amount);
          userData.markModified("balance");
          await userData.save();
        } catch (err) {}
        break;
      default:
        console.log(`Unhandled event type ${event.type}`);
    }```

When the request is made via the CLI I can access the `paymentIntentSucceeded.metadata` object, but when using the code above the `metadata` object is empty
#

evt_3O83iZIoOgSh9ZaU2eL1pmiO

distant quiver
#

๐Ÿ‘ let me take a look

#

Ah, that's the event for the Payment Intent - is your goal to set metadata on the checkout session that'll be automatically set on the Paymetn Intent?

buoyant stone
#

im still new to stripe ๐Ÿ˜…

#

in the docs there is written that I can attach a metadata object but the object becomes null when payment intent succeeded

distant quiver
buoyant stone
#

thank you! I will now try

#

@distant quiver it works! thank you!