【问题标题】:Accepted Host form does not display接受的主机表单不显示
【发布时间】:2019-05-13 13:33:54
【问题描述】:

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;
      }

【问题讨论】:

  • 您需要发布您正在使用的代码,以便我们能够为您提供帮助
  • 我添加了代码 John

标签: php authorize.net


【解决方案1】:

对于通过 Google 找到此问题的任何人,在我的情况下,错误是由在 hostedPaymentReturnOptions 中使用包含 & 符号的 urlcancelUrl 参数值引起的。由于某种原因,这在请求表单令牌时有效,但在使用给定令牌实际加载表单时无效。

有关基本问题here的更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-10
    • 1970-01-01
    • 1970-01-01
    • 2016-02-07
    相关资源
    最近更新 更多