I have completely f开发者_运维百科unctional cart solution. All I want is the code where I actually pass the name of the products, the total, the return address and my paypal address so that it can direct me to a shopping cart. Can anyone steer me in the right direction?
PayPal has a million different versions. What I've come to learn is that the one I need is called "paypal website payments". Can someone confirm this?
Yes, the Website Payments Standard is the way to go.
Basically, you create a form that has a few hidden fields ready to go (such as amount and what not) and then submit it. You could even submit this with JavaScript, so it takes your customer right to PayPal to complete the transaction.
As an example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="your_paypal_email_account" />
<input type="hidden" name="undefined_quantity" value="1" />
<input type="hidden" name="item_name" value="Order #1111111 for So-and-So" />
<input type="hidden" name="item_number" value="order_1111111" />
<input type="hidden" name="amount" value="5.00" />
<input type="hidden" name="shipping" value="0.00" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="cn" value="Comments" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input type="hidden" name="return" value="http://www.example.com/some-page-to-return-to" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_SM.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
You can find documentation on the additional parameters available here: https://www.x.com/sites/default/files/pp_websitepaymentsstandard_integrationguide.pdf
You can use as a reference the following source code: https://github.com/osCommerce/oscommerce2/blob/master/catalog/ext/modules/payment/paypal/express.php
Check out this comparison of PayPal merchant solutions: https://www.paypal.com/gr/cgi-bin/webscr?cmd=_profile-comparison
精彩评论