本文整理汇总了PHP中PayPal::run方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPal::run方法的具体用法?PHP PayPal::run怎么用?PHP PayPal::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal
的用法示例。
在下文中一共展示了PayPal::run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Order
if ($token2 == Login::string2hash($token1)) {
// create order
$objOrder = new Order();
if ($objOrder->createOrder()) {
// populate order details
$order = $objOrder->getOrder();
$items = $objOrder->getOrderItems();
if (!empty($order) && !empty($items)) {
$objBasket = new Basket();
$objCatalogue = new Catalogue();
$objPayPal = new PayPal();
foreach ($items as $item) {
$product = $objCatalogue->getProduct($item['product']);
$objPayPal->addProduct($item['product'], $product['name'], $item['price'], $item['qty']);
}
$objPayPal->_tax_cart = $objBasket->_vat;
// populate client's details
$objUser = new User();
$user = $objUser->getUser($order['client']);
if (!empty($user)) {
// get user country record
$objCountry = new Country();
$country = $objCountry->getCountry($user['country']);
// pass client's details to the PayPal instance
$objPayPal->_populate = array('address1' => $user['address_1'], 'address2' => $user['address_2'], 'city' => $user['town'], 'state' => $user['county'], 'zip' => $user['post_code'], 'country' => $country['code'], 'email' => $user['email'], 'first_name' => $user['first_name'], 'last_name' => $user['last_name']);
// redirect client to PayPal
echo $objPayPal->run($order['id']);
}
}
}
}