I followed this guide. https://clover.github.io/hosted-checkout-codelab/walkthrough/adding-the-checkout-component/
Made sure everything is right but I'm getting the following response every time
"reason" : "Unauthorized" ,
"code" : 401
},
"message" : "Unauthorized"
}
I am using the correct API tokens according to the docs.
Here is the code I'm trying to get working
async startCheckoutSession() { let authKey = 'Bearer ' + 'replace with Private Token'; let mId = 'replace with Merchant Id'; try { const checkoutSession = await fetch('https://sandbox.dev.clover.com/invoicingcheckoutservice/v1/checkouts', { method: 'POST', headers: { Authorization: authKey, 'X-Clover-Merchant-ID': mId }, body: JSON.stringify({ "customer": { "email": "email@example.com", "firstName": "Example", "lastName": "Customer", "phoneNumber": "223-555-0002" }, "shoppingCart": { "lineItems": [ { "name": "Apple", "unitQty": 1, "price": 100 }, { "name": "Orange", "unitQty": 2, "price": 75 } ] }, }) }); const res = await checkoutSession.json(); if (!checkoutSession.ok) { throw res; } window.location = res.href; } catch (e: any) { console.error(e); } }
Please help if you have an idea.
Do I need my developer account verified in order to make requests?