首页 > 解决方案 > instamojo如何在php中传递自定义字段

问题描述

我正在尝试在我的网站上集成 instamojo 支付网关

    $product_name = "Buy Wine";
    $price = $sub_total;
    $name = $_POST['f_name'].' '.$_POST['l_name'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];

    include 'src/instamojo.php';

    $api = new Instamojo\Instamojo('api_key', 'auth_token','https://test.instamojo.com/api/1.1/');


    try {
        $response = $api->paymentRequestCreate(array(
            "purpose" => $product_name,
            "amount" => $price,
            "buyer_name" => $name,
            "phone" => $phone,
            "send_email" => true,
            "send_sms" => true,
            "email" => $email,
            'allow_repeated_payments' => false,
            "redirect_url" => "http://trezeefoods.com/thankyou.php",
            "webhook" => "http://trezeefoods.com/webhook.php"
            ));
        //print_r($response);

        $pay_ulr = $response['longurl'];

        //Redirect($response['longurl'],302); //Go to Payment page

        header("Location: $pay_ulr");
        exit();

    }
    catch (Exception $e) {
        print('Error: ' . $e->getMessage());
    }     

在这里,我尝试在成功页面上传递产品 id 作为响应

"order_id" => 1234,

但我无法在成功页面上收到这个

标签: phpmysqlinstamojo

解决方案


推荐阅读