Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new Promise((resolve, reject) => {
braintree.client.create(
{
authorization: paymentClientToken,
},
(_err, client) => {
client.request(
{
data: { creditCard },
endpoint: "payment_methods/credit_cards",
method: "post",
},
(error: any, response: any) => {
if (error) {
if (error.details.originalError.fieldErrors.length > 0) {
error.details.originalError.fieldErrors.map((error: any) => {
if (error.field === "creditCard") {
reject(error.fieldErrors);