1

我们已将 ExpressCheckout 集成到我们的网站中。现在我们有一个问题,在登录贝宝后的一个页面上说(翻译):请查看此信息。在下一页您可以发送付款。但是,如果您单击下一步按钮,则没有下一页。付款是直接发送的。这里出了什么问题?

lg马努

4

4 回答 4

0

我没有看到查询有任何问题,但尝试将 urlencode() 添加为,

$querystring .= "item_number=".urlencode($item_number)."&";

代替

 '&CURRENCYCODE=' . $this->currencyCode .
于 2013-07-12T08:52:12.673 回答
0

可能您无法将真实字段发送到贝宝,以下变量为 ;

$item_name      = $product->model;
$item_number        = $order['id'];
$item_amount        = str_replace(',','.', format_number($calculate['total_price']));

# than account information of paypal

$paypal_inf = $paypal_->row();                      $paypal_email   = $paypal_inf->paypal_key;
$paypal_value   = $paypal_inf->paypal_value;

# Url information
$return_url = base_url().'tr/odeme/adim_5/paypalsuccess';
$cancel_url = base_url().'tr/odeme/adim_5/paypalfailed';
$notify_url = base_url().'tr/odeme/adim_5/paypal';

# Firstly Append paypal account to querystring
$querystring = "?business=".urlencode($paypal_email)."&";

# adding information of following variables at top as you can see
$querystring .= "item_number=".urlencode($item_number)."&";
$querystring .= "item_name=".urlencode($item_name)."&";
$querystring .= "amount=".urlencode($item_amount)."&";

# loop for posted values and append to querystring (as address,phone or more detailed informaation)

foreach($_POST as $key => $value){
$value = urlencode(stripslashes($value));
$querystring .= "$key=$value&";
}

// Append paypal return addresses
$querystring .= "return=".urlencode(stripslashes($return_url))."&";
$querystring .= "cancel_return=".urlencode(stripslashes($cancel_url))."&";
$querystring .= "notify_url=".urlencode($notify_url);

# And

redirect('https://www.paypal.com/cgi-bin/webscr'. $querystring, 'location', 301);

在表单侧添加一些字段,以下行将收到

echo form_hidden('cmd','_xclick');
echo form_hidden('no_note','1');
echo form_hidden('lc','TR');
echo form_hidden('currency_code',$exchange);
echo form_hidden('bn','PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest');

如果您使用自动重定向,这将有所帮助(添加您在贝宝上创建的按钮 ID)

echo form_hidden('cmd','_s-xclick');
echo form_hidden('hosted_button_id',$paypal_button_id); // for ex. FK5RYJS6WRJVL

希望这可以帮助

于 2013-07-08T20:09:47.883 回答
0

好的,问题解决了。Paypal 重定向到商店网站,目的是让用户可以在商店网站上确认付款。不在贝宝上。lg

于 2013-07-16T16:35:32.567 回答
0

抱歉没明白你的意思?!或者问题出在哪里......我的查询看起来像......

// Build URL with all infos
        $nvpstr = '&AMT=' . $amt .
                  '&ITEMAMT=' . $amt .
                  '&CURRENCYCODE=' . $this->currencyCode .
                  '&LOCALECODE=' . $user->land .
                  '&PAYMENTACTION=' . $this->paymentAction .
                  '&RETURNURL=' . $returnUrl .
                  '&CANCELURL=' . $cancelUrl .
                  '&DESC=' . $this->getDesc() .
                  '&SHIPTONAME=' . $user->vorname . ' ' . $user->nachname .
                  '&SHIPTOSTREET=' . $user->strasse .
                  '&SHIPTOCITY=' . $user->ort .
                  '&SHIPTOZIP=' . $user->plz .
                  '&L_NAME0=www.detailpool.com' .
                  '&L_AMT0=' . $amt .
                  '&NOSHIPPING=1' .
                  '&USERACTION=commit';
        //echo $nvpstr; die();

        $this->callerService = new CallerService($this->type, $this->test);
        $resArray = $this->callerService->hash_call("SetExpressCheckout", $nvpstr);


            header('Location: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=' . $resArray['TOKEN']);
        }

接着

/**
     * Wird nach der Rückkehr von Paypal aufgerufen
     */
    public function getCheckoutDetails($amt) {
        $this->writeLog("Paypal Status-Update started...", 1);

        $token = JRequest::getVar('token', 0);
        $this->group = JRequest::getInt('group', -1);
        $this->type = JRequest::getInt('type', -1);
        $amt = round($amt, 2);

        // Build URL with all infos
        $nvpstr = '&TOKEN=' . urlencode($token) .
                  '&NOSHIPPING=1' .
                  '&USERACTION=commit';

        $this->callerService = new CallerService($this->type, $this->test);
        $resArray = $this->callerService->hash_call("GetExpressCheckoutDetails", $nvpstr);

        $this->completeSale($resArray['TOKEN'], $resArray['PAYERID'], $amt);
    }

    /**
     * Nach der Abwicklung auf der Paypalseite wird eine weitere Aktion erforderlich,
     * um die Kaufabwicklung zu bestätigen...
     */
    private function completeSale($token, $payerID, $amt) {
        require_once(JPATH_ROOT.'/components/com_detailpool/libraries/Zahlung.php');

        // Build URL with all infos
        $nvpstr = '&TOKEN=' . urlencode($token) .
                  '&PAYERID=' . urlencode($payerID) .
                  '&PAYMENTACTION=' . $this->paymentAction .
                  '&AMT=' . $amt .
                  '&CURRENCYCODE=' . $this->currencyCode .
                  '&DESC=' . $this->getDesc();

        $resArray = $this->callerService->hash_call("DoExpressCheckoutPayment", $nvpstr);

        $this->writeLog('DoExpressCheckoutPayment Amt: ' . $amt . ' Group: ' . $this->group);

        // Prüfen, ob alles geklappt hat
        if ($resArray['PAYMENTSTATUS'] == 'Completed') {
            return $this->paymentSuccess();
        }
        else {
            $this->paymentFail();
        }
    }
于 2013-07-09T08:49:10.937 回答