Licence
ISC
Version
1.0.0
Deps
1
Size
14 kB
Vulns
0
Weekly
0
EvoPay
Uma biblioteca simples e moderna para integração com pagamentos via Pix.
Instalação
npm install evopay
# ou
yarn add evopay
Autenticação
import { EvoPay } from 'evopay';
const evopay = new EvoPay({ apiKey: "API TOKEN" })
Criar um pagamento Pix
evopay.pix.create({
amount: 10,
callbackUrl: 'https://example.com/callback', // opcional
payerDocument: '11215770910', // opcional
payerEmail: 'test@gmail.com', // opcional
payerName: 'John Doe', // opcional
})
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err)
})
Consultar status do pagamento
evopay.pix.status({
id: "cmrsowj960bu7sk3zj2eiefc3"
})
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err)
})
Criar saque (chave pix)
evopay.withdraw.pixKey({
amount: 10,
pixKey: "chavepix@gmail.com",
pixType: "email" // cpf, cnpj, email, phone, evp
callbackUrl: "https://seusite.com/api/webhook" // opcional
})
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err)
})
Criar saque (qrCode)
evopay.withdraw.qrCode({
qrCode: '00020126360014BR.GOV.BCB.PIX011411215770910520400005303986540410.005802BR5925Nome do Recebedor6009Sao Paulo61080540900062070503***6304B14F',
amount: 10, // valido somente para qrCodes sem valor fixo
callbackUrl: "https://seusite.com/api/webhook" // opcional
})
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err)
})
Transações
evopay.account.transactions({
page: '1', // opcional
limit: '10', // opcional
dateFrom: '2024-01-01T00:00:00.000Z', // opcional
dateTo: '2024-01-01T00:00:00.000Z', // opcional
id: 'exemplo', // opcional
status: 'exemplo', // opcional
type: 'DEPOSIT', // opcional
amount: '100', // opcional
payerDocument: 'exemplo', // opcional
payerName: 'exemplo', // opcional
endToEndId: 'exemplo', // opcional
})
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err)
})
Saldo
evopay.account.balance()
.then((res) => {
console.log(res)
})
.catch((err) => {
console.error(err)
})