Test your Account Upgrades using the PayPal Sandbox (XenForo)

Discussion in 'Member Articles & Tutorials' started by Kaiser, Jan 9, 2011.

  1. Kaiser

    Kaiser Regular Member

    Joined:
    Nov 15, 2010
    Messages:
    6,744
    Likes Received:
    1,132
    PayPal has an excellent sandbox environment where you can simulate transactions for your web application. And XenForo supports it out of the box. So you can quite easily test your user account upgrades, without actually transferring any real money. I've outlined the procedure here. Hope you'll find it useful. :)

    Preparation

    Open /library/XenForo/ControllerPublic/Account.php (line 1154-1155):
    Find:

    PHP:
    //'payPalUrl' => 'https://www.sandbox.paypal.com/cgi-bin/websrc',
    'payPalUrl' => 'https://www.paypal.com/cgi-bin/websrc',

    Replace with:

    PHP:
    'payPalUrl' => 'https://www.sandbox.paypal.com/cgi-bin/websrc',
    //'payPalUrl' => 'https://www.paypal.com/cgi-bin/websrc',

    Basically, uncomment the sandbox URL and comment out the real paypal URL. If you are not comfortable with performing a file edit, please say so. I'll provide an addon which would swap these urls for you without any edits.

    Oh, and once you're done with the testing. Revert this change!

    Setup the Sandbox

    1. Go to: https://developer.paypal.com/ and sign up for a sandbox account. You'll have to use an email address different from the one you used to sign up for your PayPal account. Sign up and confirm the email address.

    Signup:


    Confirm:


    2. Login to the PayPal Sandbox environment and create a "Preconfigured" test account.



    3. You'll have to setup two preconfigured test accounts. One as a buyer, and one as a seller. Make sure you are creating verified accounts and with some fake-funding, enough to perform your transactions. The configuration forms are shown in the screenshots below:

    Seller Account:
    View attachment axenforo.com_community_data_attachments_8_8563_82914b76e4e9e9a7bc8e8a2dc4d3840a.jpg

    Buyer Account:
    View attachment axenforo.com_community_data_attachments_8_8564_836019afc76a69676979ebd942a8fb6f.jpg

    Test Accounts Overview:


    Setup your Account Upgrades

    4. Go to: Admin Panel » Users » User Upgrades. Setup your real upgrades (which the registered users will purchase later on) and point your payment gateway to the fake "seller" account you just created. In my case the test1 account is the Seller/Business account.



    Make the Purchase

    5. Open up another browser and login as some other user. I'll be using "Test User 1" for purchasing the account upgrades. Go to the Account Upgrades page and proceed to purchase any of your upgrades.



    6. When you are presented with the PayPal login page, use the fake "buyer" account you had created in the sandbox. In my case "test2" is the Buyer/Personal account.

    Login with Fake Buyer Account:


    Once you login, confirm the payment and return to the merchant website.
    You'll be presented with the usual "Thank you for the Purchase" page.



    ...continued.
     
    Last edited by a moderator: Jan 5, 2014
  2. Kaiser

    Kaiser Regular Member

    Joined:
    Nov 15, 2010
    Messages:
    6,744
    Likes Received:
    1,132
    Confirmation?

    7. Wait for a short while, then head over to your Admin Panel.
    Goto: Users » Active User Upgrades. The test user should now be listed on this page.



    8. Any permission and/or styling preferences will now be applicable to that user. In my case, the "Test Upgrade 1" added a secondary usergroup for which a different user title and username CSS was specified.




    9. You can now safely delete the buyer and seller test accounts from the sandbox.


    http://xenforo.com/community/thread...es-using-the-paypal-sandbox.9909/#post-136120
     
    Last edited by a moderator: Jan 5, 2014
  3. Fiona1964

    Fiona1964 Regular Member

    Joined:
    Oct 13, 2010
    Messages:
    275
    Likes Received:
    84
    Location:
    Glasgow Scotland
    This is a good tip for those who use Paypal but
    I don't use Paypal as i don`t like buying online i like going round the shops to find what i want plus it is more fun
     
  4. Kaiser

    Kaiser Regular Member

    Joined:
    Nov 15, 2010
    Messages:
    6,744
    Likes Received:
    1,132
    Of course I have to agree, but paypal is still great for online only products, like website related things.
     

Share This Page