How do i check Instamojo payment confirmation?

3k views Asked by At

After successful payment, Webhook url is called which contains information such as payment id and other details. If two or more persons simultaneously did payment. And each one using different payment links. Whether the post information returning will get to the corresponding person? Or whether there is a chance to misplace the post information to any other person?

How can i confirm that the return payment info get to the same person who made payment? Is there any way to attach some value to the payment link from the seller site to identify the person who made payment??

3

There are 3 answers

0
Ashwini Chaudhary On

POST request sent to Webhook URL will contain the data entered by the user during the payment including their name, email, phone.

If you're using same Webhook URL for different payment links then also you can identify which Payment link was used to make this payment. The POST request contains fields like offer_slug and offer_title which can be used to identify the Payment link used.

If that is not enough then you can define custom fields for your links and pass some custom data with them. Check Instamojo's integration documentation for more details.

0
Shivasurya On

Respected,
Few Days back i was working with integration of instamojo in my web app, Webhook will provide you title,payment_id,buyer_email,buyer_name,buyer_phone,status,offer_slug,amount,mac and few more params. With the above provided you can determine which user chosen link to pay.

Solution : Before simply redirecting to the link for payment, Just assemble request specified in Documentation adding Email,name and phone as params and make it read only so that it can't be changed while proceeding to payment. Adding hmac-sha1 verify will also tighten the integrity check.

I would suggest you to go through the documentation twice for more understanding and clarification.

0
Rahul Tathod On

You have to pass X-Api-Key and 'X-Auth-Tokenand after transaction you will get 2 valuespayment_request_idandpayment_id` pass this 2 you will get transaction details:

$requestid = Input::get('payment_request_id');
        $paymentid = Input::get('payment_id');
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/payment-requests/'.$requestid.'/'.$paymentid.'/');
        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:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "X-Auth-Token:bbbbbbbbbbbbbbbbbbbbbbbbbbb"));
        $payload = Array(
            'purpose' => 'FIFA 16',
            'amount' => '2500',
            'phone' => '9999999999',
            'buyer_name' => 'John Doe',
            'redirect_url' => 'http://www.example.com/redirect/',
            'send_email' => true,
            'webhook' => 'http://www.example.com/webhook/',
            'send_sms' => true,
            'email' => '[email protected]',
            'allow_repeated_payments' => false
        );
        $response = curl_exec($ch);
        curl_close($ch);
        $transactiondata = json_decode($response , true);