Socket
Book a DemoInstallSign in
Socket

@neoxr/midtrans

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neoxr/midtrans

Simple Midtrans API Wrapper

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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])
  • amount : nominal tagihan dengan tipe data integer.

  • channel : channel metode pembayaran dengan tipe data string.

  • 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.

  • Qris : qris

  • Virtual Account : bri, mandiri, bni, permata, bca, cimb

  • E-wallet : gopay

FAQs

Package last updated on 14 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts