Headers & Authentication
Authorization
Content Type
Example of an authenticated create basket request
const url = "https://headless.tebex.io/api/accounts/{token}/baskets";
const headers = new Headers();
headers.append('Authorization', 'Basic ' + btoa(username + ':' + password));
headers.append('Content-Type', 'application/json');
const body = {
"complete_url": "https://example.tebex.io/thank-you",
"cancel_url": "https://tebex.io/",
"custom": {
"foo": "bar"
},
"complete_auto_redirect": true,
"username": "TebexDev"
};
const options = {
method: 'POST',
headers: headers,
body: JSON.stringify(body)
};
const response = await fetch(url, options);Last updated