Using php to implement paypal integration for websites

Source: Internet
Author: User

So today I will talk about how to integrate your website with paypal.

First, go to paypal to apply for a number. After the information is complete, we can start to take action. By the way, when applying for paypal, we need to apply for an account that can accept payment from others.

Next, we will start integrating paypal with our website.

In fact, paypal provides a silly PAYMENT button creation method, but We generally don't need it because we need to write the customized PAYMENT button based on the actual situation of our website. Let's start with a piece of code:
Copy codeThe Code is as follows:
<Form action = "https://www.sandbox.paypal.com/cgi-bin/webscr" method = "post">
<! -- Change the account to which the money is paid and the value to your account -->
<Input type = "hidden" name = "business" value = "recieve@gmail.com">
<! -- Define the button type. -->
<Input type = "hidden" name = "cmd" value = "_ xclick">
<! -- Defines the IPN return method. 2 indicates post. -->
<Input type = "hidden" name = "rm" value = "2">
<! -- The page to which the user jumps after the payment is successful -->
<Input type = "hidden" name = "return" value = "http://www.sqlview.com/payment/notify.php">
<! -- Very important, custom value. -->
<Input type = "hidden" name = "custom" value = "myvalue">
<! -- Product name. -->
<Input type = "hidden" name = "item_name" value = "floor ticket">
<! -- Commodity price. -->
<Input type = "hidden" name = "amount" value = "5.95">
<! -- Price unit of the product. -->
<Input type = "hidden" name = "currency_code" value = "USD">
<! -- The user can adjust the number of items. -->
<Input type = "hidden" name = "undefined_quantity" value = "1">
<! -- Submit button and image. -->
<Input type = "image" src = "https://www.sandbox.paypal.com/en_US/ I /btn/btn_buynowCC_LG.gif" border = "0" name = "submit" alt = "PayPal-The safer, easier way to pay online! ">

</Form>

In the above submission form, I wrote the most frequently used options. Of course, you can go to the paypal website to check the manual for special requirements.

The previous form mentioned IPN (Instant Payment Notification). This is the key. It is a Notification sent to us by paypal after the Payment is successful, which contains the transaction information variable, we specify paypal to send the variable information to the preset page on our website, and write the variable information we need to the database through this page, you can get the desired information through $ _ POST. Set IPN, log on to the paypal account, and click the profile option to set IPN.

Well, it sounds very easy. Integrate paypal so that your website can accept payments from users around the world!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.