Created
October 9, 2017 17:19
-
-
Save anonymous/7b0276ccd6c726e64c506c71cb7f9ca3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$product_name = $_POST["product_name"]; | |
$price = $_POST["product_price"]; | |
$name = $_POST["name"]; | |
$phone = $_POST["phone"]; | |
$email = $_POST["email"]; | |
include 'src/instamojo.php'; | |
$api = new Instamojo\Instamojo('YOU_PRIVATE_API_KEY', 'YOUR_PRIVATE_AUTH_TOKEN','https://test.instamojo.com/api/1.1/'); | |
try { | |
$response = $api->paymentRequestCreate(array( | |
"purpose" => $product_name, | |
"amount" => $price, | |
"buyer_name" => $name, | |
"phone" => $phone, | |
"send_email" => true, | |
"send_sms" => true, | |
"email" => $email, | |
'allow_repeated_payments' => false, | |
"redirect_url" => "http://YOUR_WEBSITE.COM/thankyou.php", | |
"webhook" => "http://YOUR_WEBSITE.COM/webhook.php" | |
)); | |
//print_r($response); | |
$pay_ulr = $response['longurl']; | |
//Redirect($response['longurl'],302); //Go to Payment page | |
header("Location: $pay_ulr"); | |
exit(); | |
} | |
catch (Exception $e) { | |
print('Error: ' . $e->getMessage()); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment