I'd like to create a simple PHP form that will allow my website user to make a payment on their account with us using PayPal. I'd like them to enter their name, email address, account number, and the amount they'd like to pay. I would then like to pass this information to PayPal (possibly as a "buy it now" using the account number as the item number) and let PayPal handle all the PP account and/or credit card information. I would then check my PayPal business account daily for the payments I need to record in my accounting package.

I don't expect to get many payments this way, but want to offer the convenience to my clients.

Has anyone seen or posted a code snippet that would point me in the right direction? Anyone want to help with the coding?

Thanks!
Jim

Recommended Answers

All 3 Replies

If you would want to use IPN you will need to set up a script that paypal will call once payment has been processed or failed. This is useful if you don't want to have to check everyday for the payment.

But for you application, if you don't need it to be automated a simple buy button could work.

Here is a pauy button with some inputs not hidden...

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

    <label>First Name: </label><input type="text" name="first_name" value="" /><br />
    <label>Last Name: </label><input type="text" name="last_name" value="" /><br />
    <label>Email: </label><input type="text" name="payer_email" value="" /><br />

<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="email@youraddress.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="youritemname">
<label>Account Number: </label><input type="text" name="item_number" value=""><br />
<label>Dollar Amount: </label>$<input type="text" name="amount" value=""><br />
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Hopefully this is somewhat what you want.

commented: His answer solved the problem. +0

CJay, now that I feel like a total ID-10-T, thanks! I never considered UNhiding the fields and using INPUT as you did in your example. I'm a PHP newbie and amazed at how powerful it can be.

I did notice that with this transaction type, users are required to have a PayPal account. Is there an option to permit them to enter credit card info without creating a PP account or is this just one of the restrictions of PayPal "Standard" (as opposed to "Pro")? (I apologize... this is a case of RTFM; I should download and read the PayPal manual, but you're obviously well versed in it.)

Thanks again,
Jim

Never mind, CJay. I found the credit card answer wen I plugged in my REAL verified PP business account instead of test "dummy" info.

It works great. The hours I spent searching the web for an answer to be so quickly and accurately answered here with a post!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.