PayPal Payment Interface Detailed solution

Source: Internet
Author: User
Tags ack definition form post http post http request soap new set alphanumeric characters
PayPal Payment Interface Detailed solution PayPal is fast, secure and convenient, and is the first online payment method for cross-country transactions. PayPal can now be connected with most of the country's credit cards, which can actually be used to deal with the country's cross-country transactions. Please register your PayPal website: The Https://www.paypal.com/paypal interface is somewhat different from other interfaces, slightly more complicated. In fact, the bank interface is also a point of the plug-in. Called PayPal IPN (Instant Payment Notification), is a kind of system that PayPal has developed to inform third party to sell the system of trading. The principle of IPN is very simple, that is, when the trading state changes after the production of a transaction, such as when the user has paid, or refunds, or withdraws, PayPal uses the usual HTTP POST method to submit some changes in the transaction to a page of the website (called IPN Handler), When this page is accepted, please add these figures to the interface address of PayPal with an indication of cmd=_notify-validate,post, if the numbers are correct, then PayPal returns the string verified, or invalid, If the result is verified, then your program can use these numbers to do the work. Setting up the sandbox account but the code is a very painful thing to do, because as a third-party developers, it is impossible to open two accounts, and every time we try to trade some money, so PayPal opened the sandbox for developers to start, first to https:// developer.paypal.com/  register a open account, and then go into the sandbox to build a test PayPal virtual account (at least one business and one personal), and this Mega Registration method The information can be fake, including the bank account, credit card (in fact, the PayPal sandbox will generate some random numbers) as well as the PayPal process. Next, you need to activate the virtual account of the PayPal sandbox, which, regardless of the email address you fill out at PayPal sanbox, any email sent to the virtual account will be stored in the email page of the admin interface on which the account was opened (on navigation linked fields). In the virtual PayPal environment of the sandbox, you also need to verify the virtual account of the bank, which can be filled in, and then through add funds to the Mega user recharge (how much you want to fill the number of 920-203 920-533). Then, you need to activate the IPN option, in the Profile Settings page of the business mega, clickClick on the Edit button to open the IPN, if you are using a fixed IPN Handle, you can fill in the address directly. Next, when we test, the address of the PayPal interface should be set to   HTTPS://WWW.SANDBOX.PAYPAL.COM/CGI-BIN/WEBSCR basic process when a customer pays you, PayPal will assign a URL ( Type= "hidden" name= "Notify_url" value= "") sends a notification. This notice will include all your customer's payment information (for example, customer name, amount), and an encryption code. When the server receives a notification, it will send the message (including the encryption code) back to the secure PayPal URL. PayPal will verify the transaction by checking the encrypted string. This prevents "spoofing" by sending the IPN back to PayPal, so you can ensure that IPN comes from PayPal. At the time of the verification, PayPal will send the confirmation of its legitimacy back to your service. Tip: To activate instant payment notifications, you will need to enter a URL that you can receive notifications from your user information. After you activate the instant payment notice, your service receives a notification every time you receive a payment, which will be sent to the specified URL as a hidden "form POST" and will include all payment information. The bottom of this page lists the FORM changes for the notification. Each time you receive an IPN from PayPal, you must complete the notification as described below before you actually make a reservation. Make sure that the information listed will be valid for the transaction. The notice confirms that IPN has entered your PayPal mega, and you must verify that the email address used as "Receiver_email" has been registered with your PayPal mega and is confirmed. After the service receives an instant payment notice, you will need to make an HTTP POST to PayPal to confirm it. Your POST should be sent to HTTPS://WWW.PAYPAL.COM/CGI-BIN/WEBSCR you have to send all the received form changes exactly as you received the form. You also need to append a value called "cmd" to the "_notify-validate" variable (for example, Cmd=_notify-validate) to the POST string. PayPal will return the POST and include a single word "verified" or "INVALID" in the body of the reply. When you receive verified back, you need to perform a check before you actually list:Confirm that "Payment_status" is "completed" because the system also sends IPN for other results (such as "Pending" or "Failed"). Check if "txn_id" has not been re-recovered to prevent scams from re-using old completed transactions. The "Receiver_email" is an email address that has been registered with your PayPal mega to prevent payment from being sent to the mega of the scams person. Check other transaction details (such as item number and price) to make sure the price has not changed after you have completed the above checks, you can use the IPN to update your library and deal with the shopping.   If an "ineffective" notification is received, it should be regarded as a suspicious notice and should be checked. Main parameters: When submitting a sticky code to PayPal, you should include the following 4 hidden variables and a picture, which means that the shortest required code you paste into PayPal is as follows:    
  1 2 3 4 5 6 7 8   ion= "https://www.paypal.com/row/cgi-bin/we BSCR "method=" POST ">//" _xclick "immediately buys the email address//Item name (or cart name) of the//paypal mega" de "value=" USD ">//The currency variable value can be" USD ", "EUR", "GBP", "CAD", "JPY". Price of the item (the price of all items in the cart, because it is _xclick mode)  
  Available variable business your PayPal Mega Email address quantity number of items. When it is greater than 1, it is multiplied by the Item_name item name (or cart name). Must be an alphanumeric character, up to 127 characters item_number for the optional transfer of the tracked payment. Must be an alphanumeric character, up to 127 characters amount the price of the item (the total value of all items in the cart) shipping the cost of delivering the item shipping2 the cost of delivery for each additional item handling the amount of tax on the transaction. If the change is used, the pass value will cover all user information tax collection settings (regardless of the home location). No_shipping delivery address. If it is set to "1", your customer will not be required to provide a shipping address. The variable is optional; if omitted or set to "0", you will be prompted to enter the shipping address CN can be selected, the prompt linked fields (up to 40 characters) No_note for the payment to add a hint. If it is set to "1", you will not be prompted for your client input. The variable is optional, and if omitted or set to "0", prompts your customer to enter the prompt. On0 First Choice linked fields name. Up to 64 characters os0 the first group of values. Up to 200 characters. "On0" must be determined so that the knowledge of "Os0". On1 second choice linked fields name. Up to 64 characters os1 the second group option value. Up to 200 characters. "On1" must be determined so that the knowledge of "OS1". Custom will not be able to change the number of options that are displayed to your customer. Can be used to track the amount of invoice that is not displayed to your customer. Can be used with the tracking mega Notify_url only with IPN. Send the Internet URL for IPN Form Post return the Internet URL that your customer will return after completing the payment cancel_return the Internet URL image_url you want to use as the icon for the Internet URL of the image you are using as the target X 50 pixels CS Set the background color of your payment page. If set to "1", the background color will be black. The variance is optional; if omitted or set as "0", the background color will be expanded to white. PayPal allows you to adhere to the expansion of the variable, the condition is to change the following "cmd" value: to: Through the above "cmd" value modification, you can also use the following changes: expansion of the email address of the client Firs The name of the T_name customer. Must be a wordThe parent number character, up to 32 characters last_name the last name of the client. Must be alphanumeric characters, up to 64 characters address1 the country or region of the customer address. Must be alphanumeric characters, up to 100 characters address2 the second line of the customer address. Must be alphanumeric characters, up to 100 characters City client address. Must be alphanumeric characters, up to 100 characters state where the client address is located. Must be a formal 2-letter zip code NIGHT_PHONE_A Customer's telephone number night_phone_b the number of guests in the telephone, the first three guests of the phone number day_phone_a the telephone number in the daytime, and the number of the phone number Day_phone_ b Customer Daytime telephone number The first three tips: To change the "user information" in the default consumption and the manual setup, please transfer to your user information, edit your calculation, and then click on the "Allow the use of the transaction based on the" "box." Pass a single item to PayPal if your third-party cart can be set up to pass a single item to PayPal, information about the item will be added to the recording journal and the system notification of the buyer and seller. To add information to this item, you will need to paste the HTML formatting elements into a new version of the PayPal cart process. The process and the #1 "to pass the total number of vehicles to PayPal" described very similar, the difference is that: "cmd" to set to "_cart" to change the necessary HTML lines and add the new variable called "upload" in the < table > and the label is added to the line : The definition items are detailed for each of the following specific items, and define a new set of values for each item that you purchased through your partner's shopping cart. Attach the "_x" to the variable name, where x is the item number, starting from 1, adding one item per addition. Item_name_x (item #x need) The name of the item #x in the cart. Must be an alphanumeric character, up to 127 characters item_number_x and the optional change of the item #x in the cart. Must be alphanumeric characters, up to 127 characters amount_x (item #x need) Item #x price shipping_x The cost of the first item #x (number of 1) shipping2_x each additional shipment #x (2 or more) is required to Cost of delivery handling_x the cost of the item #x on0_x the first option of the item #x linked fields name. Up to 64 characters os0_x items #The first group of x values. Up to 200 characters. "On0_x" must be determined so that the knowledge of "os0_x". ON1_X Item The second option of the #x linked fields name. Up to 64 characters os1_x the second group value of the item #x. Up to 200 characters. "On1_x" must be determined so that the knowledge of "os1_x". Re-restore each item in the cart this is a set of required changes and any changes in the above table for each item in your purchase cart. The first item in the cart must be used to define the parameters of the _1″, such as "Item_name_1″," Amount_1″, etc. Similarly, the second item should be named after the variable "Item_name_2″," Amount_2″, etc. Tip: The value of "_x" must be sequentially increased by one unit for knowledge. If you jump from item #1 to item #3 and the definition item #2, the third item is ignored. To specify a currency: All currency changes (amounts, fees, charges, charges, currency_code, taxes) will be displayed as a currency that is specified in the "a" variable that is glued to the payment. Because it is not a different item, there is no need to add "_x" to the variable name. If there is no "currency_code" change, we will assume that all currency changes are in dollars. PayPay API PayPal provides a number of API interfaces for developers to use. Before using the API, you must first apply for a high personal mega or business mega, and you must obtain the API procured to use each time the API is tuned. Once you have the API procured certificate, you can adjust the API interface. Currently, we offer two API interface methods, NVP and soap. In general, we recommend that you use the NVP interface.  name-value Pair (NVP) interface – please use simple HTTP for the sum. The interface is simple and easy to use, suitable for first-class developers and people who need to complete integration quickly;  soap interface-Please make the response through SOAP. The interface is suitable for the development of the object-oriented project; PayPal API:NVP (name/value) interface through the NVP API interface, you only need to send PayPal an HTTP request, and through the "name = value" In the form of specifying the parameters, you can take advantage of PayPal's API features. The NVP API is a simple interface for PayPal's business functions, risk management, and business logically. The most basic use of the NVP API is to send an NVP string via HTTPS connection to the PayPal server, and then apply the response (also a NVP string).The basic steps to perform NVP API tuning are as follows:   Create a request string for a specific API method.   sends this string of parameters to the PayPal server via HTTPS connection.   NVP in the service response. Each NVP API asks for a string containing the API username, API password, the name of the API to be tuned, and the token used to trade the logo, such as: user=someone@unknowncompany.com&pwd=mypassword  &AMP;METHOD=GETEXPRESSCHECKOUTDETAILS&AMP;TOKEN=EC-23T233ZP3DFB ... A successful response consists of the following elements: Ack=success, and a unique token used to trade with the target. Ack=success&timestamp=date/timeofresponse &correlationid=debuggingtoken&version=2.300000&build= buildnumber  &AMP;TOKEN=EC-3DJ78083ES565113B&AMP;EMAIL=ABCDEF@ANYEMAIL.COM&NBSP;&AMP;PAYERID=95HR9CM6D56Q2 &payerstatus=verified &firstname=john&lastname=smith ... You can use the NVP API to do the following:   to search for completed transaction records, and to inquire about transaction details;   Self-service backend features such as capture rights, and handling refunds; API profile enters the merchant mega to get the Apiprofile, If you are viewing in Chinese language, in-user information-api access, where the application API, there are two options, the first is signed, the second is to prove the identity of the merchant in the form of a certificate, when you choose to download the digital certificate, you can go to   Www.paypaltech.com/tools/pem2p12.php converted to. p12 files, you can also use the command of OpenSSL to complete, a word to be done, to enter   password Oh ~. The links here have detailed information about the www.paypal.com/IntegrationCenter/ic_certificate.html reference materials please refer to the link www.paypal.com/integrationcenter/ic_expresscheckout.html  understand the principles of express checkout; On this basis, you can visit www.paypal.com/ integrationcenter/ic_nvp.html  to obtain the relevant test code; about PayPal test environment you can visit www.paypal.com/IntegrationCenter/ic_sandbox.html , API reference  https://www.paypal.com/IntegrationCenter/ic_api-reference.html

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.