Web Development

Neteller payment integration Php , Curl

Php

15.Dec.2020

Neteller Payment Gateway Integration Using PHP and cURL

Neteller is a widely used e-money transfer service that allows users to make secure online payments. Integrating Neteller payments into your PHP web application can provide your users with a convenient and reliable payment method. In this guide, we'll walk through the process of integrating Neteller payments using PHP and cURL.Before we begin, make sure you have the following:

  1. A Neteller Business Account: You will need a Neteller business account to obtain API credentials.
  2. PHP installed on your server.
  3. cURL extension enabled in PHP.

If you want to implement Neteller payment using Core / Simple Php below is code for you can get it. I have used below code for only testing purpose so i can check weather Neteller working OR not. Please never used below code on production if you want to use below code in production you have to modify it accordingly like.

Neteller payment gateway integration using PHP and cURL is a powerful solution for websites that need secure and fast online payments. Neteller is a trusted digital wallet used worldwide, making it ideal for international businesses, developers, and online service platforms.

You can create function for CURL request , passing merchant info in hidden field is not good way you can take that in your PHP SCRIPT.


Why Choose Neteller for Online Payments

Neteller offers high security, fast transactions, and global availability. It helps businesses accept payments from international customers without complex banking processes. This makes Neteller a reliable choice for growing online platforms.


Why Use PHP and cURL for Neteller Integration

PHP is one of the most popular backend programming languages, and cURL allows secure communication with Neteller APIs. Using PHP and cURL together ensures smooth data transfer, better control over requests, and strong server-side security.

Requirements for Neteller API Integration

Before starting the Neteller payment gateway integration, you need a Neteller merchant account, valid API credentials, a server with PHP enabled, cURL support, and an SSL certificate to ensure encrypted communication.

To set up a Business Test Account, you need to provide the below information to merchantsupport@paysafe.com and they will ll set it up for you

To: merchantsupport@paysafe.com
Subject: Request for Business Test Account Setup

Dear Merchant Support Team,

I would like to request the setup of a Business Test Account. Please find the required details below:

Merchant Descriptor Name: Your Descriptor Name

Contact Person: Your Full Name

Phone Number: Your Phone Number

Country: Your Country

Contact Email: yourbusinessemail@gmail.com

Currency Accounts: USD

Kindly let me know if any additional information or documentation is required from my side.

Thank you for your support.

Best regards,
Your Full Name

You can find Member Test Accounts in the Integration Manual on page 153. You can go to https://merchant.neteller.com/merchflux/public/index and grab your merchant info and replace in hidden field.

You have to request there customer support for enabling API client key and secret key for testing purpose. During my code testing i found invalid client issue response from API so for issue i have to add IP address there. Another issue i have faced minimum amount , Amount should be passed as $_POST['amount']*100.

Your All Php , Html Code file or you can say your view file will goes like below.

									     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
   <head>
      <title>NETELLER</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   </head>
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">
   <html>
      <head>
         <title>NETELLER</title>
         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      </head>
      <body>
         <form method="post" action="">
            <br>
            Version: <input type="text" name="version" value="4.1"><br>
            Amount : <input type="text" name="amount" value="1"><br>
            Currency: <input type="text" name="currency" value="USD"><br>
            net_account: <input type="text" name="net_account" value="12 digit number"><br>
            secure_id: <input type="text" name="secure_id" value="326415"><br>
            <div>
               <hr>
            </div>
            MI: <input type="hidden" name="merchant_id" value="08762"><br>
            MK: <input type="hidden" name="merch_key" value="client_id:client_key"><br>
            MTID: <input type="hidden" name="merch_transid" value="<?php echo time(); ?>"><br>
            MN: <input type="hidden" name="merch_name" value="Company Ltd"><br>
            MA: <input type="hidden" name="merch_account" value="Comany Ltd"><br>
            <input type="submit" name="button" value="Make transfer">
         </form>
      </body>
   </html>
  <?php
if (isset($_POST['button']))
{
    $fields = array(
        'version' => $_POST['version'],
        'amount' => urlencode($_POST['amount']) ,
        'currency' => $_POST['currency'],
        'net_account' => urlencode($_POST['net_account']) ,
        'secure_id' => urlencode($_POST['secure_id']) ,
        'merchant_id' => urlencode($_POST['merchant_id']) ,
        'merch_key' => urlencode($_POST['merch_key']) ,
        'merch_transid' => urlencode($_POST['merch_transid']) ,
        'button' => 'Make Transfer'
    );

    $merchantkey = $_POST['merch_key'];
    $amount_value = $_POST['amount'] * 100;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_URL, "https://api.neteller.com/v1/oauth2/token?grant_type=client_credentials");
    curl_setopt($ch, CURLOPT_USERPWD, $merchantkey);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        "Content-Type:application/json",
        "Cache-Control:no-cache"
    ));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $serverOutput = curl_exec($ch);
    $serverOutput = json_decode($serverOutput);
    if (isset($serverOutput->error) && $serverOutput->error != '')
    {
        header("Location:your_page.php?status=" . $serverOutput
            ->error->message . "&payment_type=neteller");
        exit;
    }
    if (isset($serverOutput->accessToken) && $serverOutput->accessToken != "")
    {
        $access_token = $serverOutput->accessToken;
        $requestParams = array(
            "paymentMethod" => array(
                "type" => "neteller",
                "value" => $_SESSION["email"],
            ) ,
            "transaction" => array(
                "merchantRefId" => (string)time() ,
                "amount" => $amount_value,
                "currency" => "USD"
            ) ,
            "verificationCode" => $_POST['secure_id']
        );
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_URL, "https://api.neteller.com/v1/transferIn");
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            "Content-Type:application/json",
            "Authorization: Bearer $access_token"
        ));
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($requestParams));
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        $serverOutput = curl_exec($curl);
        $serverOutput = json_decode($serverOutput);
        if (isset($serverOutput
            ->error
            ->code) && $serverOutput
            ->error->message != '')
        {
            header("Location:payment.php?status=" . urlencode($serverOutput
                ->error
                ->message) . "
      &payment_type=neteller");
            exit;
        }
        curl_close($ch);
        //Success full return array;
        echo "<pre>";
        print_r($serverOutput);
    }
}
?>										
									

Conclusion

Integrating Neteller payments into your PHP application using cURL is a straightforward process. By following the steps outlined in this guide, you can provide your users with a seamless payment experience.

Further Resources