pagarme / pagarme-nodejs-sdk

Other
22 stars 13 forks source link

How to use the api key with the Client object? #19

Open tomast1337 opened 11 months ago

tomast1337 commented 11 months ago

With the old `pagarme-js` library, we could do:

import pagarme from "pagarme";
const client = await pagarme.client.connect({ api_key: PAGARME_API_KEY })

However, the new Client object doesn't seem to have an api_key option to use.

renatoastra commented 11 months ago

Hey man, how its going?

Just pass your secret api key on the username and let the password field empty.

Just like that.

import { Client,  } from "@pagarme/pagarme-nodejs-sdk";

const client = new Client({
    basicAuthUserName: 'my-secret-api-key',
    basicAuthPassword: ''
})