Skip to content

Instantly share code, notes, and snippets.

@antsmartian
Created March 21, 2013 13:08
Show Gist options
  • Save antsmartian/5212889 to your computer and use it in GitHub Desktop.
Save antsmartian/5212889 to your computer and use it in GitHub Desktop.
Juspay Init Order Example Call Php.
<?php
#Example integration with iFrame based solution
#Step 1
#Initiate the order with initorder api call
$ch = curl_init('https://api.juspay.in/init_order');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
#You should use your API key here. This API is a test Key wont work in production.
curl_setopt($ch, CURLOPT_USERPWD, '7AF0A0ECEE5940FAA6345F0BAC67315D:');
curl_setopt($ch, CURLOPT_POST, 1);
#Set the customer_id, customer_email , amount and order_id as per details.
#NOTE: The amount and order_id are the fields associated with the "current" order.
$customer_id = 'guest_user_101';
$customer_email = 'customer@mail.com';
$amount = '10.00';
$order_id = rand();
#Return Url
$return_url = "http://localhost/payment_status.php";
curl_setopt($ch, CURLOPT_POSTFIELDS, array('customer_id' => $customer_id , 'customer_email' => $customer_email ,
'amount' => $amount , 'order_id' => $order_id , 'return_url' => $return_url ));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch,CURLOPT_TIMEOUT, 15);
$response = curl_exec($ch);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment