After generating nonce from squareup payment form to make a payment, we make a call using that token with the help of square client from node.
` const client = new Client({ environment: Environment.Sandbox, // Use Environment.Production for the production environment accessToken: accessToken, });
if (client instanceof Client) {
const response = await client.paymentsApi.createPayment({
sourceId: token,
idempotencyKey: Math.random().toString(36).substring(7),
amountMoney: {
amount: 100,
currency: 'USD'
}
;
`
This is how i'm doing it
[ERROR] Error processing payment: adapter is not a function
This is the error i get after running this function. What can be the reason and how can it be fixed?
The error was because cloudflare workers didnt support API calls like this. So used the fetch method instead of it.