Instamojo - 如何控制重定向页面消息

标签 instamojo

我试图使用此脚本获取有关付款状态(成功、失败、取消)的消息。

$status = $_POST['status'];

if $status == "success" (
?> CONGRATS! <? AND SO ON

但是我没有成功。 这是我第一次使用 instamojo,所以我恳请你们帮助我。

感谢和问候
巴姆布

最佳答案

考虑到您使用的是 PHP,那么您应该使用 $_GET 而不是 $_POST 来获取查询参数的值。


目前,我们返回两个带有重定向 URL 的查询参数: payment_id status

此处的 status 参数仅用于向后兼容,您不应依赖其值来将付款标记为成功,因为任何人都可以修改其值。

正确的方法是使用 payment_id并查询我们的API以获取 payment details.

示例响应可能如下所示:

{
    "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": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="75141e14061d351c1b060114181a1f1a5b161a18" rel="noreferrer noopener nofollow">[email protected]</a>",
        "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
}

这里如果 payment -> status 的值为“Credit”则支付成功,否则不成功。

如果您使用 PHP,那么您可能需要使用我们的 API 包装器:Get Details of a Payment using Payment ID


请注意,API 还会返回 "success": true,但不要将其与实际付款状态混淆。

关于Instamojo - 如何控制重定向页面消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34677803/

相关文章:

php - 美元付款未在 WooCommerce Wordpress 网站中转换为卢比

ios - 没有从 instamojo API 获得值(value)

ios - 无法解析 json 错误 instamojo

android - 程序类型已经存在 : okhttp3. Authenticator$1

android - 如何将 instamojo 集成到 android 中

php - 如何启用 instamojo 沙箱(测试模式)模式

error-handling - Instamojo付款网关错误