Skip to content

Instantly share code, notes, and snippets.

@sriharibalgam
sriharibalgam / initOrder.php
Created May 17, 2016 11:09 — forked from antsmartian/initOrder.php
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);
var juspayResponse = JSON.parse(res); // assuming that `res` holds the data return by JusPay API
var url = juspayResponse.payment.authentication.url
var method = juspayResponse.payment.authentication.method
var frm = document.createElement("form")
frm.style.display = "none"; // ensure that the form is hidden from the user
frm.setAttribute("method", method);
frm.setAttribute("action", url);
if(method === "POST") {