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

21 February 2009 » In Code Library, PHP, Web Development »

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.

You can straight-away download the package 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!

Download

payment.zip
PHP Payment Library for Paypal, Authorize.net and 2Checkout
Downloaded: 8958 times
Share and Enjoy:
  • Digg
  • DZone
  • Twitter
  • Posterous
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Simpy
  • Ping.fm
  • Tumblr

Tags: , , , , , , , , , ,

Trackback URL

116 Comments on "PHP Payment Library for Paypal, Authorize.net and 2Checkout (2CO)"

  1. admin
    Pete
    21/02/2009 at 12:32 pm Permalink

    Thanks man!

  2. admin
    hasin hayder
    21/02/2009 at 1:18 pm Permalink

    bookmarked!!

    excellent writing, carry it on

  3. admin
    ranacse05
    21/02/2009 at 9:07 pm Permalink

    thanks , its very much helpful .

  4. admin
    MadMax3000
    21/02/2009 at 10:29 pm Permalink

    Awesome – Awesome – and Awesome

    Thanx

  5. admin
    Nurul Ferdous
    22/02/2009 at 4:57 am Permalink

    Downloaded :) Thanks man!!

  6. admin
    Sean Nieuwoudt
    22/02/2009 at 5:16 am Permalink

    thanks dude.

    any chance of adding google checkout?

  7. admin
    Md Emran Hasan (phpfour)
    22/02/2009 at 7:04 am Permalink

    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. admin
    Gus
    22/02/2009 at 9:35 am Permalink

    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. admin
    Shimon
    22/02/2009 at 11:01 am Permalink

    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. admin
    Luke
    22/02/2009 at 12:07 pm Permalink

    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. admin
    MJ
    22/02/2009 at 6:59 pm Permalink

    Thank you, this is great!

  12. admin
    Mhd Zaher Ghaibeh
    22/02/2009 at 8:46 pm Permalink

    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

  13. admin
    Md Emran Hasan (phpfour)
    22/02/2009 at 9:21 pm Permalink

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

  14. admin
    Md Emran Hasan (phpfour)
    22/02/2009 at 10:50 pm Permalink

    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 :)

  15. admin
    Will
    23/02/2009 at 7:30 am Permalink

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

  16. admin
    Guhan Iyer
    23/02/2009 at 11:45 am Permalink

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

  17. admin
    JP
    25/02/2009 at 12:10 am Permalink

    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.

  18. admin
    JP
    25/02/2009 at 12:37 am Permalink

    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!!

  19. admin
    Md Emran Hasan (phpfour)
    25/02/2009 at 1:00 am Permalink

    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

  20. admin
    quaffapint
    02/03/2009 at 11:20 am Permalink

    Any updates on adding recurring/subscription payments? Thanks!

  21. admin
    Shimon
    03/03/2009 at 6:29 pm Permalink

    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.

  22. admin
    Shimon
    03/03/2009 at 6:31 pm Permalink

    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

  23. admin
    Sean Nieuwoudt
    07/03/2009 at 1:27 pm Permalink

    When will google checkout be added?

    Regards,
    Sean

  24. admin
    Darrell Greenhouse
    11/03/2009 at 2:21 am Permalink

    Thanks from the U.S.

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

    Thanks again

  25. admin
    Md Emran Hasan (phpfour)
    11/03/2009 at 12:30 pm Permalink

    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 :)

  26. admin
    Md Emran Hasan (phpfour)
    11/03/2009 at 12:32 pm Permalink

    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.

  27. admin
    Jason Brooks
    11/03/2009 at 6:39 pm Permalink

    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.

  28. admin
    cf
    16/03/2009 at 5:00 am Permalink

    can u add the working demo link as well!

  29. admin
    niaoren
    18/03/2009 at 12:27 am Permalink

    thank you ! man!

    And hope the google checkout will be released!

  30. admin
    Rich Pedley
    18/03/2009 at 3:54 am Permalink

    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.

  31. admin
    Mahmud Ahsan
    19/03/2009 at 2:08 pm Permalink

    Really a nice, organized and very essential library.

  32. admin
    Agam
    26/03/2009 at 3:30 am Permalink

    Nice

  33. admin
    Md Emran Hasan (phpfour)
    26/03/2009 at 3:43 am Permalink

    Thanks!

  34. admin
    Karl
    02/04/2009 at 12:57 am Permalink

    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.

  35. admin
    Paul
    10/04/2009 at 5:04 pm Permalink

    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.

  36. admin
    mahfuz05
    27/04/2009 at 5:32 am Permalink

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

  37. admin
    brian
    27/04/2009 at 7:19 am Permalink

    sweet!

  38. admin
    Sam
    30/04/2009 at 12:58 am Permalink

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

  39. admin
    Austin Mount
    04/05/2009 at 1:51 pm Permalink

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

    parent::__construct();

    // Some default values of the class

    $this->gatewayUrl = 'https://www.paypal.com/cgi-bin/webscr';

    $this->ipnLogFile = 'paypal.ipn_results.log';

    // Populate $fields array with a few default

    $this->addField('rm', '2'); // Return method = POST

    $this->addField('cmd', '_cart');
    $this->addField('upload', '1');

    }

    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

  40. admin
    muhit
    07/05/2009 at 10:23 am Permalink

    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. :)

  41. admin
    Md Emran Hasan (phpfour)
    09/05/2009 at 12:17 pm Permalink

    There is no working demo mate, sorry!

  42. admin
    Md Emran Hasan (phpfour)
    09/05/2009 at 12:19 pm Permalink

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

  43. admin
    Md Emran Hasan (phpfour)
    09/05/2009 at 12:19 pm Permalink

    Thanks

  44. admin
    Md Emran Hasan (phpfour)
    09/05/2009 at 12:21 pm Permalink

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

  45. admin
    Md Emran Hasan (phpfour)
    09/05/2009 at 12:24 pm Permalink

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

  46. admin
    Ambassador
    14/05/2009 at 1:48 pm Permalink

    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?

  47. admin
    prakashkommerla
    21/05/2009 at 6:46 am Permalink

    its very useful………..

    Thanks

  48. admin
    quantro
    22/05/2009 at 2:17 am Permalink

    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

  49. admin
    Jack
    30/05/2009 at 8:13 am Permalink

    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!

  50. admin
    Jack
    30/05/2009 at 8:18 am Permalink

    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

  51. admin
    jigish
    25/06/2009 at 5:26 am Permalink

    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

  52. admin
    Ofer
    04/07/2009 at 11:33 pm Permalink

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

  53. admin
    Tomh
    06/07/2009 at 10:59 pm Permalink

    Where is INS parser?

  54. admin
    vishal
    10/07/2009 at 7:09 am Permalink

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

  55. admin
    francesco
    12/07/2009 at 2:56 pm Permalink

    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!

  56. admin
    ZMax
    13/07/2009 at 11:36 am Permalink

    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?

  57. admin
    diseoweb
    18/07/2009 at 5:35 pm Permalink

    Thanks for the contribution will prove, it!

  58. admin
    cubanhenry5
    23/07/2009 at 12:33 am Permalink

    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

  59. admin
    ariful
    28/07/2009 at 9:19 am Permalink

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

  60. admin
    ganz
    09/08/2009 at 7:56 am Permalink

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

  61. admin
    vancuong3682
    12/08/2009 at 9:00 am Permalink

    Thanks for your library,
    Thank you very much indeed,

  62. admin
    southfranceproperty
    19/08/2009 at 3:24 am Permalink

    Brilliant! :)

  63. admin
    Md Emran Hasan (phpfour)
    21/08/2009 at 11:33 pm Permalink

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

  64. admin
    Md Emran Hasan (phpfour)
    21/08/2009 at 11:37 pm Permalink

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

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

  65. admin
    Md Emran Hasan (phpfour)
    21/08/2009 at 11:38 pm Permalink

    Sorry. You can get yourself from their site.

  66. admin
    Md Emran Hasan (phpfour)
    21/08/2009 at 11:39 pm Permalink

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

  67. admin
    Md Emran Hasan (phpfour)
    21/08/2009 at 11:39 pm Permalink

    Thanks for sharing!

  68. admin
    Md Emran Hasan (phpfour)
    22/08/2009 at 6:39 am Permalink

    Thanks for sharing!

  69. admin
    Vipin
    22/04/2010 at 10:36 am Permalink

    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

  70. admin
    Jessica
    29/04/2010 at 3:17 pm Permalink

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

  71. admin
    Emran Hasan
    29/04/2010 at 9:38 pm Permalink

    @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.

  72. admin
    Jessica
    30/04/2010 at 1:58 pm Permalink

    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 !!!!

  73. admin
    GillBate
    30/04/2010 at 5:34 pm Permalink

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

  74. admin
    amit
    25/05/2010 at 4:50 am Permalink

    Thanks its very help full for me ..

  75. admin
    mumo
    01/06/2010 at 9:48 am Permalink

    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…

  76. admin
    andy
    07/06/2010 at 4:59 am Permalink

    Hai,

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

  77. admin
    Emran Hasan
    08/06/2010 at 9:14 pm Permalink

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

  78. admin
    Click for beats
    13/06/2010 at 1:17 pm Permalink

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

  79. admin
    Alam
    23/06/2010 at 12:16 am Permalink

    Nice Job :D

  80. admin
    Curious
    05/07/2010 at 1:35 am Permalink

    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!

  81. admin
    harmeet
    08/07/2010 at 12:14 am Permalink

    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

  82. admin
    Steve
    12/07/2010 at 8:31 am Permalink

    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?

  83. admin
    Dev
    12/07/2010 at 10:26 pm Permalink

    Thanks – short and to the point!!!

  84. admin
    IanLindsay
    23/07/2010 at 7:43 am Permalink

    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'];
    }

  85. admin
    Bruno
    23/07/2010 at 6:10 pm Permalink

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

  86. admin
    Abdullah Al Mamun
    08/08/2010 at 6:23 pm Permalink

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

  87. admin
    Mohammed Cherkaoui
    09/08/2010 at 6:59 am Permalink

    Fantastic !!!

    i Will Absolety use it !

    thank u

Trackbacks

  1. HamzaED 22/02/2009 at 11:12 am

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

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

  3. [...] 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 [...]

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

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

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

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

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

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

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

  11. [...] PHP Payment Library - 支持Paypal, Authorize.net å’Œ2Checkout (2CO) OpenID PHP-OpenID - 支持OpenID的一个PHP库。OpenIDæ˜¯å¸®åŠ©ä½ ä½¿ç”¨ç›¸åŒçš„ç”¨æˆ·åå’Œå£ä»¤ç™»å½•ä¸åŒçš„ç½‘ç«™çš„ä¸€ç§è§£å†³æ–¹æ¡ˆã€‚å¦‚æžœä½ å¯¹OpenIDä¸ç†Ÿæ‚‰çš„è¯ï¼Œä½ å¯ä»¥åˆ°è¿™é‡Œçœ‹çœ‹ï¼šhttp://openid.net.cn/ 数据为抽象/å¯¹è±¡å…³ç³»æ˜ å°„ORM ADOdb - ...

  12. links for 2009-05-18 | NeXt 17/06/2009 at 11:09 am

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

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

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

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

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

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

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

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

  20. Kumpulan Pustaka PHP 01/12/2009 at 11:20 am

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

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

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

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

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

  25. [...] [...]

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

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

  28. [...] 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 ...

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

Hi Stranger, leave a comment:

ALLOWED XHTML TAGS:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to Comments