@neoxr/midtrans

1.0.0 • Public • Published

Simple Midtrans API Wrapper

Unofficial Midtrans API Wrapper yang hanya tersedia untuk 3 metode pembayaran : QRIS, Virtual Account & E-Wallet.

Instalasi

const { Midtrans } = require('@neoxr/midtrans')
const mdt = new Midtrans({
   production: false,
   server_key: 'xx-xx-xxxxxxx',
   prefix: 'NXR',
   callback_url: 'https://example.com/payment-status',
   expiration: 30 // minutes
})

Membuat Pembayaran

Untuk membuat pembayaran dengan API Midtrans cukup dengan memasukan 2 parameter wajib dan 1 parameter opsional :

mdt.createPayment([amount], [channel], [customer_details])
  1. amount : nominal tagihan dengan tipe data integer.

  2. channel : channel metode pembayaran dengan tipe data string.

  3. customer_details (opsional) : menambahkan informasi customer dengan tipe data object.

Contoh :

mdt.createPayment(50000, 'qris').then(console.log)

Live Response : Here

Cek Status Pembayaran

mdt.checkPayment([id])

Contoh :

mdt.checkPayment('77847cda-43db-497c-b482-389863e527a6').then(console.log)

Live Response : Here

Daftar Channel

Pastikan akun sudah terverifikasi dan channel metode pembayaran berstatus aktif.

  1. Qris : qris

  2. Virtual Account : bri, mandiri, bni, permata, bca, cimb

  3. E-wallet : gopay

Readme

Keywords

none

Package Sidebar

Install

npm i @neoxr/midtrans

Weekly Downloads

16

Version

1.0.0

License

MIT

Unpacked Size

24.2 kB

Total Files

3

Last publish

Collaborators

  • neoxr