Prev | Current Page 369 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


In Chapter 14, you??™ll implement the Place Order button in the shopping cart, which saves
the order into the database and forwards to a PayPal payment page. To call the PayPal payment
page (bypassing the PayPal shopping cart), you redirect to a link like the following:
CHAPTER 9 ?–  RECEIVING PAYMENTS USING PAYPAL 264
https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=youremail@example.com&
item_name=Order#123&item_number=123&amount=123¤cy_code=USD&
return=www.example.com&cancel_return=www.example.com
Review the PayPal Website Payments Standard Integration Guide for more details about
the service.
?– Tip You will create your own complete order-processing system in the third phase of development (starting
with Chapter 17), where you??™ll process credit card transactions.
When you implement the PayPal Single Item Purchases in Chapter 14, you??™ll use code that
looks like the following code snippet to create the URL of the PayPal Single Item Purchases page:
// Calculate the total amount for the shopping cart
$this->mTotalAmount = ShoppingCart::GetTotalAmount();
// If the Place Order button was clicked ...
if(isset ($_POST['place_order']))
{
// Create the order and get the order ID
$order_id = ShoppingCart::CreateOrder();
// This will contain the PayPal link
$redirect =
PAYPAL_URL . '&item_name=TShirtShop Order ' . urlencode('#') .


Pages:
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381