本文整理汇总了PHP中Mage_Paypal_Model_Config::getExpressCheckoutStartUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Paypal_Model_Config::getExpressCheckoutStartUrl方法的具体用法?PHP Mage_Paypal_Model_Config::getExpressCheckoutStartUrl怎么用?PHP Mage_Paypal_Model_Config::getExpressCheckoutStartUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Paypal_Model_Config
的用法示例。
在下文中一共展示了Mage_Paypal_Model_Config::getExpressCheckoutStartUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
/**
* Reserve order ID for specified quote and start checkout on PayPal
* @return string
*/
public function start($returnUrl, $cancelUrl)
{
$this->_quote->reserveOrderId()->save();
// prepare API
$this->_getApi();
$this->_api->setAmount($this->_quote->getBaseGrandTotal())->setCurrencyCode($this->_quote->getBaseCurrencyCode())->setInvNum($this->_quote->getReservedOrderId())->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl)->setSolutionType($this->_config->solutionType)->setPaymentAction($this->_config->paymentAction);
// supress or export shipping address
if ($this->_quote->getIsVirtual()) {
$this->_api->setSuppressShipping(true);
} else {
$address = $this->_quote->getShippingAddress();
$isOverriden = 0;
if (true === $address->validate()) {
$isOverriden = 1;
$this->_api->setAddress($address);
}
$this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden);
$this->_quote->getPayment()->save();
}
// add line items
if ($this->_config->lineItemsEnabled) {
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote);
$this->_api->setLineItems($items)->setLineItemTotals($totals);
}
$this->_config->exportExpressCheckoutStyleSettings($this->_api);
// call API and redirect with token
$this->_api->callSetExpressCheckout();
$token = $this->_api->getToken();
$this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token);
return $token;
}
示例2: start
/**
* Reserve order ID for specified quote and start checkout on PayPal
* @return string
*/
public function start($returnUrl, $cancelUrl)
{
$this->_quote->reserveOrderId()->save();
// prepare API
$this->_getApi();
$this->_api->setAmount($this->_quote->getBaseGrandTotal())->setCurrencyCode($this->_quote->getBaseCurrencyCode())->setInvNum($this->_quote->getReservedOrderId())->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl)->setSolutionType($this->_config->solutionType)->setPaymentAction($this->_config->paymentAction);
if ($this->_giropayUrls) {
list($successUrl, $cancelUrl, $pendingUrl) = $this->_giropayUrls;
$this->_api->addData(array('giropay_cancel_url' => $cancelUrl, 'giropay_success_url' => $successUrl, 'giropay_bank_txn_pending_url' => $pendingUrl));
}
// supress or export shipping address
if ($this->_quote->getIsVirtual()) {
$this->_api->setSuppressShipping(true);
} else {
$address = $this->_quote->getShippingAddress();
$isOverriden = 0;
if (true === $address->validate()) {
$isOverriden = 1;
$this->_api->setAddress($address);
}
$this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden);
$this->_quote->getPayment()->save();
}
// add line items
if ($this->_config->lineItemsEnabled && Mage::helper('paypal')->doLineItemsMatchAmount($this->_quote, $this->_quote->getBaseGrandTotal())) {
//For transfering line items order amount must be equal to cart total amount
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote);
$this->_api->setLineItems($items)->setLineItemTotals($totals);
}
$this->_config->exportExpressCheckoutStyleSettings($this->_api);
// call API and redirect with token
$this->_api->callSetExpressCheckout();
$token = $this->_api->getToken();
$this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token);
return $token;
}
示例3: _redirectSameToken
/**
* Redirect customer back to PayPal with the same token
*/
protected function _redirectSameToken()
{
$token = $this->_initToken();
$this->getResponse()->setRedirect($this->_config->getExpressCheckoutStartUrl($token));
}