discount fashion jewelry wholesale How to set up application gateway and application public key for Android Alipay Payment

discount fashion jewelry wholesale

1 thought on “discount fashion jewelry wholesale How to set up application gateway and application public key for Android Alipay Payment”

  1. scarab jewelry wholesale 1. Download the official bag and explanation document
    In fact, the official has provided a installation guide,
    has a PDF in it, which explains in detail the use of guidelines. The writing is more detailed and you can focus on reference.

    In download, we mainly use the alipay_plugin.jar and appdemo/assets under the Android (20120104) directory. Essence
    2. Merchant signing
    The security mechanism is all of this. The client needs to be verified with the server before the verification of the server to further operate, as well as OAUTH.
    In the login Alipay, click the signing entrance, select "Application Products", fill in and wait for review, and get merchant ID and account ID.
    It also provides real -name authentication and upload applications when signing the contract, so I recommend making the application first, and finally integrated Alipay.
    I have waited for 1-2 days of review. The review is failed. The reply is that the application type should be "virtual currency". I changed it to the automatic review and passed it immediately.

    3. Key configuration
    Clashing OpenSSL-0.9.8K_WIN32 (RSA key generation tool) .zip, open CMD, command line into OpenSSL-0.9.8k_win32 (RSA key generation tool ) In the directory,
    (1). Execute
    Openssl genrsa -Out RSA_PRIVATE_KEY.PEM 1024

    (2). Perform
    openssl RSA -IN RSA_PRIVATE_KEY.PEM -Pubout -OUT RSA_PUBLIC_KEY
    n n to generate RSA_PUBLIC_KEY.PEM files.
    (3). In execution
    Openssl PKCS8 -TOPK8 -INFORM PEM -IN RSA_PRIVATE_KEY.PEM -OUTFORM PEM -NOCRYPT

    The two lines with End, copy the contents inside and save them into a certain txt, such as RSA_PRIVATE_PKCS8_KEY.TXT (I don't seem to use this).
    In open RSA_PUBLIC_KEY.PEM, that is, the public key of the merchant, copy it to a new TXT, and delete the file header "---- Begin Public Key -----" and the end of the file "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- END PUBLIC Key ----- "There are also spaces, change lines, become a line of string and save the txt file, and then click" Key Management "on the right side of the" My Merchant Service "switch on the website, and then there is any This "upload the merchant key (RSA)" item, choose to upload the TXT file just now.
    OK, the server is OK, because there is no screenshot before this paragraph. Please refer to the official documentation in the place.
    4. Quote jar and containing the installation package
    (1). Create the new Android project;
    (2) .Copy mentioned alipay_plugin.jar to the libs directory of the project, and in Java Build Find and quote the jar in the PATH in the PATH;
    (3). Copy mentioned above alipay_plugin223_0309.apk to install the package in the assets directory, and the subsequent configuration path is used.

    If the Libs and Assets directory are not, manual founders have two directory.
    5. Call the code to finish
    This here we need to seriously refer to the appdemo in the document. All the source code is COPY, under our own package, and the resource files in the residation of the Resatings are also merged under our engineering RES.
    If, alixdemo.java, .java, proctor.java is an example class, we can delete it after reference.
    .java is the configuration class, configure some configuration parameters of the merchant.
    The other classes are serious reference classes, leaving directly.
    .java code is as follows:
    Public class {// Cooperative merchant ID. After logging in to MS.Alipay with the signing Alipay account, obtain it on the account information page. Public Static Final String Partner = "XXX"; // Account ID. After logging in to MS.Alipay with the signing Alipay account, obtain it on the account information page. Public Static Final String Seller = "XXX"; // Merchant (RSA) private key, that is, remove the first row in RSA_PRIVATE_KEY.PEM. In the last line, the string Public Stric String RSA_PRIVATE = "XXX" " // Alipay (RSA) Public key Log in to MS.Alipay with a contract with Alipay account, and obtain it on the key management page. public static final String RSA_ALIPAY_PUBLIC = "xxx";t//下面的配置告诉应用去assets目录下找安装包tpublic static final String ALIPAY_PLUGIN_NAME ="alipay_plugin223_0309.apk";}rnrn  AlixDemo中代码是最终The call code is in (u003C?> ARG0, View ARG1, int ARG2, Long ARG3) {}, and we extract the core code in it.
    6. Extract the core call code
    The new alixpay.java in the same directory in alixDemo.java to extract the core code of AlixDemo.java:
    package com.tianxia.lib.baseworld.alipay; import java.;import java.text.;import java.util.Date;import com.tianxia.lib.baseworld.R;import android.app.Activity;import android.app.;import android.content.;import android. os.Handler;import android.os.Message;import android.view.KeyEvent;import android.widget.Toast;public class AlixPay { static String TAG = "AlixPay"; private Activity mActivity; public AlixPay(Activity activity) { mActivity = activity; } private mProgress = null; // the handler use to receive the pay result. private Handler mHandler = new Handler() { public void (Message msg) { try { String strRet = (String) msg.obj; switch (msg .what) {case alixid.rqf_pay: {();. Log (tag, strt); try {string memo = "memo ="; int = strret.indexof ("memo ="); = memo.Length () ; int iMemond = Strret.ind exof ("; Result ="); Memo = Strret.substring (, IMEMOEND); = New (Strret); int RetVal = .Checksign (); if (retval == .Result_check_sign_faird) {. Mactivity. (). Getstring (r.string.check_sign_faird), android.r.drawable.ic_dialog_alert);} else {. (); (Mactivity, "Tip", Strret, R.);} Break;} Super. (MSG);} Catch (Exception E) {e. ();}}; // Close the progress bar void () {try {if (mprogress! = null) {mprogress.dismiss (); mprogress = null;} catch (exception e) {e. ();} public void pay {msphelper = news );; = msphelper._sp (); if (! ismobile_spexist) Return; if (! Checkinfo ()) {. the order info. String orderInfo = (); String signType = (); String strsign = sign(signType, orderInfo); strsign = .encode(strsign); String info = orderInfo "

Leave a Comment