Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.7 kB
1
Indexable
Never
<?php

$postData = 'merNo='.$_POST['merNo'].'&transType='.$_POST['transType'].'&amount='.$_POST['amount'].'&currency='.$_POST['currency'].'&tradeNo='.$_POST['tradeNo'].'&billAddrCountry='.$_POST['billAddrCountry'].'&billAddrState='.$_POST['billAddrState'].'&billAddrCity='.$_POST['billAddrCity'].'&billAddress1='.$_POST['billAddress1'].'&billAddress2='.$_POST['billAddress2'].'&billAddress3='.$_POST['billAddress3'].'&billAddrPostCode='.$_POST['billAddrPostCode'].'&payIP='.$_POST['payIP'].'&shipAddrCountry='.$_POST['shipAddrCountry'].'&shipAddrState='.$_POST['shipAddrState'].'&shipAddrCity='.$_POST['shipAddrCity'].'&shipAddress1='.$_POST['shipAddress1'].'&shipAddress2='.$_POST['shipAddress2'].'&shipAddress3='.$_POST['shipAddress3'].'&shipAddrPostCode='.$_POST['shipAddrPostCode'].'&description='.$_POST['description'].'&pan='.$_POST['pan'].'&callback='.$_POST['callback'].'&successUrl='.$_POST['successUrl'].'&failUrl='.$_POST['failUrl'].'&key='.$_POST['key']; 


  $key = hash('sha256', $postData);
 
$data = [
    'merNo'=>$_POST['merNo'],
    'transType' => $_POST['transType'],
    'amount' => $_POST['amount'],
    'currency' => $_POST['currency'],
    'tradeNo' => $_POST['tradeNo'],
    'billAddrCountry' => $_POST['billAddrCountry'],
    'billAddrState' => $_POST['billAddrState'],
    'billAddrCity' => $_POST['billAddrCity'],
    'billAddress1' => $_POST['billAddress1'],
    'billAddress2' => $_POST['billAddress2'],
    'billAddress3' => $_POST['billAddress3'],
    'billAddrPostCode' => $_POST['billAddrPostCode'],
    'payIP' => $_POST['payIP'],
    'shipAddrCountry' => $_POST['shipAddrCountry'],
    'shipAddrState' => $_POST['shipAddrState'],
    'shipAddrCity' => $_POST['shipAddrCity'],
    'shipAddress1' => $_POST['shipAddress1'],
    'shipAddress2' => $_POST['shipAddress2'],
    'shipAddress3' => $_POST['shipAddress3'],
    'shipAddrPostCode' => $_POST['shipAddrPostCode'],
    'description' => $_POST['description'],
    'pan' => $_POST['pan'],
    'callback' => $_POST['callback'],
    'successUrl' => $_POST['successUrl'],
    'failUrl' => $_POST['failUrl'],
    'digest' => $key,
    'key' => $_POST['key']
    ];


$url = 'https://cmsapi-sit.pipay.com/gateway/checkout.do';




$ch = curl_init( $url );
# Setup request to send json via POST.
$payload = json_encode( $data );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
# Send request.
$result = curl_exec($ch);
curl_close($ch);
# Print response.
echo "<pre>$result</pre>";