How to use the midtrans-client.Snap function in midtrans-client

To help you get started, we’ve selected a few midtrans-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Midtrans / midtrans-nodejs-client / examples / expressApp / app.js View on Github external
app.get('/simple_checkout', function (req, res) {
  // initialize snap client object
  let snap = new midtransClient.Snap({
    isProduction : false,
    serverKey : 'SB-Mid-server-GwUP_WGbJPXsDzsNEBRs8IYA',
    clientKey : 'SB-Mid-client-61XuGAwQ8Bj8LxSS'
  });
  let parameter = {
    "transaction_details": {
      "order_id": "order-id-node-"+Math.round((new Date()).getTime() / 1000),
      "gross_amount": 200000
    }, "credit_card":{
      "secure" : true
    }
  };
  // create snap transaction token
  snap.createTransactionToken(parameter)
    .then((transactionToken)=>{
        // pass transaction token to frontend

midtrans-client

Official Midtrans Payment API Client for Node JS

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Popular midtrans-client functions