#darwin_34890
1 messages · Page 1 of 1 (latest)
Let's open your request on your Dashboard request log
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
To see how it looks like
Probably that's the curl syntax
Yeah I think I just need to the format when I'm passing metadata
It's should be in JSON form right?
"success_url": "https://localhost:7217/success",
"line_items": {
"0": {
"price_data": {
"unit_amount": "100",
"currency": "USD",
"product_data": {
"metadata": "'{{\"brand\":\"JLR Poland\"}}'",
"name": "Reservation Fee"
}
},
"quantity": "1"
}
},
"cancel_url": "https://localhost:7217/create-checkout-session/cancel",
"mode": "payment"
}```
Not very familiar with curl sorry. You may need to try and error
I think it's not the JSON form, it should be just key and value
This is less levels but example:
curl https://api.stripe.com/v1/customers \
-u sk_test_xxx: \
-d "metadata[order_id]"=6735
Oh I see
Let me try
I tried "param": "line_items[0][price_data][product_data][brand]",
But I'm getting this error
{
"error": {
"code": "parameter_unknown",
"doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
"message": "Received unknown parameter: line_items[0][price_data][product_data][brand]",
"param": "line_items[0][price_data][product_data][brand]",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_Lu2WO4Tmzivt0s?t=1697085047",
"type": "invalid_request_error"
}
}
there is no such parameter brand under product_data https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yeah I know but I tried this format you shown metadata[order_id]"=6735
i don't understand it's easy to pass that data via SDK Library
can you share your exact code snippet?
to be clear, metadata expects a string. the way to go about it for that screenshot, should actually be
line_items[0][price_data][product_data][metadata][brand]
Actually it was an object on the collection
and then in the value, you input JLR-POL
Let's try putting [brand] after [metadata]
You are lacking [metadata]
Have you checked the request in Dashboard and see if you really passed in metadata?
Also, this is metadata for the Product of the line item
Retrieve the line items to see https://stripe.com/docs/api/checkout/sessions/line_items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Nothing is showing up on the dashboard related to the transaction
have you attempted to pay on the Checkout Session?
A PaymentIntent will only be created (and hence show in that Dashboard page) after you attempt to pay
I already did the payment but there's no metadata reflected
This is the paymentIntentId - pi_3O0HXaAgh0zbdxN71Uz4Ml0B
if you want the metadata to reflect on the PaymentIntent, you should pass metadata into this parameter instead : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Great! It works!