question

jimmyfio avatar image
0 Likes"
jimmyfio asked ·

Is sandbox working for initiateGuestCheckoutSession or initiateCheckoutSession?

I tried to get an Auth'nAuth token for intitiateCheckoutSession, and it would not authorize the buy.order scope. Is this not available? I then got a OAuth token with a the guest order scope and made a intitiateGuestCheckoutSession post according to the docs and it gave me this error: "errorId":2004,"domain":"ACCESS","category":"REQUEST","message":"Invalid request","longMessage":"The request has errors. For help, see the documentation for this API.","parameters":[{"name":"reason","value":"Can not deserialize instance of com.ebay.marketplace.global.cos.type.checkout.CreateGuestCheckoutSessionRequest out of START_ARRAY token"}
checkout sandbox errorcheckout sandbox
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
jimmyfio avatar image
0 Likes"
jimmyfio answered ·
Here is the my code for the Post with the OAuth token scoped for guest check out: let payload = { "contactEmail": " james@fake.com", "contactFirstName": "James", "contactLastName": "Nelson", "shippingAddress": { "recipient": "James", "phoneNumber": "+14081231234", "addressLine1": "111 Some Address", "city": "San Jose", "stateOrProvince": "CA", "postalCode": "95134", "country": "US" }, "lineItemInputs": [ { "itemId": this.state.itemId, "quantity": 1, } ] } function initiateSession(token) { return new Promise((resolve, reject) => { const url = 'https://apix.sandbox.ebay.com/buy/order/v1/guest_checkout_session/initiate' const XHR = new XMLHttpRequest(); let data; console.log(payload); XHR.onreadystatechange = function () { if (XHR.readyState == 4) { if (XHR.status == 200) { console.log("Success!"); console.log(XHR.responseText); data = JSON.parse(XHR.responseText); resolve(data); } else { console.log("There was a problem!"); console.log(XHR.responseText); } } } XHR.open("POST", url); XHR.setRequestHeader("X-EBAY-C-MARKETPLACE-ID", "EBAY_US"); XHR.setRequestHeader("Content-Type", "application/json"); XHR.setRequestHeader("Authorization", "Bearer " + token); XHR.send(payload); }); } initiateSession(this.state.token) .then(res => this.setState({ session: res, }) )
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.