[FX.php List] Anyone done a PHP integration w/ Paypal?

Glyn Devine glyn.devine at quickseries.com
Thu Dec 5 08:40:17 MST 2013


Bob,

I like to use Paypal¹s ³cart upload² for what you¹re describing. Basically
you POST the contents of your cart to PayPal and they respond with a webpage
(which your client can customize visually by logging into his PayPal
account) with everything a person needs to complete payment and be directed
back to your client¹s site afterwards.

Paypal¹s documentation on that is here:
https://cms.paypal.com/mx/cgi-bin/?cmd=_render-content&content_ID=developer/
e_howto_html_cart_upload#id09BLDK0007Q

My code isn¹t very generic so I¹ll just leave you with the basic steps for
setup:

Header:

        $output[] = '<form action="https://www.paypal.com/cgi-bin/webscr"
method="post" name="paypalform">';
        $output[] = '<input type="hidden" name="cmd" value="_cart">';
        $output[] = '<input type="hidden" name="business"
value="PAYPAL_EMAIL at GOES.HERE">';
        $output[] = '<input type="hidden" name="upload" value="1">';
     
For each product in your cart:

$paypalincrement must be a unique integer for each product you put into the
form to POST
$product_name is the product name
$product_price is your unit price
$product_qty is your quantity
$product_id is your product code, a unique string identifiying the product

        $output[] = "<input type=\"hidden\"
name=\"item_name_$paypalincrement\" value=\"$product_name\">";
        $output[] = "<input type=\"hidden\" name=\"amount_$paypalincrement\"
value=\"$product_price\">";
        $output[] = "<input type=\"hidden\"
name=\"quantity_$paypalincrement\" value=\"$product_qty\">";
        $output[] = "<input type=\"hidden\"
name=\"item_number_$paypalincrement\" value=\"$product_id\">";

Footers:

Optionally you can set your own $shippingcharge or you can configure your
paypal account to set this for you automatically

$output[] = "<input type=\"hidden\" name=\"handling_cart\"
value=\"$shippingcharge\">";

Finally, here¹s my submit button and the end of the form:

        $output[] = '<input type="IMAGE" src="/images/paypalcheckout.jpg"
value="PayPal Checkout">';
        $output[] = '</form>';


Hope this is useful!

Glyn



  


On 12/5/13 10:21 AM, "Bob Patin" <bob at patin.com> wrote:

> Glyn,
> 
> I¹m writing a payment app for a web portal; fairly simple, they just need to
> be able to run cards and I would of course return the results and write it
> into FileMaker. 
> 
> I just found a bit of code and am about to try it, but if you have a function
> that works, I¹d love to take a look; I¹ve done lots of integrations over the
> years, just not with Paypal.
> 
> Thanks,
> 
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> FileMaker 9, 10, 11 & 12 Certified Developer
> http://www.longtermsolutions.com
> -
> iChat: bobpatin at me.com
> Twitter: bobpatin
>> FileMaker Consulting
> FileMaker Hosting for all versions of FileMaker
> PHP € Full email services € Free DNS hosting € Colocation € Consulting
> 
> 
> On Dec 5, 2013, at 9:15 AM, Glyn Devine <glyn.devine at quickseries.com> wrote:
> 
>> I've done quite a bit with Paypal over the past few years. What are you
>> writing, precisely? An IPN receiver? A cart? Something else?
>> 
>> Glyn Devine
>> IT Manager
>> QuickSeries Publishing Inc.
> 
> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20131205/48d66043/attachment-0001.html


More information about the FX.php_List mailing list