首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Instamojo支付重定向

Instamojo支付重定向
EN

Stack Overflow用户
提问于 2016-08-19 23:11:12
回答 3查看 1.8K关注 0票数 0

我正在用php创建一个网站。我需要与Intsamojo支付网关的简单集成。我使用的php库是https://github.com/Instamojo/instamojo-php/,我可以像这样生成一个付款请求。

代码语言:javascript
复制
     try {
     $response = $api->paymentRequestCreate(array(
        "purpose" => "FIFA 16",
        "amount" => "3499",
        "send_email" => true,
        "email" => "foo@example.com",
        "redirect_url" => "http://www.example.com/handle_redirect.php"
        ));
      print_r($response);
}
    catch (Exception $e) {
    print('Error: ' . $e->getMessage());
}

对于所请求的付款,$response变量具有唯一的付款响应。

代码语言:javascript
复制
Array
(
    [id] => a78ab73df2bb4e78bc06a32a264ae59a
    [phone] => +919898989898
    [email] => ba@gmail.com
    [buyer_name] => mool
    [amount] => 105.75
    [purpose] => Jeans Mens #100
    [status] => Pending
    [send_sms] => 
    [send_email] => 1
    [sms_status] => 
    [email_status] => Pending
    [shorturl] => 
    [longurl] => https://test.instamojo.com/@instamojousername/a78ab73df2bb4e78bc06a32a264ae59a
    [redirect_url] => http://demo.test.com/instamojo/thankyou.php
    [webhook] => http://demo.test.com/instamojo/webhook.php
    [created_at] => 2016-08-19T14:44:10.679557Z
    [modified_at] => 2016-08-19T14:44:10.679582Z
    [allow_repeated_payments] => 
)

现在,在这一步后,我想将用户重定向到此链接生成的付款。

代码语言:javascript
复制
https://test.instamojo.com/@instamojousername/a78ab73df2bb4e78bc06a32a264ae59a

在第一次paymentRequestCreate调用之后,这是如何可能的。简单的报头重定向就可以了吗?哪种方法是安全的?

EN

回答 3

Stack Overflow用户

发布于 2017-02-28 21:00:00

在"redirect_url“中提供您想要在付款后重定向的链接。例如"https://www.google.co.in/“,就像这样。

票数 0
EN

Stack Overflow用户

发布于 2018-01-01 17:26:27

试试这段代码,它应该会对你有帮助

代码语言:javascript
复制
 try {
 $response = $api->paymentRequestCreate(array(
    "purpose" => "FIFA 16",
    "amount" => "3499",
    "send_email" => true,
    "email" => "foo@example.com",
    "redirect_url" => "http://www.example.com/handle_redirect.php"
    ));
    header('location:'.response['longurl']);
}
catch (Exception $e) {
print('Error: ' . $e->getMessage());
}
票数 0
EN

Stack Overflow用户

发布于 2017-12-30 18:20:28

代码语言:javascript
复制
            $response = $api->paymentRequestCreate(array(
                "purpose" => "Add Branch",
                "amount" => "2250",
                "send_email" => false,
                "email" => "",
                "redirect_url" => base_url()."coordinator/new_branch_response"
                ));

            header('Location: https://www.instamojo.com/your_unique_number/'.$response['id']);
票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39042442

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档