[Label] Reproduced [Web language settings for the Paypal]paypal online payment interface

Source: Internet
Author: User
Tags locale

http://stephen830.iteye.com/blog/274072

★ ¡ï This article for the original, need to cite a friend reprint please specify: "http://stephen830.iteye.com/blog/274072", thank you for your support! ¡ï ★

I have previously written an article on "PayPal Online payment communication interface http://stephen830.iteye.com/blog/254565". A supplement to the previous article:


Since international PayPal has added the web version of traditional Chinese, many previous systems that integrate PayPal interface, when foreign customers through the system into the PayPal online payment interface, will often open the traditional Chinese page, rather than the previous English page, Cause foreign customers face is a bunch of garbled (foreign customers generally will not install traditional Chinese). Although the language can be switched manually on the PayPal page (UK english/Traditional Chinese).

All this more or less to the use of foreign customers brought inconvenience, for this need to improve the original PayPal interface to solve this small problem. Searching through the API interfaces provided by PayPal did not find the relevant language setting parameters. So after studying the HTML code of the PayPal website, adding a new parameter to the original interface solves the problem above.

HTML code

    1. <form name= "PayPal" action= "Https://www.paypal.com/cgi-bin/webscr?locale.x=zh_HK" method= "POST" >
    2. ...
    3. </form>


LOCALE.X=ZH_HK Traditional Chinese
LOCALE.X=EN_GB English (UK 中文版)

http://stephen830.iteye.com/blog/254565

This article will describe the communication interface issues with PayPal online payment:

Information about PayPal Online payment can be accessed directly from http://www.paypal.com. As a more commonly used tool for international online payments, PayPal has a lot to do with the current international e-commerce, with a detailed description of the PayPal payment interface that communicates with the enterprise's own online e-commerce system.

The general e-commerce system implementation process is as follows:
The customer submits the amount information of the order to the PayPal website, and PayPal pays the customer's payment completion information to the e-commerce system, and the system receives the PayPal information and determines that the customer's order has been paid, Gt Carry out follow-up processes such as shipping.

From this process, you can see that communication between the system and PayPal is particularly critical, enabling automatic payment confirmations for orders.




(1) How to invoke the PayPal interface? (Submit the Order amount information to the PayPal website)
HTML code

  1. <%@ page contenttype= "Text/html;charset=utf-8"%>
  2. <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
  3. "Http://www.w3.org/TR/html4/loose.dtd">
  4. <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
  5. <title>goto paypal</title>
  6. <body bgcolor= "#000000" leftmargin= "0" topmargin= "0" marginwidth= "0" marginheight= "0" >
  7. <form name= "PayPal" action= "HTTPS://WWW.PAYPAL.COM/CGI-BIN/WEBSCR" method= "POST" >
  8. <input type= "hidden" name= "cmd" value= "_xclick" >
  9. <input type= "hidden" name= "Business" value= "[email protected]" ><!--here to fill in your PayPal account email-->
  10. <input type= "hidden" name= "Item_name" value= "Order Information" ><!--here to fill in some information about the customer's order, Customers will see this information when they connect to the PayPal website-
  11. <input type= "hidden" name= "Amount" value= "220.00" ><!--Order Total Amount Information--
  12. <input type= "hidden" name= "Currency_code" value= "USD" ><!--the currency type of the total order amount, customers can pay in other currencies, for example, the order currency here is USD, Customers can pay in EUR EUR and automatically convert between currencies based on the current exchange rate.
  13. <input type= "hidden" name= "On0" value= "customerId" ><!--Custom Parameters 1--
  14. <input type= "hidden" name= "Os0" value= "Stephen" ><!--corresponds to the values above for the custom parameter 1-
  15. <input type= "hidden" name= "On1" value= "Address" ><!--custom Parameters 2--
  16. <input type= "hidden" name= "OS1" value= "Shanghai China" ><!--corresponds to the value of the custom parameter 2 above--
  17. <input type= "hidden" name= "Notify_url" value= "http://www.xxx.com/notifyurl.jsp?order_id=23876412" ><! --This tells PayPal the communication URL of the payment, that is, when the customer pays the call to the URL notification system--
  18. <input name= "paypal" type= "button" value= "Go to Paypal" onclick= "JavaScript:this.form.submit ();" ></td>
  19. </form>
  20. </body>

When generating the PayPal form above, [Cmd],[action],[business],[amount], [currency_code],[notify_url] parameter settings are absolutely not error, [CMD] and [action] Specify the Paypaly interface type, [business] error, you will not receive the customer's payment, [amount] and [Currency_code] relate to the amount of the order, [Notify_url] is the system with PayPal's payment notification interface URL.

When the customer orders to see the page above, they can connect to the PayPal.com website by setting the button [Go to Paypal] and then sign in and make payment.

(2) PayPay return payment information to the system
When the customer pays, PayPal will automatically invoke the [Notify_url] provided in the form above, and here is an example of [notifyurl.jsp]:
HTML code
    1. <%@ page contenttype= "text/html;charset=utf-8"%><%@ page import= "Com.soft4j.NotifyUrlMgr"%><%
    2. String ret = notifyurlmgr.insert (request);
    3. if (ret==null) {out.print ("OK");}  Else{out.print ("fail");}
    4. %>

If you confirm receipt of customer payment information from PayPal, then return "OK" so that PayPal knows the system has received the information, otherwise return "fail", so PayPal will be sent again after a period of time. In fact, only when PayPal receives the "OK" return information will not stop sending payment information, otherwise it will automatically call the above every interval of time
[Notify_url] Communication interface.

(3) The system processes the payment information sent by PayPay

Java code
  1. /*
  2. * Created on 2005-6-12
  3. * Author Stephen
  4. * Email zhoujianqiang at gmail DOT com
  5. * CopyRight (C) 2005-2008, All rights reserved.
  6. */
  7. Package com.soft4j;
  8. Import java.sql.Connection;
  9. Import java.sql.SQLException;
  10. Import java.util.Enumeration;
  11. Import Java.util.Vector;
  12. Import Javax.servlet.http.HttpServletRequest;
  13. /**
  14. * PayPal payment notification interface.
  15. *
  16. * @author Stephen
  17. * @version 1.0.0
  18. */
  19. Public final class Notifyurlmgr {
  20. Public static String insert (HttpServletRequest httprequest) {
  21. //define variables and perform necessary initialization work
  22. Enumeration parameternames = null;
  23. String parametername = null;
  24. String parametervalue = null;
  25. int count = 0;
  26. vector[] params = null;
  27. Vector vparametername = new vector ();
  28. Vector vparametervalue = new vector ();
  29. //Determine if PayPal payment account is correct
  30. String business = Httprequest.getparameter ("Business");
  31. if (! " [Email protected] ". Equals (Business)) {
  32. System.out.println ("Gu:wrong receive PayPal Email:" +business);
  33. return null;
  34. }
  35. try {
  36. String orderId = Httprequest.getparameter ("order_id");//Order number
  37. if (orderid==null| | "".  Equals (orderId)) orderid= "-1";
  38. Parameternames = Httprequest.getparameternames ();
  39. Boolean isprint = false;
  40. While (Parameternames.hasmoreelements ()) {//loops over all parameter information sent by PayPal
  41. ParameterName = (String) parameternames.nextelement ();
  42. ParameterValue = Httprequest.getparameter (parametername);
  43. if (parametervalue==null) parametervalue= "";
  44. Vparametername.add (parametername);
  45. Vparametervalue.add (ParameterValue);
  46. count++;
  47. }
  48. //Add the processing of the received information here: Generally, this information is stored in the database and then processed by the customer's order.
  49. return null;
  50. } catch (Exception e) {
  51. return e.tostring ();
  52. } finally {
  53. //  
  54. }
  55. }
  56. }


In this way, the system can automatically track the payment of the customer's order and make the order processing quicker.

Appendix:
[1] paypay allowed currency

AUD Australian Dollar
CAD Canadian Dollar
CHF Swiss Franc
CZK Czech Koruna
DKK Danish Krone
EUR Euro
GBP Pound Sterling
HKD Hong Kong Dollar
HUF Hungarian forint
JPY Japanese Yen
NOK Norwegian Krone
NZD New Zealand Dollar
PLN Polish zloty
SEK Swedish Krona
SGD Singapore Dollar
USD U.S. Dollar

[2] The parameter meaning of PayPal payment information:

Https://www.paypal.com/IntegrationCenter/ic_ipn-pdt-variable-reference.html


[3] The PDF document of the development API provided by PayPal

PP_OrderManagement_IntegrationGuide.pdf.zip [can be downloaded in the attachment]

[4] The parameters and meanings (i.e. the parameters that you need to set in the form form that you submit to PayPal) are supported by PayPal's payment submission
Https://www.paypal.com/IntegrationCenter/ic_std-variable-reference.html

[5] PayPal Displays the language setting of the page (that is, the language that opens the PayPal website). It needs to be set with parameter locale.x, but this parameter is not in the parameter table provided by PayPal (see [4] above).

HTML code
    1. <form name= "PayPal" action= "Https://www.paypal.com/cgi-bin/webscr?locale.x=zh_HK" method= "POST" >
    2. ...
    3. </form>

LOCALE.X=ZH_HK Traditional Chinese
LOCALE.X=EN_GB English

If your e-commerce system is not a Java environment, you can also refer to the above content.

[Label] Reproduced [Web language settings for the Paypal]paypal online payment interface

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.