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. 
Preparation
Open /library/XenForo/ControllerPublic/Account.php (line 1154-1155):
Find:
Replace with:
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:

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.

...continued.

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',
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:

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.

...continued.