Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function guidv4($data = null) {
- $data = $data ?? random_bytes(16);
- assert(strlen($data) == 16);
- $data[6] = chr(ord($data[6]) & 0x0f | 0x40);
- $data[8] = chr(ord($data[8]) & 0x3f | 0x80);
- return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
- }
- $idempotencykey = guidv4();
- $bearer_token = "TOKEN FROM OAUTH FLOW";
- $s = curl_init();
- $headers = array("accept: application/json",
- "authorization: Bearer ".$bearer_token,
- "idempotency-key ".$idempotencykey,
- "content-type: application/json");
- $params = array (
- 'amount' => "9900",
- 'currency' => 'usd',
- 'source' => $_POST['cloverToken'],
- );
- curl_setopt($s, CURLOPT_URL, 'https://scl-sandbox.dev.clover.com/v1/charges');
- curl_setopt($s, CURLOPT_POST, 1);
- curl_setopt($s, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($s, CURLOPT_POSTFIELDS, $params);
- $response = curl_exec($s);
- curl_close($s);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement