Download the PHP package netopia/payment without Composer

On this page you can find all versions of the php package netopia/payment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package payment

<div align="center" background-color: rgba(0,0,0,.5)>Parsedown

NETOPIA Payments

NETOPIA Payments Composer

Installation

Run the following command from root of your project

Example

An example of Payment Request in Laravel

...

use Netopia\Payment\Address;
use Netopia\Payment\Invoice;
use Netopia\Payment\Split;
use Netopia\Payment\Request\Card;

...

class ExampleController extends Controller
{
    /**
     * all payment requests will be sent to the NETOPIA Payments server
     * SANDBOX : http://sandboxsecure.mobilpay.ro
     * LIVE : https://secure.mobilpay.ro
     */
    public $paymentUrl;
    /**
     * NETOPIA Payments is working only with Certificate. Each NETOPIA partner (merchant) has a certificate.
     * From your Admin panel you can download the Certificate.
     * is located in Admin -> Conturi de comerciant -> Detalii -> Setari securitate
     * the var $x509FilePath is path of your certificate in your platform
     * i.e: /home/certificates/public.cer
     */
    public $x509FilePath;
    /**
     * Billing Address
     */
    public $billingAddress;
    /**
     * Shipping Address
     */
    public $shippingAddress;

    ...

    public function index()
    {
        $this->paymentUrl   = 'http://sandboxsecure.mobilpay.ro';
        $this->x509FilePath = '/home/certificates/sandbox.XXXX-XXXX-XXXX-XXXX-XXXX.public.cer';
        try {
            $paymentRequest = new Card();
            $paymentRequest->signature  = 'XXXX-XXXX-XXXX-XXXX-XXXX';//signature - generated by mobilpay.ro for every merchant account
            $paymentRequest->orderId    = md5(uniqid(rand())); // order_id should be unique for a merchant account
            $paymentRequest->confirmUrl = 'https://example.test/card/success'; // is where mobilPay redirects the client once the payment process is finished and is MANDATORY
            $paymentRequest->returnUrl  = 'https://example.test/ipn';// is where mobilPay will send the payment result and is MANDATORY

            /*
             * Invoices info
             */
            $paymentRequest->invoice = new Invoice();
            $paymentRequest->invoice->currency  = 'RON';
            $paymentRequest->invoice->amount    = '20.00';
            $paymentRequest->invoice->tokenId   = null;
            $paymentRequest->invoice->details   = "Payment Via Composer library";

            /*
             * Billing Info
             */
            $this->billingAddress = new Address();
            $this->billingAddress->type         = "person"; //should be "person" / "company"
            $this->billingAddress->firstName    = "Billing name";
            $this->billingAddress->lastName     = "Billing LastName";
            $this->billingAddress->address      = "Bulevardul Ion Creangă, Nr 00";
            $this->billingAddress->email        = "[email protected]";
            $this->billingAddress->mobilePhone  = "0732123456";
            $paymentRequest->invoice->setBillingAddress($this->billingAddress);

            /*
             * Shipping
             */
            $this->shippingAddress = new Address();
            $this->shippingAddress->type        = "person"; //should be "person" / "company"
            $this->shippingAddress->firstName   = "Shipping Name";
            $this->shippingAddress->lastName    = "Shipping LastName";
            $this->shippingAddress->address     = "Bulevardul Mihai Eminescu, Nr 00";
            $this->shippingAddress->email       = "[email protected]";
            $this->shippingAddress->mobilePhone = "0721234567";
            $paymentRequest->invoice->setShippingAddress($this->shippingAddress);

            /**
            * params 
            * The params is optional
            */
            $paymentRequest->params = [
                'framework_name'=>"Laravel",
                'framework_version'=>"9"
            ];

            /**
            * Split payment
            * this option is ONLY for merchants, who already have split payment settings.
            * 'id' Is the SELLERA_CCOUNT_ID
            * 'amount' is the splited amount 
            */
            $paymentRequest->split = new Split();
            $paymentRequest->split->destinations = [
                [
                'id'=>'123456',
                'amount'=>"2.75"
                ]
            ];

            /*
             * encrypting
             */
            $paymentRequest->encrypt($this->x509FilePath);

            /**
             * send the following data to NETOPIA Payments server
             * Method : POST
             * Parameters : env_key, data, cipher, iv
             * URL : $paymentUrl
             */
            $env_key = $paymentRequest->getEnvKey();
            $data   = $paymentRequest->getEncData();
            $cipher = $paymentRequest->getCipher();
            $iv     = $paymentRequest->getIv();
        }catch (\Exception $e)
        {
            return "Oops, There is a problem!";
        }
    }
    ...
}    

An example of IPN in Laravel

...

use Netopia\Payment\Address;
use Netopia\Payment\Invoice;
use Netopia\Payment\Request\Card;
use Netopia\Payment\Request\Notify;
use Netopia\Payment\Request\PaymentAbstract;

...

class IpnsController extends Controller 
{

    ...

    public $errorCode;
    public $errorType;
    public $errorMessage;
    public $paymentUrl;
    public $x509FilePath;
    public $cipher;
    public $iv;

    ...

    public function index()
    {
    ...

        $this->errorType = PaymentAbstract::CONFIRM_ERROR_TYPE_NONE;
        $this->errorCode = 0;
        $this->errorMessage = '';
        $this->cipher     = 'rc4';
        $this->iv         = null;

        ....

        if(array_key_exists('cipher', $_POST))
        {
            $this->cipher = $_POST['cipher'];
            if(array_key_exists('iv', $_POST))
            {
                $this->iv = $_POST['iv'];
            }
        }

        $this->paymentUrl = 'http://sandboxsecure.mobilpay.ro';
        $this->x509FilePath = '/home/certificates/sandbox.XXXX-XXXX-XXXX-XXXX-XXXXprivate.key';

        if (strcasecmp($_SERVER['REQUEST_METHOD'], 'post') == 0){
            if(isset($_POST['env_key']) && isset($_POST['data'])){
                try {
                    $paymentRequestIpn = PaymentAbstract::factoryFromEncrypted($_POST['env_key'], $_POST['data'], $this->x509FilePath, null, $this->cipher, $this->iv);
                    $rrn = $paymentRequestIpn->objPmNotify->rrn;
                    if ($paymentRequestIpn->objPmNotify->errorCode == 0) {
                        switch($paymentRequestIpn->objPmNotify->action){
                            case 'confirmed':
                                //update DB, SET status = "confirmed/captured"
                                $this->errorMessage = $paymentRequestIpn->objPmNotify->errorMessage;
                                break;
                            case 'confirmed_pending':
                                //update DB, SET status = "pending"
                                $this->errorMessage = $paymentRequestIpn->objPmNotify->errorMessage;
                                break;
                            case 'paid_pending':
                                //update DB, SET status = "pending"
                                $this->errorMessage = $paymentRequestIpn->objPmNotify->errorMessage;
                                break;
                            case 'paid':
                                //update DB, SET status = "open/preauthorized"
                                $this->errorMessage = $paymentRequestIpn->objPmNotify->errorMessage;
                                break;
                            case 'canceled':
                                //update DB, SET status = "canceled"
                                $this->errorMessage = $paymentRequestIpn->objPmNotify->errorMessage;
                                break;
                            case 'credit':
                                //update DB, SET status = "refunded"
                                $this->errorMessage = $paymentRequestIpn->objPmNotify->errorMessage;
                                break;
                            default:
                                $errorType = PaymentAbstract::CONFIRM_ERROR_TYPE_PERMANENT;
                                $this->errorCode = PaymentAbstract::ERROR_CONFIRM_INVALID_ACTION;
                                $this->errorMessage = 'mobilpay_refference_action paramaters is invalid';
                        }
                    }else{
                        //update DB, SET status = "rejected"
                        $this->errorMessage = $paymentRequestIpn->objPmNotify->errorMessage;
                    }
                }catch (\Exception $e) {
                    $this->errorType = PaymentAbstract::CONFIRM_ERROR_TYPE_TEMPORARY;
                    $this->errorCode = $e->getCode();
                    $this->errorMessage = $e->getMessage();
                }

            }else{
                $this->errorType = PaymentAbstract::CONFIRM_ERROR_TYPE_PERMANENT;
                $this->errorCode = PaymentAbstract::ERROR_CONFIRM_INVALID_POST_PARAMETERS;
                $this->errorMessag = 'mobilpay.ro posted invalid parameters';
            }

        } else {
            $this->errorType = PaymentAbstract::CONFIRM_ERROR_TYPE_PERMANENT;
            $this->errorCode = PaymentAbstract::ERROR_CONFIRM_INVALID_POST_METHOD;
            $this->errorMessage = 'invalid request metod for payment confirmation';
        }

        /**
         * Communicate with NETOPIA Payments server
         */

        header('Content-type: application/xml');
        echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
        if($this->errorCode == 0)
        {
            echo "<crc>{$this->errorMessage}</crc>";
        }
        else
        {
            echo "<crc error_type=\"{$this->errorType}\" error_code=\"{$this->errorCode}\">{$this->errorMessage}</crc>";
        }

    }
}

Note / Suggestions

All versions of payment with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
ext-dom Version *
ext-simplexml Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package netopia/payment contains the following files

Loading the files please wait ....