Link to home
Start Free TrialLog in
Avatar of Hamdan Shafiq
Hamdan ShafiqFlag for Pakistan

asked on

i need help for RB_OLP_INITIATE_PAYMENT

any one can help me for this php code
soap.php
Avatar of Ganesh Gurudu
Ganesh Gurudu

what your trying to achieve on this?

seem your sub-domain not working.
https://b2b.rb.com/soap?service=RB_OLP_INITIATE_PAYMENT

check the below URL contain similar functionality. this may help.
https://community.box.com/t5/Box-Developer-Forum/File-upload-not-working-with-PHP-curl-method-https-developer-box/m-p/41510#M2881

http://php.net/manual/en/function.curl-setopt.php
Avatar of Scott Fell
What specific errors are you getting?
Avatar of Hamdan Shafiq

ASKER

https://s.1shopstyle.com/soap.php

Open in new window

<?php
$olpIdAlias='rbuat6680';
$merchantID='1039';
$refNum=rand(1, 15).rand();
$amount='200';

$xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://olp.bank.com/sappay/service/olppaymentmanager/req">
   <soapenv:Header/>
   <soapenv:Body>
      <req:initiatePaymentDetailsReq>
         <olpIdAlias>'.$olpIdAlias.'</olpIdAlias>
         <merchantId>'.$merchantID.'</merchantId>
         <merchantRefNum>'.$refNum.'</merchantRefNum>
         <paymentAmount>'.$amount.'</paymentAmount>
         <paymentCurrency>SAR</paymentCurrency>
         <dynamicMerchantLandingURL></dynamicMerchantLandingURL>
         <dynamicMerchantFailureURL></dynamicMerchantFailureURL>
      </req:initiatePaymentDetailsReq>
   </soapenv:Body>
</soapenv:Envelope>';
try{
$url = "https://b2brbtest.riyadbank.com/soap?service=RB_OLP_INITIATE_PAYMENT";
 $certFile =  dirname(__FILE__)."/key.pem";
  $certPass ='rbuat159';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $certPass);
$headers = array();
array_push($headers, "Content-Type: text/xml; charset=utf-8");
array_push($headers, "SOAPAction: sii:RB_OLP_INITIATE_PAYMENT");
array_push($headers, "Host:b2brbtest.riyadbank.com");

if($xml != null) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    array_push($headers, "Content-Length: " . strlen($xml));
}

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
     print_r($response);
}  catch (Exception $e){
echo $e->getMessage();
   }


?>

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.