1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Test your Account Upgrades using the PayPal Sandbox

Discussion in 'Tips and Guides [Archive]' started by Shadab, Jan 2, 2011.

  1. Shadab

    Shadab Well-Known Member

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


    Open /library/XenForo/ControllerPublic/Account.php (line 1154-1155):
                //'payPalUrl' => 'https://www.sandbox.paypal.com/cgi-bin/websrc',
    'payPalUrl' => 'https://www.paypal.com/cgi-bin/websrc',
    Replace with:
                '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.



    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:

    Buyer Account:

    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.


    The1LT, speedway, Steve F and 11 others like this.
  2. Shadab

    Shadab Well-Known Member


    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.


    Andrew, Fuhrmann, Andy.N and 5 others like this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    Great stuff Shadab, I wasn't aware this was possible so I'll be doing this to go through the upgrade process to check how it all works.
  4. Shadab

    Shadab Well-Known Member


    Added the crucial preparation step to the first post.
    You can now test it.
  5. Grover

    Grover Well-Known Member

    Manuals like this one are invaluable for the community... thank you very much indeed for your clear instructions, Shadab!
  6. Edrondol

    Edrondol Well-Known Member

    Whoa! I didn't know you could do this! Real testing? What will they come up with next? Thanks, man!
  7. Sador

    Sador Well-Known Member

    Quite nice.
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Per this thread, you need debug mode enabled to use the sandbox.
    EQnoble likes this.

Share This Page