Example #1
0
<?php

if ($this->input->post("value") != null) {
    $MerchantID = '0164205';
    $Password = '******';
    $Price = $this->input->post("value");
    //Price By Toman
    $ReturnPath = base_url("index.php/pages/view/verify");
    $ResNumber = 1234;
    // Order Id In Your System
    $Description = 'جزئیات سفارش';
    $Paymenter = $id = get_cookie("name");
    $Email = $id = get_cookie("username");
    $Mobile = '09112403211';
    $client = new SoapClient('http://merchant.parspal.com/WebService.asmx?wsdl');
    $res = $client->RequestPayment(array("MerchantID" => $MerchantID, "Password" => $Password, "Price" => $Price, "ReturnPath" => $ReturnPath, "ResNumber" => $ResNumber, "Description" => $Description, "Paymenter" => $Paymenter, "Email" => $Email, "Mobile" => $Mobile));
    $PayPath = $res->RequestPaymentResult->PaymentPath;
    $Status = $res->RequestPaymentResult->ResultStatus;
    if ($Status == 'Succeed') {
        echo "<html><head><title>Connecting ....</title><head><body onload=\"javascript:window.location='{$PayPath}'\" style=\"font-family:tahoma; text-align:center;font-waight:bold;direction:rtl\">درحال اتصال به درگاه پرداخت پارس پال ...</body></html>";
    } else {
        echo $Status;
    }
} else {
    header("location:" . base_url("index.php/pages/view/credit"));
}
Example #2
0
<?php

Route::post('payment', function (Illuminate\Http\Request $req) {
    $client = new \SoapClient("http://sandbox.parspal.com/WebService.asmx?wsdl");
    $MerchantID = '100001';
    $password = '******';
    $result = $client->RequestPayment(['MerchantID' => $MerchantID, 'Password' => $password, 'Price' => 10000, 'Description' => '', 'Paymenter' => $req->get('name'), 'Email' => $req->get('email'), 'Mobile' => '', 'ResNumber' => '1234', 'ReturnPath' => \URL::to('verfiy')]);
    $payPath = $result->RequestPaymentResult->PaymentPath;
    $status = $result->RequestPaymentResult->ResultStatus;
    if ($status == 'Succeed') {
        return "<!DOCTYPE html><html><body onload=\"javascript:document.location='{$payPath}'\">Connecting...</body></html>";
    } else {
        return 'failed';
    }
});
Route::post('verfiy', function (Illuminate\Http\Request $req) {
    if ($req->get('status') == 100) {
        $client = new \SoapClient("http://sandbox.parspal.com/WebService.asmx?wsdl");
        $MerchantID = '100001';
        $password = '******';
        $result = $client->verifyPayment(['MerchantID' => $MerchantID, 'Password' => $password, 'Price' => 10000, 'RefNum' => $req->get('refnumber')]);
        $status = $result->verifyPaymentResult->ResultStatus;
        if ($status == 'success') {
            return "<button onclick=\"CSharp.showMeSmth()\" >Click Here to show you something, cool?</button>";
        } else {
            return 'unsuccess';
        }
    } else {
        return 'failed';
    }
});