Skip to content

Instantly share code, notes, and snippets.

@hackerrahul
Last active July 21, 2018 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hackerrahul/1191d3b811882dc7f0d87a3d00795e51 to your computer and use it in GitHub Desktop.
Save hackerrahul/1191d3b811882dc7f0d87a3d00795e51 to your computer and use it in GitHub Desktop.
<?php
$amount = $_POST['amount']; // this is dynamic
$name = $_POST['name']; // this is dynamic
$number = $_POST['number']; // this is dynamic
$email = $_POST['email']; // this is dynamic
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://'.$mode.'.instamojo.com/api/1.1/payment-requests/');
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array("X-Api-Key:YOUR_API_KEY",
"X-Auth-Token:YOUR_API_SECRET"));
$payload = Array(
'purpose' => 'HackerRahul Product',
'amount' => $amount,
'phone' => $number,
'buyer_name' => $name,
'redirect_url' => $redirect_url,
'send_email' => true,
'webhook' => $webhook_url,
'send_sms' => true,
'email' => $email,
'allow_repeated_payments' => false
);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment