Advertisement
Guest User

Untitled

a guest
Jul 6th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. $POST_DATA = array(
  2. 'actionType'=>'PAY',
  3. 'feesPayer'=>'PRIMARYRECEIVER',
  4. 'currencyCode'=>'GBP',
  5. 'cancelUrl'=>$this->input->post('cancelUrl'),
  6. 'receiverEmail'=>$NewArrayEmail,
  7. 'receiverAmount'=>$NewArrayAmount,
  8. 'primaryReceiver'=>$NewArrayType,
  9. 'returnUrl' =>$this->input->post('returnUrl'),
  10. 'requestEnvelope.errorLanguage' =>'en_US',
  11. 'requestenvelope'=>'RequestEnvelope',
  12. );
  13. $paymentdata = $this->Paypalpaymentmodel->data_curl($POST_DATA);
  14.  
  15. class Paypalpaymentmodel extends CI_Model {
  16.  
  17. public $api_user = "xxx_xxx_api1.xxx.com";
  18. public $api_pass = "xxxxxxxxxxxxxx";
  19. public $api_sig = "xxxxxxxxxxxxxxxxxxxxxxx";
  20. public $app_id = "APP-xxxxxxxxxxxxx";
  21. public $apiUrl = 'https://svcs.paypal.com/AdaptivePayments/';
  22. public $headers;
  23. public $paykey;
  24.  
  25. function __construct()
  26. {
  27. parent::__construct();
  28. $this->load->database();
  29.  
  30. $this->headers = array(
  31. "X-PAYPAL-SECURITY-USERID: ".$this->api_user,
  32. "X-PAYPAL-SECURITY-PASSWORD: ".$this->api_pass,
  33. "X-PAYPAL-SECURITY-SIGNATURE: ".$this->api_sig,
  34. "X-PAYPAL-REQUEST-DATA-FORMAT: JSON",
  35. "X-PAYPAL-RESPONSE-DATA-FORMAT: JSON",
  36. "X-PAYPAL-APPLICATION-ID: ".$this->app_id,
  37. );
  38. }
  39. function data_curl($POST_DATA)
  40. {
  41. $POST_DATA_STRING = http_build_query($POST_DATA);
  42. $curl = curl_init();
  43.  
  44. curl_setopt($curl, CURLOPT_URL, ADAPTIVE_URL.'adaptive_payment/samples/PayReceipt.php');
  45.  
  46. curl_setopt($curl, CURLOPT_TIMEOUT, 30);
  47. curl_setopt($curl, CURLOPT_POST, 1);
  48. curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false);
  49. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  50. curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA_STRING);
  51. $data = curl_exec($curl);
  52. curl_close ($curl);
  53.  
  54. return $data;
  55. }
  56.  
  57. $config = array(
  58. // Signature Credential
  59. "acct1.UserName" => "xxx_xxx_api1.xxx.com",
  60. "acct1.Password" => "xxxxxxxxxxxxxxxx",
  61. "acct1.Signature" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  62. "acct1.AppId" => "APP-xxxxxxxxxxxxx",
  63. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement