Reputation: 63
Getting this error while using braintree sdk for Nodejs (v14.15.0) on a local machine (Win 10 x64).
Here is the minimal code:
private constructor(merchantId: string, publicKey: string, privateKey: string, env?: braintree.Environment) {
this._gateway = new braintree.BraintreeGateway({
merchantId,
publicKey,
privateKey,
environment: env
});
}
async CreateCustomer(firstName: string, lastName: string, email: string): Promise<BraintreeCreateCustomerResponse> {
let data = await this._gateway.customer.create({
firstName,
lastName,
email
});
return { Id: data.customer.id };
}
Upvotes: 0
Views: 185
Reputation: 24
As per the Type Definitions for braintree, you'll have to provide a configuration of the environment you are using, so this:
private constructor(merchantId: string, publicKey: string, privateKey: string, env?: braintree.Environment)
becomes this:
private constructor(merchantId: string, publicKey: string, privateKey: string, env?: braintree.Environment.Sandbox)
You can choose any of the following:
Development, Production, Qa, Sandbox
I'm not entirely sure if this will help. But, it's worth a try.
Upvotes: 0