iampre409
iampre409

Reputation: 357

Stripe MetaData Working Properly But Not Showing Up on Stripe Dashboard

I've implemented Stripe checkout on a Django app and it's all working correctly except that it's not showing up on the Stripe Dashboard, even though it's showing in the event data on the same page. Have I formatted it incorrectly or am I overlooking something obvious?

This is how I added meta data:

    checkout_session = stripe.checkout.Session.create(
    payment_method_types=['card'],
    line_items = line_itemz,
    metadata={
    "payment_type":"schedule_visit",
    "visit_id":visit_id

    },
    mode='payment',
    success_url= 'http://localhost:8000/success',
    cancel_url = 'http://localhost:8000/cancel',)

Here is a screenshot of the Metadata section empty, but in the events the Metadata is there as it should be:

enter image description here

Again I can access the metadata every where else but would like it to show up on the dashboard so my team can more easily access that information.

Upvotes: 5

Views: 4387

Answers (1)

yuting
yuting

Reputation: 1694

The metadata field you set is for Checkout Session alone, but not on Payment Intent (which is the Dashboard page you are at). To have metadata shown at the Payment Intent, I'd suggest also setting payment_intent_data.metadata [0] in the request when creating a Checkout Session.

For example,

session = stripe.checkout.Session.create(
  success_url="https://example.com/success",
  cancel_url="https://example.com/cancel",
  line_items=[
    {
      "price": "price_xxx",
      "quantity": 1,
    },
  ],
  mode="payment",
  metadata={
    "payment_type": "schedule_visit",
    "visit_id": "123"
  },
  payment_intent_data={
    "metadata": {
      "payment_type": "schedule_visit",
      "visit_id": "123"
    }
  }
)

[0] https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata

Upvotes: 12

Related Questions