mutebg / online-store

18 stars 3 forks source link

Sample Request for Checkout API #14

Closed ghost closed 6 years ago

ghost commented 6 years ago

I am trying to call the checkout API.

When it tries to validate the products it reports the following error: "checkOut error is : TypeError: Cannot read property 'every' of undefined at Promise.then.result (/user_code/checkout.js:56:31) at process._tickDomainCallback (internal/process/next_tick.js:135:7)"

My request looks like this: POST /api/checkout HTTP/1.1 Host: us-central1-XXX.cloudfunctions.net Content-Type: application/x-www-form-urlencoded; charset=utf-8 Connection: keep-alive Accept: / User-Agent: ClientApp/1.0 (com.some.cool.domain.name; build:1; iOS 11.4.0) Alamofire/4.7.2 Accept-Language: en;q=1.0 Content-Length: 304 Accept-Encoding: gzip;q=1.0, compress;q=0.5

amount=11.00&items%5Bdescription%5D=Spicy%20bombay%20mix%20from%20Kenya.&items%5Bname%5D=Kenyan%20Chevdo&items%5Bimages%5D%5B%5D=https%3A//supergrocery.firebaseapp.com/KenyanChevdo.jpg&items%5Bid%5D=1&items%5Bprice%5D=10&items%5Bimage_url%5D=&paymentMethodNonce=tokencc_bc_xw8zq6_8jr4sf_4knqpn_thv4kr_d53

I think its having trouble with the items property I am posting in the request body.

Would you be able to share a sample of what the request for checkout api should look like?

ghost commented 6 years ago

I solved this. I was not passing up the items as a json array.