PHP Payment Library for Paypal, Authorize.net and 2Checkout

Feb 21, 2009

If you are like me, whenever you need to work with a 3rd party API or a gateway, you’d first search in Google for a possible wrapper for it in PHP. When it comes to supporting payment gateways, you get bunch of libraries in the search results who are fundamentally different. Some of them are old PHP 3/4 ones, some are new, some may need PEAR, etc.

As they were not required together in one single project, I used them whenever needed. But in one project, I needed them all. I thoughts it’s a chance and decided to stop using them and wrote my own ones where I can use the same methods for all the gateways.

So, here is an abstract PaymentGateway library which is being extended to be used for three popular payment gateways (Paypal, Authorize.net, and 2Checkout) in order to provide you with a similar way of using them. Note that the libraries are for basic usage only and do not contain options for recurring payments. Without much babble, let’s see a few examples of how you can use them.

Download

You can straight-away download the Payment library with all the libraries, examples, and readme.

Paypal

In order to process payments using Paypal, you’ll need to follow these steps:

1. Send the required information to Paypal (snippet 1). Be sure to specify your Paypal email where you want to receive the funds, the success and failure pages, the IPN page, and the product information. The example has the test mode ON, which you will not need in real scenario.

2. Create a payment success page where Paypal will send your customer after payment.

3. Create a payment failure page where Paypal will send your customer after failed payment.

4. Create a IPN page where Paypal will send payment notification in the background. Make sure you use/remove the test mode in conjunction with step 1. (snippet 2)

<?php

// Include the paypal library
include_once ('Paypal.php');

// Create an instance of the paypal library
$myPaypal = new Paypal();

// Specify your paypal email
$myPaypal->addField('business', 'YOUR_PAYPAL_EMAIL');

// Specify the currency
$myPaypal->addField('currency_code', 'USD');

// Specify the url where paypal will send the user on success/failure
$myPaypal->addField('return', 'http://YOUR_HOST/payment/paypal_success.php');
$myPaypal->addField('cancel_return', 'http://YOUR_HOST/payment/paypal_failure.php');

// Specify the url where paypal will send the IPN
$myPaypal->addField('notify_url', 'http://YOUR_HOST/payment/paypal_ipn.php');

// Specify the product information
$myPaypal->addField('item_name', 'T-Shirt');
$myPaypal->addField('amount', '9.99');
$myPaypal->addField('item_number', '001');

// Specify any custom value
$myPaypal->addField('custom', 'muri-khao');

// Enable test mode if needed
$myPaypal->enableTestMode();

// Let's start the train!
$myPaypal->submitPayment();

Snippet 1

<?php

// Include the paypal library
include_once ('Paypal.php');

// Create an instance of the paypal library
$myPaypal = new Paypal();

// Log the IPN results
$myPaypal->ipnLog = TRUE;

// Enable test mode if needed
$myPaypal->enableTestMode();

// Check validity and write down it
if ($myPaypal->validateIpn()) {
    if ($myPaypal->ipnData['payment_status'] == 'Completed') {
         file_put_contents('paypal.txt', 'SUCCESS');
    }
    else {
         file_put_contents('paypal.txt', "FAILURE\n\n" . $myPaypal->ipnData);
    }
}

Snippet 2

Authorize.net

In order to process payments using Authorize.net, you’ll need to follow these steps:

1. Send the required information to Authorize.net(snippet 3). Be sure to specify your Authorize.net login and secret key, the success/failure pages, the IPN page, and the product information. The example has the test mode ON, which you will not need in real scenario.

2. Create a payment success/failure page where Authorize.net will send your customer after payment.

3. Create a IPN page where Authorize.net will send payment notification in the background. Make sure you use/remove the test mode in conjunction with step 1. (snippet 4)

4. In order to set the secret key, log into your authorize.net merchant account. Go to “MD5 Hash” menu and set a secret word to desired values and use that in the “setUserInfo” function showed in the example.

<?php

// Include the paypal library
include_once ('Authorize.php');

// Create an instance of the authorize.net library
$myAuthorize = new Authorize();

// Specify your authorize.net login and secret
$myAuthorize->setUserInfo('YOUR_LOGIN', 'YOUR_SECRET_KEY');

// Specify the url where authorize.net will send the user on success/failure
$myAuthorize->addField('x_Receipt_Link_URL', 'http://YOUR_HOST/payment/authorize_success.php');

// Specify the url where authorize.net will send the IPN
$myAuthorize->addField('x_Relay_URL', 'http://YOUR_HOST/payment/authorize_ipn.php');

// Specify the product information
$myAuthorize->addField('x_Description', 'T-Shirt');
$myAuthorize->addField('x_Amount', '9.99');
$myAuthorize->addField('x_Invoice_num', rand(1, 100));
$myAuthorize->addField('x_Cust_ID', 'muri-khao');

// Enable test mode if needed
$myAuthorize->enableTestMode();

// Let's start the train!
$myAuthorize->submitPayment();

Snippet 3

<?php

// Include the paypal library
include_once ('Authorize.php');

// Create an instance of the authorize.net library
$myAuthorize = new Authorize();

// Log the IPN results
$myAuthorize->ipnLog = TRUE;

// Specify your authorize login and secret
$myAuthorize->setUserInfo('YOUR_LOGIN', 'YOUR_SECRET_KEY');

// Enable test mode if needed
$myAuthorize->enableTestMode();

// Check validity and write down it
if ($myAuthorize->validateIpn()) {
    file_put_contents('authorize.txt', 'SUCCESS');
} else {
    file_put_contents('authorize.txt', "FAILURE\n\n" . $myPaypal->ipnData);
}

Snippet 4

2Checkout

In order to process payments using 2Checkout, you’ll need to follow these steps:

1. Send the required information to 2Checkout(snippet 5). Be sure to specify your 2Checkout vendor id, the return page, and the product information. Please note that 2Checkout does not send IPN in the background, so you will need to handle the payment data in the return page. The example has the test mode ON, which you will not need in real scenario.

2. Create a return page where 2Checkout will send your customer after payment. This is also where you will need to retrieve and use the payment data. Make sure you use/remove the test mode in conjunction with step 1. (snippet 6)

3. In order to set the secret key, log into your 2checkout.com account and go to “Look and Feel” section. At the bottom enter the “Secret Word” and use it in the IPN verification process as shown in the example.

<?php

// Include the paypal library
include_once ('TwoCo.php');

// Create an instance of the authorize.net library
$my2CO = new TwoCo();

// Specify your 2CheckOut vendor id
$my2CO->addField('sid', 'YOUR_VENDOR_ID');

// Specify the order information
$my2CO->addField('cart_order_id', rand(1, 100));
$my2CO->addField('total', '9.99');

// Specify the url where authorize.net will send the IPN
$my2CO->addField('x_Receipt_Link_URL', 'http://YOUR_HOST/payment/twoco_ipn.php');
$my2CO->addField('tco_currency', 'USD');
$my2CO->addField('custom', 'muri-khao');

// Enable test mode if needed
$my2CO->enableTestMode();

// Let's start the train!
$my2CO->submitPayment();

Snippet 5

<?php

// Include the paypal library
include_once ('TwoCo.php');

// Create an instance of the authorize.net library
$my2CO = new TwoCo();

// Log the IPN results
$my2CO->ipnLog = TRUE;

// Specify your authorize login and secret
$my2CO->setSecret('YOUR_SECRET_KEY');

// Enable test mode if needed
$my2CO->enableTestMode();

// Check validity and write down it
if ($my2CO->validateIpn()) {
    file_put_contents('2co.txt', 'SUCCESS');
} else {
    file_put_contents('2co.txt', "FAILURE\n\n" . $my2CO->ipnData);
}

Snippet 6

Hope this will help you integrate the payment gateways in an easy manner. If you have any questions, or find any bug, have a suggestion, feel free to post them as comment here. Btw, this library is released under the MIT license.

Cheers!

There are 195 comments in this article:

  1. 21/02/2009Pete says:

    Thanks man!

  2. 21/02/2009hasin hayder says:

    bookmarked!!

    excellent writing, carry it on

  3. 21/02/2009ranacse05 says:

    thanks , its very much helpful .

  4. 21/02/2009MadMax3000 says:

    Awesome – Awesome – and Awesome

    Thanx

  5. 22/02/2009Nurul Ferdous says:

    Downloaded :) Thanks man!!

  6. 22/02/2009Sean Nieuwoudt says:

    thanks dude.

    any chance of adding google checkout?

  7. 22/02/2009Md Emran Hasan (phpfour) says:

    I'm glad that you people are finding it good :) And yes, two new gateway will be added soon: Internet Secure and Google Checkout.

  8. 22/02/2009Gus says:

    How do you implement this library for a small website with multiple items? What part of the code do we need to include next to the different items?

  9. 22/02/2009Shimon says:

    Right in time when I started looking for it. I'll see if I will be able to add recurring payments for paypal since I need them too.

    Thank you!

  10. 22/02/2009Luke says:

    You should check out Spreedly.com. I've used them, for my subscription service. It's fantastic, and saves me a lot of time and effort.

  11. 22/02/2009HamzaED says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) | Md Emran Hasan (phpfour) – [...]

  12. 22/02/2009MJ says:

    Thank you, this is great!

  13. 22/02/2009Mhd Zaher Ghaibeh says:

    thank you very much for this nice lib , but i was wondering if you have a plan to add moneybookers.com to the library , i will try to but am not sure if am gana be able to do it .
    but if i did , i will share it with you :D

  14. 22/02/2009Md Emran Hasan (phpfour) says:

    Thanks man, if you do develop, post a link here with your MoneyBooker class. It would be much appreciated :)

  15. 22/02/2009Md Emran Hasan (phpfour) says:

    I will be adding the recurring option to the class in two days, so you might wanna wait if there is no emergency on your side :)

  16. 23/02/2009Will says:

    I agree with Hasin. Bookmarked for sure. Thanks man, I was looking for something like this awhile back.

  17. 23/02/2009PHP Payment Library for PayPal, Authorize.net and 2Checkout (2CO) | by Vernon Kesner says:

    [...] PHP Payment Library [...]

  18. 23/02/2009Guhan Iyer says:

    Excellent work! This will useful for my clients who have custom shopping carts built into their websites. Thank you!

  19. 23/02/2009PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO)at Top 3K Mega List - Must Have Popular Website Links for Web Designer, IT Techie & Office Worker says:

    [...] Payment Library for Paypal, Authorize.net and 2Checkout (2CO) http://www.phpfour.com/blog/2009/02/php-payment-gateway-library-for-paypal-authorizenet-and-2checkou... « Xenocode Browser [...]

  20. 23/02/2009Blog DirectoHosting.com » PHP Payment Library para Paypal, Authorize.net y 2Checkout (2CO) says:

    [...] (Paypal, Authorize.net, y 2checkout), a fin de darle una forma similar de la utilización de ellos. Hacer click aquí para ver mñas detalles. [...]

  21. 23/02/2009Librería PHP para Paypal, Authorize.net y 2Checkout | dominios, diseño web, ecommerce - Mantis Technology Solutions Blog says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  22. 25/02/2009JP says:

    I must be missing something here. The payment posts to authnet…the log shows the post from the gateway…but the ipn response from gateway server is blank and i CANNOT get to the receipt page, obviously. I'm almost home, or so I think, but I can't get there on my own…please help.

  23. 25/02/2009JP says:

    Ok, ok…i'm posting 'success' to the results log for an authorize.net payment, but
    IPN Response from gateway Server: is blank.
    I'm lost. Testing gives me a:

    An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.

    This transaction has been approved.
    It is advisable for you to contact the merchant to verify that you will receive the product or service.

    at the secure.authorize.net page.
    The merchant gets a receipt…the buyer gets a receipt…so everything appears to be working except I receive no e-mail informing me of the error, no IPN response from gateway Server, and i cannot get to my receipt page. Please help…Please!!

  24. 25/02/2009Md Emran Hasan (phpfour) says:

    Hi JP,

    I did a search on the net and it seems a few other people have faced similar error. One of them contacted authorize.net and here goes their response:

    “Greetings from Authorize.Net!

    When Authorize.Net is responding back to a script on your server our system waits 10 seconds for a response. If we do not get a response in 10 seconds, our server will time out and display an error page. In this case the customer will see the transaction results on an error page that Authorize.net generates.

    If this happens we will either send an email to you indicating: “An error occurred while trying to report this transaction to the merchant. An email has been sent to the merchant informing them of the error. The following is a result of the attempt to charge your credit card”

    or

    The transaction will be declined within your Merchant Interface. The transaction detail will display (Unable to send notification to Customer).

    If the customer closes the browser window before we receive data from your script to print to the screen we will change the transaction response reason code to 52.

    To prevent these errors the first thing that you will need to look for is the order that your script executes. It is very important that something is printed to the screen before any other process is started. If your script prints to the screen first, we will recognize that you have received the transaction results.

    To resolve this issue:
    - Before doing anything else start writing to your receipt page. For example: print your page headers and the first part of the page body.
    - Check that your script permissions are correct and that it can accept an HTTPS POST.
    - Check that the script is not completing other functions before writing to the screen, such as writing to a database or sending emails.
    - Please check to see if there are different processes that are used in your script for approvals, declines, or errors. Check each process to be sure that they will write to the screen before any other functions.
    - Verify that your script is not using redirects upon receipt of the response from our servers. Redirects strongly are discouraged because they can potentially interfere with the process.”

    I think you might as well get in touch with them. Let me know if it gets resolved.

    Thanks

  25. 25/02/2009Gildus» Blog Archive » Librería PHP para Paypal, Authorize.net y 2Checkout says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  26. 2/03/2009quaffapint says:

    Any updates on adding recurring/subscription payments? Thanks!

  27. 3/03/2009Shimon says:

    Yeah I thought I'll start working with your library last week but didn't happen even to set up anything yet… Got some important updates going on.

    Thank's though I'll monitor your page. I should be subscribed to your RSS too.

  28. 3/03/2009Shimon says:

    I think that my comment was lost so I'll try again – sorry if double.

    In short I didn't get a chance to even look at the library yet although was planning to do so last week. I monitor your page and if you come up with something sooner that'll be cool. If i happen to finish my part first i'll send you my updates to see if that'll be helpful for you.

    Thanks

  29. 7/03/2009Sean Nieuwoudt says:

    When will google checkout be added?

    Regards,
    Sean

  30. 11/03/2009Darrell Greenhouse says:

    Thanks from the U.S.

    Just starting to review your work, but I believe it will save me a load of time.

    Thanks again

  31. 11/03/2009Md Emran Hasan (phpfour) says:

    I've been playing with that for some time now, but not getting enough time on hand to complete yet. If you'd like to give me a hand, you can go ahead :)

  32. 11/03/2009Md Emran Hasan (phpfour) says:

    thanks man. I've been busy with ZCE preparation and didn't find enough time to work. So if you can come up with that, it would be helpful for others as well.

  33. 11/03/2009Jason Brooks says:

    I tried to integrate your PayPal functionality into my checkout system and entered the business account email into the place where you asked for the email. Nonetheless, when I try to submit the payment to PayPal I get the following error: “We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller…” When I created the business acount it forced creation of a username, password and signature; but I noticed your code does not require that. Please help.

  34. 16/03/2009cf says:

    can u add the working demo link as well!

  35. 18/03/2009niaoren says:

    thank you ! man!

    And hope the google checkout will be released!

  36. 18/03/200920 librerías PHP para usar cada día | aNieto2K says:

    [...] PHP Payment Library -Paypal, Authorize.net y 2Checkout (2CO) [...]

  37. 18/03/2009Rich Pedley says:

    I'm another one that would like to see google checkout added but I don't want standard level 1 integration – and can't use level 2. level 2 requires a secure server, level 1 doesn't – but also doesn't integrate with your site – at all. Well it can do – but so far they haven't written instructions for the api that can grab the results of transactions.

  38. 19/03/2009PHP Libraries You Need to Know | JigishThakar.com says:

    [...] PHP Payment Library – PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  39. 19/03/2009Mahmud Ahsan says:

    Really a nice, organized and very essential library.

  40. 21/03/2009bilmeniz gereken 20 harika php kütüphanesi | says:

    [...] PHP Ödeme Kütüphanesi – Paypal, Authorize.net ve 2Checkout (2CO) uyumlu. [...]

  41. 26/03/2009Agam says:

    Nice

  42. 26/03/2009Md Emran Hasan (phpfour) says:

    Thanks!

  43. 31/03/2009Seyfullah KILIÇ » 20 Adet PHP Kütüphanesi says:

    [...] PHP Ödeme Kütüphanesi – Paypal, Authorize.net ve 2Checkout (2CO) uyumlu. [...]

  44. 2/04/2009Karl says:

    Great work and very simplistic too. Its also a good way for beginers to see what is actually going on due to the simple codeflow. I have modified your code and added forms with checkboxes, and stored all common variables to a flat config file and am currently expanding on your initial work to allow balance checking and periodical payment cycles. Also added a paypal recurring billing facillity last night and will look into 2co and authorize for the same, though I am unfamiliar with their process. Paypal recurring is easy by changing the payment type and adding the relevant variables to pass over to paypal.

    Google checkout would be among my wish list as would Nochex. Nochex is great for UK sellers like me, though it hard to work with.

    More on this soon as I may release it when finalized and 100% stable.

  45. 10/04/2009Paul says:

    Great idea and thanks so much for putting it out there.

    Question:

    in the Paypal version you have:
    $myPaypal->addField('custom', 'muri-khao');

    How do we get that custom value back in the IPN?
    Because when someone has paid obiviously I want to update X but I dont see how to get that value back.

  46. 27/04/2009mahfuz05 says:

    excelent work. If you add another Google Checkout its will be great.

  47. 27/04/2009brian says:

    sweet!

  48. 30/04/2009Sam says:

    can we integrate code without going on paypal wesite. It should not redirect to paypal's website

  49. 4/05/2009Austin Mount says:

    Had to change your Paypal.php to enable multiple items…

    <br>parent::__construct();<br><br><br><br>        // Some default values of the class<br><br>       $this-&gt;gatewayUrl = &#39;https://www.paypal.com/cgi-bin/webscr&#39;;<br><br>     $this-&gt;ipnLogFile = &#39;paypal.ipn_results.log&#39;;<br><br><br><br>        // Populate $fields array with a few default<br><br>        $this-&gt;addField(&#39;rm&#39;, &#39;2&#39;);           // Return method = POST<br><br>        $this-&gt;addField(&#39;cmd&#39;, &#39;_cart&#39;);<br>     $this-&gt;addField(&#39;upload&#39;, &#39;1&#39;);<br><br>  }<br>

    then when you add items just append _# to the tags with # being the line item you're working with
    nice base class for paypal with the skeleton in place… was a great starting point for what I'm working on…
    thanks for the great start

  50. 7/05/2009muhit says:

    Downloaded and trying to finding out clues. But Till it sames really awesome.Hope soon we ll have it for clickbank and goodlcheckout as well. :)

  51. 9/05/2009Md Emran Hasan (phpfour) says:

    There is no working demo mate, sorry!

  52. 9/05/2009Md Emran Hasan (phpfour) says:

    The custom value will be available in the IPN post values returned from the paypal server.

  53. 9/05/2009Md Emran Hasan (phpfour) says:

    Thanks

  54. 9/05/2009Md Emran Hasan (phpfour) says:

    Sorry, you have to redirect to Paypal's website for payment – it is mandatory.

  55. 9/05/2009Md Emran Hasan (phpfour) says:

    Hello Austin, good to know the base class helped you. And thanks for sharing the snippet for allowing multiple items :)

  56. 14/05/2009Ambassador says:

    Given an existing Authorize.net account, can a single static web page (i.e., no shopping cart, just one single web page) be made to complete an e-commerce transaction via Authorize.net's “Secure Hosted Payment Form” and the “Snippet 3″ code listed here? Is it really that easy? Is that all there is to it?

  57. 21/05/2009prakashkommerla says:

    its very useful………..

    Thanks

  58. 22/05/2009quantro says:

    thanks man…
    goo job i need this, but for me this script just on the halfway…
    i must modded it to be used with zend framework

  59. 23/05/2009Rex’s Lucky Day » Blog Archive » 20ä¸ªä½ åº”è¯¥çŸ¥é“çš„PHP库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net å’Œ2Checkout (2CO) OpenID PHP-OpenID – 支持OpenID的一个PHP库。OpenIDæ˜¯å¸®åŠ©ä½ ä½¿ç”¨ç›¸åŒçš„ç”¨æˆ·åå’Œå£ä»¤ç™»å½•ä¸åŒçš„ç½‘ç«™çš„ä¸€ç§è§£å†³æ–¹æ¡ˆã€‚å¦‚æžœä½ å¯¹OpenIDä¸ç†Ÿæ‚‰çš„è¯ï¼Œä½ å¯ä»¥åˆ°è¿™é‡Œçœ‹çœ‹ï¼šhttp://openid.net.cn/ 数据为抽象/å¯¹è±¡å…³ç³»æ˜ å°„ORM ADOdb – 数据库抽象 Doctrine – å¯¹è±¡å…³ç³»æ˜ å°„Object relational mapper (ORM) ,需要 PHP 5.2.3+ 版本,一个非常强大的database abstraction layer (DBAL). Propel – å¯¹è±¡å…³ç³»æ˜ å°„æ¡†æž¶- PHP5 Outlet – ä¹Ÿæ˜¯å…³äºŽå¯¹è±¡å…³ç³»æ˜ å°„çš„ä¸€ä¸ªå·¥å…·ã€‚ æ³¨ï¼šå¯¹è±¡å…³ç³»æ˜ å°„ï¼ˆObject Relational Mapping,简称ORM)是一种为了解决面向对象与关系数据库存在的互不匹配的现象的技术。 简单的说,ORMæ˜¯é€šè¿‡ä½¿ç”¨æè¿°å¯¹è±¡å’Œæ•°æ®åº“ä¹‹é—´æ˜ å°„çš„å…ƒæ•°æ®ï¼Œå°†ç¨‹åºä¸­çš„å¯¹è±¡è‡ªåŠ¨æŒä¹…åŒ–åˆ°å…³ç³»æ•°æ®åº“ä¸­ã€‚æœ¬è´¨ä¸Šå°±æ˜¯å°†æ•°æ®ä»Žä¸€ç§å½¢å¼è½¬æ¢åˆ°å¦å¤–ä¸€ç§å½¢ 式。 这也同时暗示者额外的执行开销;然而,如果ORM作为一种中间件实现,则会有很多机会做优化,而这些在手写的持久层并不存在。 æ›´é‡è¦çš„æ˜¯ç”¨äºŽæŽ§åˆ¶è½¬æ¢çš„å…ƒæ•°æ®éœ€è¦æä¾›å’Œç®¡ç†ï¼›ä½†æ˜¯åŒæ ·ï¼Œè¿™äº›èŠ±è´¹è¦æ¯”ç»´æŠ¤æ‰‹å†™çš„æ–¹æ¡ˆè¦å°‘ï¼›è€Œä¸”å°±ç®—æ˜¯éµå®ˆODMG规范的对象数据库依然需要类级别的元 数据。 [...]

  60. 30/05/2009Jack says:

    Thanks, its indeed helpful.

    Could you please shed me some light on how to echo the custom value in the success page?

    // Specify any custom value
    $myPaypal->addField('custom', 'muri-khao');

    I just want to let the customer see the custom value after he returns from PayPal to the success notification page. Thanks again!

  61. 30/05/2009Jack says:

    Hasan,

    Could you please give us more details? Which file needs to be modified so that the $myPaypal->ipnData['custom'] can be shown to the customer. Thank you!

    Best regards,
    Jack

  62. 17/06/2009links for 2009-05-18 | NeXt says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) | Md Emran Hasan (phpfour) (tags: programming tutorial php paypal payment) [...]

  63. 25/06/2009jigish says:

    hey Emran its gr8 work….
    can you please provide me authorize.net developer account credentials..
    if yes then please mail it to me, if you don't want to post it here

    that will be gr8 help
    thanks, and thanks again for this amazing work

  64. 4/07/2009Ofer says:

    Grear post, saved me a lot of writing efforts.
    I took your tool as a infrastructure for my payment system.

  65. 6/07/2009Tomh says:

    Where is INS parser?

  66. 10/07/2009vishal says:

    your code who processing the payment using paypal does not pass multiple items . so send the solution of it as well as possible.

  67. 12/07/2009francesco says:

    Thank you very much for this useful class, i spent a whole afternoon figuring out how to do it, and then you arrived! ;=)

    I am experiencing just one problem, i am testing paypal local with sandbox, text file for ipn isn't created, do you think it is because i am not over internet with my website?

    Thanks!

  68. 13/07/2009ZMax says:

    Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/www/xxxxx/xxxxxx/Authorize.php on line 25

    please help me?

  69. 18/07/2009diseoweb says:

    Thanks for the contribution will prove, it!

  70. 23/07/2009cubanhenry5 says:

    Hello Austin,

    I don't understand how send multiple items with this change … pls can you explain me with a very little code example.

    thanks

  71. 28/07/2009ariful says:

    boss you become famous for this classes, see at http://komunitasweb.com/2009/03/20-great-php-li…

  72. 31/07/2009红楼 » 20个非常有用的PHP类库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  73. 9/08/2009ganz says:

    For PayPal payment success echo “Success”
    if fail —> How can i rollback Mysql update?

  74. 12/08/2009vancuong3682 says:

    Thanks for your library,
    Thank you very much indeed,

  75. 12/08/2009转:20个非常有用的PHP类库 - 晨榕爱老婆 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net å’Œ2Checkout (2CO) [...]

  76. 19/08/2009southfranceproperty says:

    Brilliant! :)

  77. 21/08/2009Md Emran Hasan (phpfour) says:

    Well, yes its that simple. If the developer knows what he's doing, he can do this in one single PHP page.

  78. 21/08/2009Md Emran Hasan (phpfour) says:

    Good to know its helpful. You'll get the passbacks on the IPN handler. Use this:

    echo $myPaypal->ipnData['custom'];

  79. 21/08/2009Md Emran Hasan (phpfour) says:

    Sorry. You can get yourself from their site.

  80. 21/08/2009Md Emran Hasan (phpfour) says:

    You might be running an old PHP version. This needs PHP5. Thanks.

  81. 21/08/2009Md Emran Hasan (phpfour) says:

    Thanks for sharing!

  82. 22/08/2009Md Emran Hasan (phpfour) says:

    Thanks for sharing!

  83. 26/08/2009五彩世界 » 20个非常有用的PHP类库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net å’Œ2Checkout (2CO) OpenID PHP-OpenID – [...]

  84. 30/09/200920ä¸ªä½ åº”è¯¥çŸ¥é“çš„PHP库 at Await-等待! says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  85. 9/10/2009Coleção de Bibliotecas PHP | Marlon Pacheco says:

    [...] PHP Payment Library – Funciona com  Paypal, Authorize.net e 2Checkout (2CO) [...]

  86. 14/10/2009Handpicked Handy PHP Libraries | MinhD.net says:

    [...] PHP-OpenID: for paypal, authorize.net and 2checkout (2CO). Yeah, the 3 most popular ones, who needs the lesser unpopular ones? [...]

  87. 1/11/200920 Great PHP Libraries You Need to Know | King F1 says:

    [...] PHP Payment Library – PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  88. 1/12/2009Kumpulan Pustaka PHP says:

    [...] PHP Payment Library – Pustaka PHP untuk Paypal, Authorize.net dan 2Checkout (2CO) [...]

  89. 22/04/2010Vipin says:

    Md Emran Hasan

    Nice Code.

    Can u tell me plz the way to use the code through mysite or send me the form? I m beginner in this things.

    Waiting for your favorable reply soon.

    Thanks in advance,

    Vipin

  90. 29/04/2010Jessica says:

    Excuse me, does anyone knows how to use the PayPal class for multiple items?

  91. 29/04/2010Emran Hasan says:

    @Jessica: Sorry, this version does not have the multiple product feature. It will be added in the next version. Right now you can have a look at the paypal documentation and use the addField function to setup the form.

  92. 30/04/2010Jessica says:

    Thank you Emran, really appreciate your help.

    I’ll really really appreciate if you could let me know when the new version will be available.

    Thanks Again !!!!

  93. 30/04/2010GillBate says:

    Why I was redirect to paypal sandbox after use your code?

  94. 4/05/201020 Great PHP Libraries You Need to Know | Jason的小窝 says:

    [...] PHP Payment Library – PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  95. 23/05/2010PHP Pay­ment Library for Pay­pal, Authorize.net and 2Checkout (2CO) | Md Emran Hasan « $my->desperate["info"] says:

    [...] PHP Pay­ment Library for Pay­pal, Authorize.net and 2Checkout (2CO) | Md Emran Hasan. [...]

  96. 25/05/2010amit says:

    Thanks its very help full for me ..

  97. 1/06/2010mumo says:

    Thanks for the wonderful piece of work, i really appreciate it… I have one question though, how can i now use the information from the IPN test page… Eg. if the transaction was successful, then i need to capture that info on my website. In short, i can i modify the IPN page to complete the recording of the transaction on my site. I wish to record the amount paid and all other relevant transaction details. Thanks for your help… Am a bit new to this…

  98. 7/06/2010andy says:

    Hai,

    When i am trying to using your script i am not able to redirecting to my site automatically

  99. 8/06/2010Emran Hasan says:

    @andy: Can you be a bit specific, then I’d be able to help you out.

  100. 10/06/201020 Great PHP Libraries You Need to Know - Niknok Seyer says:

    [...] PHP Payment Library – PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  101. 13/06/2010Click for beats says:

    This is awesome, just what I have been looking for! Very good script! Thank you!

  102. 13/06/201020个PHP常用类库 - 0682071班主页 says:

    [...] PHP Payment Library - 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  103. 23/06/2010Alam says:

    Nice Job :D

  104. 5/07/2010Curious says:

    Thanks Emran,

    I’m curious – have you added the recurring option to the class?

    Keep up the great work and make sure you use your class with a donate option! ;-)
    I’m sure people here and future downloaders will donate for you to keep this up-to-date.

    thanks again!

  105. 8/07/2010harmeet says:

    really excellent writing,carry on man n please tell when your new version will be released with multiple item enabled specially in authorize.net,i have done it in PayPal ,i need it urgently,please help
    Thanks in advance

  106. 12/07/2010Steve says:

    I find your scripts useful. However, I’m having a few problems using the paypal script.

    I updated all of the information in the paypal_start.php file to the correct paths and correct paypal email.

    However, when I go to the Paypal.php file and turn test mode to FALSE it still directs me to the Sandbox gateway.

    Is there any additional information I need to change or anything else I need to customized to get this working on my server?

  107. 12/07/2010Dev says:

    Thanks – short and to the point!!!

  108. 14/07/201040+ Must-Bookmark PHP Classes & Libraries For Developing Faster | Site Design Tips says:

    [...] [...]

  109. 15/07/201045+ Best free PHP classes and libraries for Faster Development - kamran Bhutto says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  110. 15/07/201045 + Best free PHP classes and libraries for faster development | Technology Blog says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  111. 23/07/2010IanLindsay says:

    Hi Emran,

    First thank you very much for this class and is really helpful.

    1. When you are going to release version to support Recurring Payment for Paypal ?

    2. You have an example of custom field for Paypal :
    // Specify any custom value
    $myPaypal->addField(‘custom’, ‘muri-khao’);

    Can we get back this custom field in IPN something like below example ?
    if ($myPaypal->ipnData['payment_status'] == ‘Completed’) {
    $custom = $myPaypal->ipnData['custom'];
    }

  112. 23/07/2010Bruno says:

    Thanks so much for a clear and working code, finally something for PHP5.
    will share this around the www :)

  113. 2/08/2010PHP Helps | The Michaeldon Roareth! - Mad rantings of an undiscovered dinosaur says:

    [...] http://www.phpfour.com/blog/2009/02/php-payment-gateway-library-for-paypal-authorizenet-and-2checkou... – If you have to create a cart this is a good method to do it.  Easy paypal payment system. [...]

  114. 6/08/2010Webnova: Diseño web, Desarrollo web, Programación, Web Design Argentina, Web Development Argentina » Archivo del weblog » Librerías populares de PHP y algo mas… says:

    [...] Articulos de PHP interesantes (inglés) [...]

  115. 8/08/2010Abdullah Al Mamun says:

    Very useful and nice post indeed.
    What I’m looking for is PHP class for mooneybookers payment.
    Any help would be cordially appreciated. :-)

  116. 9/08/2010Mohammed Cherkaoui says:

    Fantastic !!!

    i Will Absolety use it !

    thank u

  117. 15/08/2010Simon says:

    Many thanks – this class is great! :)

  118. 24/08/2010Djane says:

    Really helped me on my task today.. Thanks a lot for this post.

  119. 24/08/2010Djane says:

    very useful post.. Thanks!

  120. 25/08/2010Tommy M. says:

    Love this script! Covering the 3 major online payment gateways in one script… brilliant. Are there any other updates going to be made to this script, and if so can you tell when?
    Thanks!

  121. 26/08/2010Justinas Mereskevicius says:

    Hi. Thankyou very much for this library. saved lots of time. and thanks to Austin Mount for pointing out how to add multiple items to the payment.

    Excellent work!

  122. 29/08/2010Djane says:

    BTW, in authorize.net, the test mode in the code does not work when you are not using a developer’s account… i just want to share because i had a hard time with that..=)

  123. 3/09/2010Midge says:

    Hi Emran.

    We have a 501(c)3 organization that has an account set up with PayPal for contributions. It’s the “standard” setup, i.e. click the button and it goes to PayPal.

    The head of our group saw a website that used PayPal, but they person visiting the website could enter an amount right there instead of being redirected.

    Do you know of any snippet like that? What are your thought on it. Would that be secure? If so, where do we get the snippet for that.

    Thanks, Emran. Great job!

  124. 5/09/2010Sharique Maqbool says:

    Quite informative. But i m not successfully able to integrate 2CO using authorize.net parameters on my website. Any possible solution?

  125. 6/09/201020个非常有用的PHP类库 | <?php 齐☆辉?> says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  126. 10/09/2010Emran Hasan says:

    Hello all, thanks for your comments and I’m happy to be able to help you guys.

    I’ve planned to post updates on the payment script is in the following week with better code interface and stability.

    Thanks

  127. 11/09/201020个非常有用的PHP类库 @ 席瑞斌的博客 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  128. 14/09/2010CicciManolesta says:

    Perfect!

  129. 16/09/2010Jon Gunnar says:

    AWESOME.
    Thanks a lot mate.

  130. 22/09/2010Rajinikar says:

    really excellent!!

  131. 22/09/2010Parvez says:

    Hello Emran vai,
    I’ve added a extra security layer on IPN testing, here is my code:
    /**———————————————-
    * Fraud detection system by Parvez Akther
    * first take all ip form paypal and paypal sandbox
    * then compare ip with posting script
    * if match then proceed next
    * if not match generate mail with possible cause
    *————————————————–*/
    // Get the list of IP addresses for http://www.paypal.com and notify.paypal.com
    $paypal_iplist = gethostbynamel(‘www.paypal.com’);
    $paypal_iplist2 = gethostbynamel(‘notify.paypal.com’);
    $paypal_iplist = array_merge( $paypal_iplist, $paypal_iplist2 );

    $paypal_sandbox_hostname = ‘ipn.sandbox.paypal.com’;
    $remote_hostname = gethostbyaddr( $_SERVER['REMOTE_ADDR'] );

    $valid_ip = false;

    if( $paypal_sandbox_hostname == $remote_hostname ) {
    $valid_ip = true;
    $hostname = ‘www.sandbox.paypal.com’;
    }
    else {
    $ips = “”;
    // Loop through all allowed IPs and test if the remote IP connected here
    // is a valid IP address
    foreach( $paypal_iplist as $ip ) {
    $ips .= “$ip,\n”;
    $parts = explode( “.”, $ip );
    $first_three = $parts[0].”.”.$parts[1].”.”.$parts[2];
    if( preg_match(“/^$first_three/”, $_SERVER['REMOTE_ADDR']) ) {
    $valid_ip = true;
    }
    }
    $hostname = ‘www.paypal.com’;
    }
    if(!$valid_ip){
    $this->lastError(“Error code 506. Possible fraud. Error with REMOTE IP ADDRESS = “.$_SERVER['REMOTE_ADDR'].”.
    The remote address of the script posting to this notify script does not match a valid PayPal ip address\n” );
    }

    If it worth to add on ur script you can add it.

    Thanks

  132. 23/09/2010Emran Hasan says:

    @Parvez: Nice addition, I’ll surely add this on the next version…thanks !

  133. 20/10/2010daily domains says:

    Thanks.
    This is the best “PHP Payment script” i had used.

  134. 3/11/2010Sajid Ali says:

    Hy Dear Emran.

    i have am very beginner programmer in php
    my boss assign me payment integration task

    i read you library and understand it little bit.
    i have created test account with 2co and i received verdor id.
    now how to use it and how to integrate it
    please help me if u can
    i will be very thank full to you.
    if u reffer me some link where i can understand payment integration.
    setp by step if posible thanks

  135. 15/11/201020个非常有用的PHP类库 | Wang Jun's Blog says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  136. 17/11/2010Warren says:

    Hi Emran,

    Thanks for the simple code, i tweeted it :)

    Do you have an article on how to configure the VAT info? I really haven’t had too much time to sift through all the stuff and i haven’t taken a guess at it yet, but im betting it’s pretty easy?

    Would it be ‘unethical’ to consider your full order as a single item with paypal? i.e Order 3012419 – $250.00. Instead of posting all cart items individually?

    Thanks again

  137. 15/02/2011Sonal says:

    Hi emran
    thanks,nice script…
    but i have a problem in running this script in test mode
    i have an account on https://test.authorize.net/ and api login and transaction key which i use in your script but i dont know why its giving me error”(87) Transactions of this market type cannot be processed on this system.”;

    Can u plz tell me whats a prbl its urgent and i dont have any idea remain…
    i also try code got from authorize.net professional site giving me same error…
    if u have any idea plz reply me as soon as possible..
    Thanks in advances…

  138. 17/02/2011karuppusamy says:

    What a library!!. I have get the solution for my payment integration in 2checkout by your library. Thank you very much.
    I have bookmarked it

  139. 24/02/2011Kortex says:

    In 2checkout example :

    // Specify the url where authorize.net will send the IPN
    $my2CO->addField(‘x_Receipt_Link_URL’, ‘http://YOUR_HOST/payment/twoco_ipn.php‘);

    authorize.net ?? twoco_ipn.php ?

    see Snippet 5…

  140. 11/03/2011北方小镇 › 20个非常有用的PHP类库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  141. 22/03/2011nameserverspy says:

    This is the best payment class for php.
    Thanks.

  142. 30/03/2011好用的PHP库 - 功夫熊猫的博客 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  143. 4/04/2011PHP编程中常用到的PHP类库 | iXHTML.com says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  144. 5/04/201120个PHP编程中常用到的PHP类库 | 长春PHP培训 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  145. 19/04/2011[Mark]20个非常有用的PHP类库 « 虚伪的灵魂 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  146. 19/04/2011PHP常用类库集锦,快速提高你的web开发效率 | 忘川彼岸 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  147. 19/04/2011dan says:

    download url does not work

  148. 23/04/2011WF says:

    I just tried to download this (which looks awesome by the way) and the link is not there. The word DOWNLOAD is not a link…nor is the ZIP file name… Just wanted to let you know. Also, is there a new version of this or is this the latest? ALl the comments and activity is early 2009. THANKS!

  149. 23/04/2011admin says:

    Fixed the download link, sorry for that.

  150. 6/05/2011Bilmeniz gereken 20 harika php kütüphanesi | Erken Rezervasyon 2011 | Erken Rezervasyon Tatil | Erken Rezervasyon Otel says:

    [...] PHP Ödeme Kütüphanesi – Paypal, Authorize.net ve 2Checkout (2CO) uyumlu. [...]

  151. 9/05/2011Nitin says:

    Hi Friends,

    Thanks Md Emran Hasan for this wonderful script.

    Here is my code for adding multiple items…

    Step1:
    in paypal.php

    replace
    $this->addField(‘cmd’, ‘_xclick’);

    with
    $this->addField(‘cmd’, ‘_cart’);
    $this->addField(‘upload’, ’1′);

    Step2
    in paypal_start.php , You can loop through the add item code in following format

    for(X=1;X=10;X++)
    {
    $myPaypal->addField(‘item_name_X’, ‘T-Shirt’);
    $myPaypal->addField(‘amount_X’, ’9.99′);
    $myPaypal->addField(‘quantity_X’, ’1′);
    $myPaypal->addField(‘item_number_X’, ’001′);
    }

    FYI: Please note _(underscore) its very important for sending data to paypal.

    that’s it you multiple item form is ready.

    I hope it helps someone…

    Cheers
    Nitin

  152. 17/05/2011NB says:

    Hi Md!
    First of all, thanks to share your great work!

    I can see that you send the data to paypal through a simple html form, Don’t you think that is unsecure way to send the data? I could create an html file with false data and send it to paypal, How can I prevent this?

    Could you give me an advice?

    Thanks and sorry for my english (i’m not an native english speaker).

    NB from Argentina.

  153. 26/05/2011reypapz says:

    I’m newbie on authorize.net and getting this error on

    URL: https://test.authorize.net/gateway/transact.dll
    Error: The following errors have occurred.
    (13) The merchant login ID or password is invalid or the account is inactive.

    can anybody help me on this.I checked already my status on authorize and its active.

    regards

  154. 28/05/2011PHP Needs Better Beginners | Malt Blue says:

    [...] other features and libraries; which allow it so simply to interact with the Google Checkout, PayPal, OpenID, consume RSS feeds with MagpieRSS and so much more.But my fear is that it’s [...]

  155. 9/06/201120 你应该知道的PHP库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  156. 10/06/2011【转载】20 你应该知道的PHP库 « 脆皮沙发 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  157. 10/06/2011PHP库收藏 » ForNote says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  158. 17/06/2011As 45 Melhores Bibliotecas php para um desenvolvimento mais rápido ( em inglês ) | Codeworks - Artigos says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO) [...]

  159. 20/06/2011Ananta says:

    I want to know should o make any configure to payal.com before make online payment gateway intregreation

  160. 22/06/2011Michelle says:

    Is it possible to create a standard html page for the Redirect
    PHP Payment Library for Paypal, Authorize.net and 2Checkout?

    I can see that it starts with a echo “\n”; and ends with a echo “\n”;
    So is it possible to create a custom html page and convert it so that it works in your library?

    kind regards
    Michelle

  161. 21/07/2011php常用类(class)汇总 经典收藏 says:

    [...] PHP Payment Library - 支持Paypal, Authorize.net 和2Checkout (2CO) OpenID PHP-OpenID - [...]

  162. 21/07/2011Tareq says:

    Hello Imran vai,
    Is there any update about your library?

  163. 29/07/2011Joe says:

    It would have been helpful if you had provided us with the html form example too. As I need to research which custom values to use in order to submit the information.

  164. 7/08/2011部分PHP常用类库 | 流水博客 says:

    [...] PHP Payment Library - 支持Paypal, Authorize.net 和2Checkout (2CO) OpenID PHP-OpenID - [...]

  165. 7/08/2011PHP: risorse su PayPal | Gabriele Romanato says:

    [...] PHP Payment Library for Paypal, Authorize.net and 2Checkout [...]

  166. 20/08/2011菜博 » 20个非常有用的PHP类库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  167. 24/08/201120个你应该知道的PHP类库 – Yuansir-web菜鸟 | LAMP学习笔记 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  168. 24/08/201120 个非常有用的PHP库 « 捡破烂的程序员 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  169. 25/08/2011Anonymous says:

    [...] [...]

  170. 26/08/2011Necimal says:

    I know this is quite an old script, but just thought I would point out that there is a security issue in the 2checkout library IPN code. You verify it against the vendor_number that was submitted, not the configured. Therefore as far as I can see an attacker could change the submitted vendor number to their own in the original request, and pay themselves (or whoever they like), and your library would be none the wiser, and still mark the order as paid.

  171. 29/08/201120 你应该知道的PHP库 - YaoLei's Blog says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  172. 6/09/201120个PHP常用类库 | 倔强的石头 says:

    [...] PHP Payment Library - 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  173. 6/09/201120个PHP常用类库 | 外贸建站|外贸seo|seo技术 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  174. 8/09/201120个PHP常用类库 | 网络大学 says:

    [...]   PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  175. 10/09/2011WEB编程技术交流网 » 20个PHP常用类库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  176. 12/09/2011limon says:

    Very very nice and useful tutorial. Thank you very much.

  177. 13/09/201120个PHP常用类库 | Magento UI says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  178. 13/09/2011sasy says:

    Hi thank u for your code..how to do hold and capture of transaction in 2checkout, hope for your reply ..

  179. 14/09/2011Praveen says:

    By God. You made my life easy. Thanks a ton.
    Keep Rocking.

  180. 16/09/2011Brendan says:

    I’m always searching on line for tips to help me. Thanks!

  181. 22/09/201120 你应该知道的PHP库 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  182. 27/09/2011suresh says:

    it very very useful and great…thank u so much

  183. 26/10/2011Warpenstein says:

    Hint: The paypal_ipn.php has to be accessible from the internet even if you just want to try out the library with the sandbox, or it won’t work. While paypal_success.php and paypal_failure.php are called by the customer’s browser, the paypal_ipn.php will be called by Paypal directly once the customer paid. Obviously the service cannot reach the script on your machine if you supply an url like http://localhost/...

    Greetings from germany,
    Warpenstein

  184. 17/11/2011Peter says:

    Unfortunately validateIpn() method is no longer working with the current PayPal IPN, so this library is useless for PayPal.

  185. 21/11/2011hassan says:

    man you are rock!!!!!!!!! thxs for save all developers time

  186. 22/11/2011James says:

    Hello!

    Thank you for a great library.
    I am just wondering how I can port this to Codeigniter? Have you already done it?

    Thanks!

  187. 24/11/2011Paulo Coutinho says:

    Hi,

    I need the library with recurring payment for paypal, its urgent :(

    Can someone send me it? email: paulo(at)prsolucoes.com

    Please i need too much.

  188. 25/11/2011monggos says:

    …….

    $myPaypal->addField(‘cmd’, ‘_cart’);
    $myPaypal->addField(‘upload’, ’1′);

    ……

    // 1st product added..
    $myPaypal->addField(‘item_number_1′, ‘XXXX’);
    $myPaypal->addField(‘item_name_1′, ‘Product 1′);
    $myPaypal->addField(‘amount_1′, 10.00);
    $myPaypal->addField(‘quantity_1′, 2);

    // 2nd
    $myPaypal->addField(‘item_number_2′, ‘YYYY’);
    $myPaypal->addField(‘item_name_2′, ‘Product 2′);
    $myPaypal->addField(‘amount_2′, 50.00);
    $myPaypal->addField(‘quantity_1′, 2);

  189. 8/12/2011Ramlal Solanki says:

    Dear sir Your code us very excellent.
    I have a little problem during authorize.

    A415 Error 13: The merchant login ID or password is invalid or the account is inactive.

    I have add correct info in that variable
    $myAuthorize->setUserInfo(”, ”);

  190. 19/12/2011Vishnu says:

    Hello Emran Hasan,
    Nice work man, can u help me how to use paypal payment in normal mode rather than in sandbox. please help me. thank you

  191. 19/12/2011PHP编程中常用到20个的PHP类库 | 博客水木 says:

    [...] PHP Payment Library – 支持Paypal, Authorize.net 和2Checkout (2CO) [...]

  192. 22/12/2011jinita jangid says:

    how i can add multiple product in paypal

  193. 29/12/2011soulreafer says:

    I have an other IPN Script. It should work but i cant convert it to work with this script.
    can someone help me to fix the IPN part?

    $value) {
    $value = urlencode(stripslashes($value));
    $req .= “&$key=$value”;
    }
    // post back to PayPal system to validate
    $header = “POST /cgi-bin/webscr HTTP/1.0\r\n”;
    $header .= “Content-Type: application/x-www-form-urlencoded\r\n”;
    $header .= “Content-Length: ” . strlen($req) . “\r\n\r\n”;

    $fp = fsockopen (‘ssl://www.sandbox.paypal.com’, 443, $errno, $errstr, 30);

    if (!$fp) {
    // HTTP ERROR
    } else {
    fputs ($fp, $header . $req);
    while (!feof($fp)) {
    $res = fgets ($fp, 1024);
    if (strcmp ($res, “VERIFIED”) == 0) {

    // PAYMENT VALIDATED & VERIFIED!

    $text = “jo\n”; // Dateiinhalt
    $dateiname = “daten.txt”; // Name der Datei
    // Datei öffnen,
    // wenn nicht vorhanden dann wird die Datei erstellt.
    $handler = fOpen($dateiname , “a+”);
    // Dateiinhalt in die Datei schreiben
    fWrite($handler , $fp);
    fClose($handler); // Datei schließen

    }

    else if (strcmp ($res, “INVALID”) == 0) {

    // PAYMENT INVALID & INVESTIGATE MANUALY!

    $text = “no\n”; // Dateiinhalt
    $dateiname = “daten.txt”; // Name der Datei
    // Datei öffnen,
    // wenn nicht vorhanden dann wird die Datei erstellt.
    $handler = fOpen($dateiname , “a+”);
    // Dateiinhalt in die Datei schreiben
    fWrite($handler , $text);
    fClose($handler); // Datei schließen

    }
    }
    fclose ($fp);
    }
    ?>

  194. 29/12/2011soulreafer says:

    ipn script generator to fix the paypal problems:
    https://www.paypaltech.com/SG2/PHPfunctionalityparse.php

  195. 6/01/2012Shelim Ekbal Hussain says:

    Thanks….Emran bhai…very good code.

Write a comment: