Advertisement
Guest User

Untitled

a guest
Aug 31st, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. function guidv4($data = null) {
  2. $data = $data ?? random_bytes(16);
  3. assert(strlen($data) == 16);
  4. $data[6] = chr(ord($data[6]) & 0x0f | 0x40);
  5. $data[8] = chr(ord($data[8]) & 0x3f | 0x80);
  6. return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
  7. }
  8.  
  9. $idempotencykey = guidv4();
  10. $bearer_token = "TOKEN FROM OAUTH FLOW";
  11. $s = curl_init();
  12. $headers = array("accept: application/json",
  13. "authorization: Bearer ".$bearer_token,
  14. "idempotency-key ".$idempotencykey,
  15. "content-type: application/json");
  16.  
  17. $params = array (
  18. 'amount' => "9900",
  19. 'currency' => 'usd',
  20. 'source' => $_POST['cloverToken'],
  21. );
  22.  
  23. curl_setopt($s, CURLOPT_URL, 'https://scl-sandbox.dev.clover.com/v1/charges');
  24. curl_setopt($s, CURLOPT_POST, 1);
  25. curl_setopt($s, CURLOPT_HTTPHEADER, $headers);
  26. curl_setopt($s, CURLOPT_POSTFIELDS, $params);
  27. $response = curl_exec($s);
  28. curl_close($s);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement