Skip to content

Instantly share code, notes, and snippets.

@jeremyikwuje
Created July 26, 2020 09:03
Show Gist options
  • Save jeremyikwuje/dc6b4990c340fc52bfe8ac79405674ad to your computer and use it in GitHub Desktop.
Save jeremyikwuje/dc6b4990c340fc52bfe8ac79405674ad to your computer and use it in GitHub Desktop.
<?php
// create a plan programitically
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paystack.co/plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => [
"name" => "Monthly Retainer",
"interval" => "monthly",
"amount" => 500000
],
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer SECRET_KEY",
"Cache-Control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ( $err ) {
echo "cURL Error #:" . $err;
}
else {
echo $response;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment