Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $POST_DATA = array(
- 'actionType'=>'PAY',
- 'feesPayer'=>'PRIMARYRECEIVER',
- 'currencyCode'=>'GBP',
- 'cancelUrl'=>$this->input->post('cancelUrl'),
- 'receiverEmail'=>$NewArrayEmail,
- 'receiverAmount'=>$NewArrayAmount,
- 'primaryReceiver'=>$NewArrayType,
- 'returnUrl' =>$this->input->post('returnUrl'),
- 'requestEnvelope.errorLanguage' =>'en_US',
- 'requestenvelope'=>'RequestEnvelope',
- );
- $paymentdata = $this->Paypalpaymentmodel->data_curl($POST_DATA);
- class Paypalpaymentmodel extends CI_Model {
- public $api_user = "xxx_xxx_api1.xxx.com";
- public $api_pass = "xxxxxxxxxxxxxx";
- public $api_sig = "xxxxxxxxxxxxxxxxxxxxxxx";
- public $app_id = "APP-xxxxxxxxxxxxx";
- public $apiUrl = 'https://svcs.paypal.com/AdaptivePayments/';
- public $headers;
- public $paykey;
- function __construct()
- {
- parent::__construct();
- $this->load->database();
- $this->headers = array(
- "X-PAYPAL-SECURITY-USERID: ".$this->api_user,
- "X-PAYPAL-SECURITY-PASSWORD: ".$this->api_pass,
- "X-PAYPAL-SECURITY-SIGNATURE: ".$this->api_sig,
- "X-PAYPAL-REQUEST-DATA-FORMAT: JSON",
- "X-PAYPAL-RESPONSE-DATA-FORMAT: JSON",
- "X-PAYPAL-APPLICATION-ID: ".$this->app_id,
- );
- }
- function data_curl($POST_DATA)
- {
- $POST_DATA_STRING = http_build_query($POST_DATA);
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, ADAPTIVE_URL.'adaptive_payment/samples/PayReceipt.php');
- curl_setopt($curl, CURLOPT_TIMEOUT, 30);
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA_STRING);
- $data = curl_exec($curl);
- curl_close ($curl);
- return $data;
- }
- $config = array(
- // Signature Credential
- "acct1.UserName" => "xxx_xxx_api1.xxx.com",
- "acct1.Password" => "xxxxxxxxxxxxxxxx",
- "acct1.Signature" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
- "acct1.AppId" => "APP-xxxxxxxxxxxxx",
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement