Going Live with Snap


The tutorial below will assist you in changing the configuration from Sandbox to Production. Please choose the following integration method. If further assistance is required, please contact us at support@midtrans.com or visit our support page.



If you have completed integrating in Sandbox (Testing Environment) and ready to go live in Production Environment, there are a few steps that need to be made:

Obtain Snap Token

  • Set Veritrans-PHP library to Production Environment. This can be done by changing the Veritrans_Config::$isProduction value into true.
  • Change your ServerKey from Sandbox to production credential.

    
    <?php
    require_once(dirname(__FILE__) . 'Veritrans.php');
    
    //Set Your server key
    Veritrans_Config::$serverKey = "<Set your Production ServerKey here>";
    
    // Uncomment for production environment
    Veritrans_Config::$isProduction = true;
    
    Veritrans_Config::$isSanitized = true;
    Veritrans_Config::$is3ds = true;
    
    $transaction = array(
        'transaction_details' => array(
            'order_id' => "<your order_id>",
            'gross_amount' => 10000 // no decimal allowed
            )
        );
    
    $snapToken = Veritrans_Snap::getSnapToken($transaction);
    ?>
    
    


Show Snap payment page

  • Set snap.js URL to production endpoint. https://app.midtrans.com/snap/snap.js
  • Change your Client key from Sandbox to production credential.

    
    <html>
      <head>
        <script type="text/javascript"
              src="https://app.midtrans.com/snap/snap.js"
              data-client-key="<Set Your Production Client Key Here>"></script> 
      </head>
      <body>
        <button id="pay-button">Pay!</button>
        <script type="text/javascript">
          var payButton = document.getElementById('pay-button');
          payButton.addEventListener('click', function () {
            snap.pay('<?php echo $snap_Token; ?>'); // store your snap token here
          });
        </script>
      </body>
    </html>
    
    

You are now live with Midtrans and ready to start processing your transactions!

  • Change setting environment in Midtrans plugin from development into production.
  • Change your Client Key and Server Key from Sandbox to production credential. Magento production

You are now live with Midtrans and ready to start processing your transactions!

  • Change setting environment in Midtrans plugin from development into production.
  • Change your Client Key and Server Key from Sandbox to production credential. OpenCart production

You are now live with Midtrans and ready to start processing your transactions!

  • Change setting environment in Midtrans plugin from development into production.
  • Change your Client Key and Server Key from Sandbox to production credential. Prestashop production

You are now live with Midtrans and ready to start processing your transactions!

  • Change setting environment in Midtrans plugin from development into production.
  • Change your Client Key and Server Key from Sandbox to production credential. Woo production

You are now live with Midtrans and ready to start processing your transactions!