wzul

CollectionSplitPayment.php

Mar 5th, 2018
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2.  
  3. $api_key = '4e49de80-1670-4606-84f8-2f1d33a38670';
  4.  
  5. $data  = array(
  6.     'title' => 'Test',
  7.     'split_header' => '',
  8.     'split_payments' => array(
  9.         array(
  10.             'email' => '[email protected]',
  11.             'fixed_cut' => '100',
  12.             'variable_cut' => '',
  13.             'stack_order' => '0'
  14.         ),
  15.         array(
  16.             'email' => '[email protected]',
  17.             'fixed_cut' => '100',
  18.             'variable_cut' => '',
  19.             'stack_order' => '1'
  20.         )
  21.     )
  22. );
  23.  
  24. $parameter = http_build_query($data);
  25. $parameter = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $parameter);
  26.  
  27. $process = curl_init();
  28. curl_setopt($process, CURLOPT_HEADER, 0);
  29. curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
  30. curl_setopt($process, CURLOPT_TIMEOUT, 10);
  31. curl_setopt($process, CURLOPT_USERPWD, $api_key . ':');
  32. curl_setopt($process, CURLOPT_URL, 'https://billplz-staging.herokuapp.com/api/v4/collections');
  33. curl_setopt($process, CURLOPT_POSTFIELDS, $parameter);
  34. $body = curl_exec($process);
  35.  
  36. echo '<pre>'.print_r(json_decode($body, true), true).'</pre>';
Advertisement
Add Comment
Please, Sign In to add comment