Consult
PayPal??™s Website Payments Standard Integration Guide for more details. We will discuss how
to overcome this attribute limit later.
Alternatively, you can create Add to Cart URLs without using forms. This is particularly
helpful when your Add to Cart button is already included in a form, since HTML doesn??™t support
nested forms. When using Add to Cart URLs instead of forms, you need to specify the
attribute values as query string parameters. Here??™s an example:
https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=yourmail@example.com&
item_name=Mistletoe+T-Shirt&on0=Size&os0=S&on1=Color&os1=White&amount=17.99&
currency_code=USD&add=1&cancel_return=http://www.example.com&
shopping_url=http://www.example.com/mistletoe-t-shirt-p84/&
return=http://www.example.com
CHAPTER 9 ?– RECEIVING PAYMENTS USING PAYPAL 253
?– Note When using the URL query string to pass information to the server, you need to carefully encode the
parameter values. For example, to pass the "Mistletoe T-Shirt" string as a URL parameter, you need to
encode the space, which is not an allowed URL character. The space can be encoded as either %20 or +. PHP
conveniently provides the urlencode() function, which we can use to encode strings for URL inclusion.
Loading this URL in your web browser will take you to a PayPal shopping cart page like
the one shown in Figure 9-2.
Pages:
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370