POPULATING A PAYPAL FORM WITH CMSB - Aug 3rd, 2010


You can set up text fields in a single record section editor to handle any of the PayPal variables in much the same way
that you set up any text field. So in a PayPal form you could set up the following. (CMSB PHP variables replacing the
hard coded variables)



<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?PHP echo $paypalRecord['business'] ?>">
<input type="hidden" name="item_name" value="<?PHP echo $paypalRecord['name'] ?>"/>
<input type="hidden" name="amount" value="<?PHP echo $paypalRecord['price'] ?>"/>
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="logo_custom" value="http://mysite/<?PHP echo $paypalRecord['pplogo'] ?> ">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="shopping_url” value=”<?PHP echo $paypalRecord['return_page_URL'] ?>“>
<input type="hidden" name="rm" value="2">
<input type="hidden" name="return" value="<?PHP echo $paypalRecord['thankyou_page_URL'] ?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input name="submit" type="image" src="MyclientButton" alt="PayPal - The safer, easier way to pay online!"
align="absmiddle" border="0">
<img alt="" border="0" src="https://www.paypal.com/es_XC/i/scr/pixel.gif" width="1" height="1">
</form>



Or, if you’re using the link format:



<a class="special" href="https://www.paypal.com/cgi-bin/webscr?amount=<?PHP echo $paypalRecord['price']
?>&item_name=<?PHP echo $paypalRecord['name'] ?>&business=<?PHP echo $paypalRecord['business']
?>&cpp_header_image=http://mysite/<?PHP echo $paypalRecord['pplogo'] ?>
&currency_code=USD&lc=US&add=1&cmd=_cart&no_shipping=0&no_note=1&shopping_url=<?PHP echo
$paypalRecord['return_page_URL'] ?>&rm=2&return=<?PHP echo $paypalRecord['thankyou_page_URL'] ?>&bn
value=PP-ShopCartBF&">CLICK TO ORDER</a>



IF you want to shoppers to return to the same page that they came from to continue shopping you can replace



<?PHP echo $paypalRecord['return_page_URL'] ?>



with



<?PHP echo thisPageUrl() ?>



CONTINUE SHOPPING BUTTON
If you want your customers to only buy one item at a time you can disable the “continue shopping” button by
removing the line from cart button that sets "add" to "1", and change your "cmd" value to "_xclick" instead of "_cart".

AUTOMATIC FORWARDING (RETURN) FUNCTION
Caveats regarding the automatic forwarding (return) option:

If you are using the return option to send your customers to a thank you page that increments a counter of performs some
other function, there are a few issues to be considered.

If the buyer pays with their PayPal account, the return option automatically takes the buyer to the URL in the
“return” option.

If the buyer pays with the Credit Card Option, they are first taken to the receipt page where PayPal gives them the
chance to print out a receipt. This is a legal requirement.

After that, the buyer must click on the "Return to Merchant" link in order to return to the site. Even if you use a
notify_url call to load a page in the background, that call will not be executed until the buyer clicks on the return to
merchant link.

You can replace the default message in the “Return to Merchant” button on the credit card receipt page with a
custom message of up to 65 characters. You might use it to tell credit card buyers that their transaction will not be
complete until they click on the return to merchant link. Just use the cbt function:



<input type="hidden" name="cbt" value="<?PHP echo $paypalRecord['your_message_field'] ?>">



or



&cbt=<?PHP echo $paypalRecord['your_message_field'] ?>



From my understanding the only way to get a query string working is to add the variable rm=2.

Rm sets the FORM METHOD used to send data to the URL specified by the return variable after payment completion.
Allowable rm values:

0 – all shopping cart transactions use the GET method
1 – the payer’s browser is redirected to the return URL by the GET method, and no transaction variables are
sent
2 – the payer’s browser is redirected to the return URL by the POST method, and all transaction variables are
also posted

The default is 0.

Note: The rm variable takes effect only if the return variable is also set.



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service