I tried to use a workaround I saw in this conversation Passing a variable as BigInt to create a new order - #3 by josh-square
BigInt.prototype.toJSON = function() {
return this.toString();
};
...
try {
const response = await squareClient.payments.create({
idempotencyKey: randomUUID(),
sourceId: appointmentId,
name: appointmentId,
amountMoney: {
currency: "CAD",
amount: BigInt(3000),
},
});
console.log('result:::', response)
return response;
} catch (error) {
console.log(error);
}
...
but still got another error as below
statusCode: 400,
body: { errors: [ [Object] ] },
errors: [
{
code: ‘EXPECTED_INTEGER’,
detail: ‘Expected an integer value (line 1, character 140)’,
field: ‘amount_money.amount’,
category: ‘INVALID_REQUEST_ERROR’
}
]
}
My version “square”: “^43.0.1”,
Appreciate if someone can help. Thanks!