接受的主机表单不显示

时间:2019-05-13 13:33:55

标签: php authorize.net

1)使用重定向方法 2)接受主机 3)从GitHub使用SDK(PHP)

我请求令牌,并且一切似乎都正常。但是当我重定向到“付款页面”时,会收到以下响应

当我重定向到https://test.authorize.net/payment/payment

我得到一个页面,顶部只有“订单摘要”,其余页面为空。

任何帮助都将不胜感激。

吉姆

这是我用来设置表单详细信息等的代码。

function set_hosted_form_options($mbrobj,$x_realy_url,$x_cancel_url)
     {
        $this->seting_incr = 0;
        $setting = array();
        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentButtonOptions");
        $setting[$this->seting_incr]->setSettingValue("{\"text\": \"Submit Payment\"}");

        $this->seting_incr++;

        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentStyleOptions");
        $setting[$this->seting_incr]->setSettingValue("{\"bgColor\": \"red\"}");

        $this->seting_incr++;

        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentOrderOptions");
        $setting[$this->seting_incr]->setSettingValue("{\"show\": true,\"merchantName\":\"Texas Girls Coaches Assoc.\"}");

        $this->seting_incr++;

        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentReturnOptions");
        $x_relay_url = $this->anobj->get_field('x_relay_url');
        $x_relay_url .= "&invid=";
        $x_relay_url .= $this->get_invoice();
        $x_cancel_url = $this->anobj->get_field('x_cancel_url');
        $x_cancel_url .= "&invid=";
        $x_cancel_url .= $this->get_invoice();
        $setting[$this->seting_incr]->setSettingValue("{\"url\": \"".$x_relay_url."\", \"cancelUrl\": \"".$x_cancel_url."\", \"showReceipt\": true}");

        $this->seting_incr++;
        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentPaymentOptions");
        $setting[$this->seting_incr]->setSettingValue("{\"cardCodeRequired\":true,\"showCreditCard\": true,\"showBankAccount\":true}");

        $this->seting_incr++;

        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentSecurityOptions");
        $setting[$this->seting_incr]->setSettingValue("{\"captcha\":true}");

        $this->seting_incr++;

        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentBillingAddressOptions");
        $setting[$this->seting_incr]->setSettingValue("{\"show\":true}");

        $this->seting_incr++;

        $setting[$this->seting_incr] = new AnetAPI\SettingType();
        $setting[$this->seting_incr]->setSettingName("hostedPaymentCustomerOptions");
        $setting[$this->seting_incr]->setSettingValue("{\"showEmail\":true,\"requiredEmail\":true}");
        $this->seting_incr++;

        $this->set_form_options($setting);
        return($setting);

这是create_transaction的代码

function create_transaction($amount)
     {
            $this->transactionRequestType = new AnetAPI\TransactionRequestType();
            $this->transactionRequestType->setTransactionType( "authCaptureTransaction");
            $this->transactionRequestType->setAmount($amount);
            //$transactionRequestType->setOrder($order);
            //$transactionRequestType->setPayment($paymentOne);
            $lineItems = $this->get_line_items();
            $this->transactionRequestType->setLineItems($lineItems);
        return($this->transactionRequestType);
     }

以下是发票中add_line_items的代码:

function add_line_item($item_id,$name,$desc,$qty,$unit_price,$taxable=0)
     {
        if($this->DEBUG)
        {
            $this->logEvent("INFO: ITEM ID [".$item_id."]");
            $this->logEvent("INFO: NAMe    [".$name."]");
            $this->logEvent("INFO: DESC    [".$desc."]");
            $this->logEvent("INFO: QTY     [".$qty."]");
            $this->logEvent("INFO: UNIT PR [".$unit_price."]");
            $this->logEvent("INFO: TAXABLE [".$taxable."]");
        }
            $lineItem1 = new AnetAPI\LineItemType();
            $lineItem1->setItemId($item_id);
            $lineItem1->setName($name);
            $lineItem1->setDescription($desc);
            $lineItem1->setQuantity($qty);
            $lineItem1->setUnitPrice($unit_price);
            $lineItem1->setTaxable(0); // 1 Yes 0 for no
            $this->lineItems_ary[$this->liinc++] = $lineItem1;
      }

1 个答案:

答案 0 :(得分:0)

对于任何通过Google查找到此错误的人,在我的情况下,错误是由于在let { MyProp: { // Strip these fields out a, b, c, ...rest }, ...slices } = getState(); slices.rest = rest; let data = JSON.stringify(slices); let filename = `${slices.config.userName.replace('@', '_')}_${moment().format('YYYY-MM-DD HH-mm-ss')}`; let dataBase64 = Buffer.from(data).toString('base64'); 中使用包含与号的urlcancelUrl参数值引起的。由于某种原因,这在请求表单令牌时有效,但在实际使用给定令牌加载表单时无效。

有关潜在问题here的更多信息。