#coldrain-checkout

1 messages · Page 1 of 1 (latest)

paper oracle
#

👋 Happy to help

ivory bronze
#

hello

#

I'm trying to map my metadata, wait a second

paper oracle
#

Can you share the error that you're facing when using metadata?

ivory bronze
#

It works when it's outside line items

#

now I'll map, wait a second and show u error

#

"Invalid value type: {:item=>{:name=>"Amira", :_createdAt=>"2022-08-29T13:29:25Z", :quantity=>"1", :_type=>"product", :_updatedAt=>"2022-08-29T13:36:44Z", :image=>{:"0"=>{:_type=>"image", :_key=>"60cb05945adb", :asset=>{:_type=>"reference", :_ref=>"image-22ce77c63db11e3e482e73bd086f5d744d3c69d2-1500x2250-jpg"}}}, :price=>"672", :_rev=>"jmTP3LYrZrN0wRtRCwXwwl", :dress=>{:height=>"123", :waistToEnd=>"123", :shoulderToEnd=>"0", :bustSize=>"123", :shoulderToWaist=>"123", :sleeveLength=>"123", :waistVolume=>"123", :dressLength=>"123"}, :details=>"fdsfsdf", :_id=>"11bc0914-e593-411e-8305-8ffa0033d4c1", :slug=>{:_type=>"slug", :current=>"amira"}}} must be a string"

#

I'm trying to map my object

#

with my metadata

paper oracle
#

Thanks for sharing

ivory bronze
#

even if I'll do something like this

paper oracle
#

It looks like you're passing metadata value an object

ivory bronze
#

key && value

#

with direct path

paper oracle
#

Metadata value accepts string, not object

#

You should convert it into into string from object before setting into metadata

ivory bronze
#

oh

#

but how can I structure my data then

paper oracle
#

You can convert it into json string

#

Why do you want to store dress object with Stripe?

ivory bronze
#

I need those parameters

paper oracle
#

It can potentially be trimmed off if the final string is more than 500 characters

ivory bronze
#

so how can I convert it in JSON ?

#

I've made it

#

but why I don't see any info here?

paper oracle
#

The page you are in is Payment Intent metadata, not Checkout Session metadata

ivory bronze
#

I was reading it, but I dont get why your api dont let to pass an object, it would be much easier

#

Is there a better solution to make it more beatiful?

paper oracle
#

it can't be object because other languages like Java and C# require typing

paper oracle
#

yup. the object type is defined by user's server and stripe doesn't know, so we can't store as an object, but the universal string that accepts by different languages

#

the intention of metadata is also not to store to object

#

but the reference to the object such as order ID

ivory bronze
#

so if I want to make it more beautiful I need to make my own server and req my metadata and JSON it. Right?

#

Two last questions. What happen if metadata exceeds 500 char limit?

#

If I get 501, 502 etc error from stripe API it will cause my app to crash? Do I need to add more?

paper oracle
#

What happen if metadata exceeds 500 char limit?
Stripe will return 400 error

#

If I get 501, 502 etc error from stripe API it will cause my app to crash? Do I need to add more?
From the code, this seems to fine, but it'll depend how your frontend handles 500 error from your server

ivory bronze
#

Ok. Thank you so much for your help.

paper oracle
#

No problem! Happy to help

ivory bronze
#

And last one. Do I need to enter a color of a dress in a metadata?

paper oracle
#

That's up to you since metadata is for your own reference and Stripe doesn't use information from metadata

ivory bronze
#

I think I cannot make color visible in a checkout page?

paper oracle
#

What are you trying to achieve? Metadata is for your reference and not visible to checkout page

ivory bronze
#

I'm not talking about metadata. I'm asking about a color selected by user in a stripe checkout page

paper oracle
#

I don't understand question. Do you mean you want to display the dress color in text somewhere in the checkout page?

paper oracle