Hello there,
I am trying to add more information to this step: paypal.Buttons({ createOrder: function(data, actions)}), such as shipping address, etc ...
In this doc page /docs/checkout/reference/server-integration/set-up-transaction/ is shown how to do it:
createOrder on the server, return results
{"statusCode":201,"result":{"id":"3Y963135SM0142709","intent":"CAPTURE","purchase_units":[{"reference_id":"default","amount":{"currency_code":"EUR","value":"220.00"},"payee":{"email_address":"facilitator(at)fakeemail.com)","merchant_id":"xxxxxxxxxxxxxx"}}],"create_time":"2019-03-05T06:55:36Z","links":[{"links":"the links"}],"status":"CREATED"},"headers":{"":"","Date":"Tue, 05 Mar 2019 06","Server":"Apache","paypal-debug-id":"2416d43ead646","HTTP_X_PP_AZ_LOCATOR":"sandbox.slc","Paypal-Debug-Id":"xxxxxxx","Set-Cookie":"X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00","Vary":"Authorization","Content-Length":"751","Connection":"close","Content-Type":"application/json"}}
add result to client
createOrder: function() { return fetch('/my-server/create-paypal-transaction') .then(function(res) { return res.json(); }).then(function(data) { return data.orderID; }); }
By following the indication in the docs i have always 4 error:
no_orderid_passed_to_createorder
and 3 times Uncaught Error: Expected a promise for a string order id to be passed to createOrder
It seems that createOrder can't find order id, which I presume to be this one "result":{"id":"3Y963135SM0142709"}, as shown also in here /docs/api/orders/v2/#orders-create-response
... View more