Skip to content

plughacker/malga-node

Repository files navigation

Malga

Malga Node.js SDK

Tests

Simple way to integrate with Malga

Getting Started

Learn how to quickly integrate Malga into your project. For more details on integration, simply click here.

  1. First of all, you'll need to install our SDK into your project:
yarn add malga
# or
npm install malga
# or
pnpm add malga
  1. Make your first charge in a simplified way
import { Malga } from 'malga'

const malga = new Malga({
  apiKey: 'YOUR_API_KEY',
  clientId: 'YOUR_CLIENT_ID',
  options: { sandbox: true },
})

(async function () {
  try {
    const data = await malga.charges.create({
      merchantId: 'YOUR_MERCHANT_ID',
      amount: 100,
      paymentMethod: {
        type: 'credit',
        installments: 1,
        card: {
          holderName: 'João da Silva',
          number: '5453881028277600',
          cvv: '170',
          expirationDate: '10/2030',
        },
      },
    })

    console.log(data)
  } catch (error) {
    console.error(error)
  }
})()

Examples

If you have any doubts about the integration, you can click here to see some examples

Contributing

Feel free to contribute to this project by submitting pull requests, creating documentation, or bringing ideas to make the project even better!