I am writing code to add a paypal button to a page. There is this js code:
On the page: https://developer.paypal.com/docs/api/orders/v2/ The following is written:
Authorizationstringrequired To make REST API calls, include the bearer token in this header with the Bearer authentication scheme. The value is Bearer or Basic <client_id:secret>.
I seem to have written everything like that, but I get a 401 error that says about problems with authorization. Did I write the string for "Authorization" in headers correctly?
Client-side/browser code (paypal.Buttons) should never directly call PayPal API endpoints; not under any circumstances. The code in this question should be removed.
Calls to the PayPal API should only be done through a backend/server. See the standard checkout integration guide for an example in node.js , but it can of course be implemented similarly in any other server environment/language.