Considering you're using PHP then you should be using $_GET
not $_POST
to get the values of query arguments.
Currently we return two query arguments with the redirection URL: payment_id
and status
.
Here the status
argument is only for backwards compatibility and you shouldn't rely on its value to mark the payment as successful because anyone can modify its value.
The correct way is to use the payment_id
and query our API to get the payment details.
A sample response may look like:
{
"payment": {
"payment_id": "MOJO3815000J72853518",
"quantity": 1,
"status": "Credit", <---- Payment status
"link_slug": "hello-api-inr-link",
"link_title": "Hello API INR Link",
"buyer_name": "A Gehani",
"buyer_phone": "+9100000000",
"buyer_email": "akash@instamojo.com",
"currency": "INR",
"unit_price": "9.00",
"amount": "9.00",
"fees": "0.45",
"shipping_address": null,
"shipping_city": null,
"shipping_state": null,
"shipping_zip": null,
"shipping_country": null,
"discount_code": null,
"discount_amount_off": null,
"variants": [],
"custom_fields": null,
"affiliate_id": "hiway",
"affiliate_commission": "3.00",
"created_at": "2014-12-16T13:17:27.943Z"
},
"success": true
}
Here if the value of payment
-> status
is "Credit"
then the payment was successful otherwise it was not.
Again if you're using PHP then you may want to use our API wrapper: Get Details of a Payment using Payment ID
Note that the API also returns "success": true
, but don't confuse it for actual payment status.