Question

Currently creating a subscription system for my site and as far as I can tell it all is correct however...when I log in on the sandbox paypal I get an error. If I change my 'business' value to someone elses (which I found in a tutorial) then my code works perfectly.

This is my code which doesn't work.....

    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
            <input type="hidden" name="cmd" value="_xclick-subscriptions" />
            <input type="hidden" name="business" value="R44RL3XVBXPAA" />
            <input type="hidden" name="item_name" value="Quarterly Company subscription for Test" />
            <input type="hidden" name="item_number" value="2" />
            <input type="hidden" name="currency_code" value="GBP" />

            <input type="hidden" name="a3" value="30.00" />
            <input type="hidden" name="p3" value="3" />
            <input type="hidden" name="t3" value="M" />

            <input type="hidden" name="@return" value="http://localhost:1076/Payment/Complete" />
            <input type="hidden" name="notify_url" value="http://localhost:1076/Payment/Process/5a0411ac-bb64-4b82-99f5-8f147887cbff" />
            <input type="hidden" name="cancel_return" value="http://localhost:1076/Payment/ProcessCancel/5a0411ac-bb64-4b82-99f5-8f147887cbff" />

            <input type="hidden" name="src" value="1" />
            <input type="hidden" name="sra" value="1" />
        </form>

This is the code that does work...

   <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
            <input type="hidden" name="cmd" value="_xclick-subscriptions" />
            <input type="hidden" name="business" value="info@capleswebdev.com" />
            <input type="hidden" name="item_name" value="Quarterly Company subscription for Test" />
            <input type="hidden" name="item_number" value="2" />
            <input type="hidden" name="currency_code" value="GBP" />

            <input type="hidden" name="a3" value="30.00" />
            <input type="hidden" name="p3" value="3" />
            <input type="hidden" name="t3" value="M" />

            <input type="hidden" name="@return" value="http://localhost:1076/Payment/Complete" />
            <input type="hidden" name="notify_url" value="http://localhost:1076/Payment/Process/5a0411ac-bb64-4b82-99f5-8f147887cbff" />
            <input type="hidden" name="cancel_return" value="http://localhost:1076/Payment/ProcessCancel/5a0411ac-bb64-4b82-99f5-8f147887cbff" />

            <input type="hidden" name="src" value="1" />
            <input type="hidden" name="sra" value="1" />
        </form>

Any Ideas? Is it my code or something I need to moan at PayPal about?

Dave

Was it helpful?

Solution

Make certain that you setup a sandbox test buyer account, and use your test buyer account login to test the button. This is because the PayPal server will not allow you to use the same seller account to make a purchase or create a subscription even for test purposes.

Developer Account Login

  1. Log in to your developer account
  2. Click on Sandbox Accounts
  3. Click on Create Account
  4. Fill in the information about your buyer account
  5. Include a beginning balance
  6. Make certain to add an additional test card, one will be generated for you
  7. Click Create account

Use the new buyer credentials that you just created to run a test transaction on your donor form. This will allow you to properly test your

I tested your code and when I added the button image it redirected to the test server with no problems.

 <input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted">
 <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 </form>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top