Home
Softono
midtrans-node

midtrans-node

Open source MIT TypeScript
11
Stars
1
Forks
2
Issues
1
Watchers
3 years
Last Commit

About midtrans-node

midtrans-node is an unofficial Node.js client library designed to streamline integration with the Midtrans payment gateway. Serving as a robust alternative to the official module, it provides a comprehensive suite of asynchronous methods for managing payment operations. The library supports Core API, Iris, Snap, and Transaction services, enabling developers to handle essential tasks such as charging cards, capturing transactions, registering cards, and querying transaction statuses. With Iris functionality, users can manage payouts, validate bank accounts, create beneficiaries, and retrieve balance details. For Snap integrations, the tool facilitates transaction creation, token generation, and redirect URL management. Additional features include custom notification handling, transaction approval or denial, cancellation, expiration checks, and both standard and direct refund processing. Built with Promise support, this client ensures non-blocking operations suitable for modern server-side applications, offerin

Platforms

Web Self-hosted

Languages

TypeScript

πŸ›’ Midtrans-Node

Unofficial Midtrans API wrapper for NodeJS. πŸ’‘ I created this to make it easier for me to integrate some of πŸ›  my projects using πŸ›’ Midtrans, the methods I created here are available from Rest API, Snap, and Iris API 😎.

Quick Start

πŸ€” Installation

You need to install the package first!

npm install hanif-midtrans-node

yarn add hanif-midtrans-node

pnpm install hanif-midtrans-node

Usage 🀟

You just need a midtrans server key from https://dashboard.midtrans.com. And, you're ready to code!

import { MidtransNode } from 'hanif-midtrans-node';

// new MidtransNode(isProduction, midtransServerKey);
const midtrans = new MidtransNode(false, 'YOUR MIDTRANS SERVER KEY'); // sandbox mode

midtrans.createTransaction({
    transaction_details: {
        gross_amount: 20000, // IDR 20.000
        order_id: 'midtrans-node',
    },
}).then(console.log).catch(console.error);

And, that's it! Also, docs is availabe on https://hansputera.github.io/midtrans-node

License

MIT