UnionPay payment and payment

Source: Internet
Author: User

UnionPay payment and payment

I. Overview

The UnionPay mobile payment control (hereinafter referred to as the payment control) provides secure and convenient payment services for mobile clients or mobile Web websites of the merchants. Currently, the payment control supports Android and iOS platforms. You can enter the bank card number, mobile phone number, password (debit card and prepaid card), CVN2, and validity period (credit card) in the payment control), verification code and other elements to complete the payment.

Ii. payment process Introduction

The transaction process through the payment control is as follows:

 

Flowchart description:

(1) The user clicks "buy item" in the client, and the client initiates an order generation request to the merchant's background;

(2) After receiving the order generation request, the merchant background organizes and pushes the order information to the UnionPay Background In accordance with UPMP merchant access interface specifications;

(3) After receiving and checking the order information, the UnionPay background generates the corresponding transaction serial number (TN) and replies the transaction serial number to the merchant's background (response element: transaction serial number );

(4) The merchant receives the transaction serial number in the background and returns the serial number to the client;

(5) The client calls the payment control through the transaction serial number (TN;

(6) After the user enters the relevant payment information in the payment control, the payment control initiates a payment request to the UnionPay background;

(7) after the payment is successful, the UnionPay background will notify the merchant's background of the payment result;

(8) UnionPay notifies the payment control of the payment result;

(9) The payment control displays the payment result and returns the payment result to the client;

Note: This document focuses on the implementation of (5) and (9) in the above process.

Currently, the devices supported by various platforms are as follows:

The Android SDK is mainly applicable to terminal devices of Android 2.1 and later versions;

The iOS payment control is applicable to terminal devices of iOS 5.1 and later versions.

Ii. Test account

  • Provide information on the card number and mobile phone number used for testing (this information is only for testing and will not be officially traded)

China Merchants Bank Prepaid card:

Card No.: 6226 4401 2345 6785

Password 111101

Iii. iOS Client

This section is intended for those who have certain iOS programming experience and understand the object-oriented concept.

The directory where the SDK file is located: upmp_iphone/sdk. All files mentioned in the following sections are found in this directory.

  1. SDK description

The SDK is divided into the following two versions:

  1. Supports static databases for non-card-only transactions (UPPayPlugin), including files:

UPPayPlugin. h

UPPayPluginDelegate. h

LibUPPayPlugin.

  1. Supports pure non-card transactions and VIPOS audio interface payment static libraries, which are referred to as UPPayPluginPro, including files:

UPPayPluginPro. h

UPPayPluginDelegate. h

LibUPPayPluginPro.

  1. Interface Description
  1.  

 

Parameters are described in Table 3-1:

Table 3-1 Interface Parameters

 

  1. Add SDK package
  1. Add the three files under the SDK/inc directory and sdk/libs directory to the UPPayDemo project based on the sdk version selected by the merchant;
  2. If you select the UPPayPlugin version, add QuartzCore. framework and Security. framework to the project;
  3. If you select UPPayPluginPro, add QuartzCore. framework, AudioToolbox. framework, CoreAudio. framework, MediaPlayer. framework, AVFoundation. framework, and Security. framework to the project;
  4. In the Build Settings of the project, find Other Linker Flags and add the-ObjC macro;
  1. Call plug-ins
  1. Reference the header file UPPayPlugin in the source file that needs to call the payment control. h or UPPayPluginPro. h (Note: if the compile source as option value of the project is not Objective-C ++, the file type that references this header file should be changed. mm)
  2. By calling

+ (BOOL) startPay :( NSString *) tn

Mode :( NSString *) mode

ViewController :( UIViewController *) viewController

Delegate :( id <UPPayPluginDelegate>) delegate;

Call controls

  1. Process the payment result

The UnionPay mobile payment control has three return values: success, fail, and cancel, which indicate successful payment, failed payment, and canceled payment. These three return Status values are returned in the form of strings as the callback function parameter (NSString *) result. Add the header file "UPPayPluginDelegate. h ", implements the UPPayPluginDelegate interface on the transaction result processing interface, and implements the callback method according to the callback function in the header file:-(void) UPPayPluginResult :( NSString *) result, in this way, the relevant processing can be performed based on different payment results.

Iv. Android Client

This section is intended for those who have some Android programming experience and understand the object-oriented concept.

  1. SDK Package Description

 

The SDK is divided into the following two versions:

  1. Supports the card-free transaction version, which is located in the upmp_android/sdknocard directory:

 

The APK directory contains the uppaypluginex.apk file that is connected with APK.

The jar directory contains the jar packages, so files (supporting arm, armv7, x86, and mips platforms) and resource files required for static library integration.

Note:

The data. binfile is an image resource file and must be stored in the res/drawable directory of the project;

UPPayPluginEx. jar is a control in the form of a jar package and must be stored in the libs directory of the project;

Libentryex. so is a dynamic library file, please store in the libs/xxx/directory of the Project as needed, where xxx is one of armeabi, armeabi-v7a, mips, x86.

  1. Supports pure card-less transactions and card-less transactions. Card-less transactions support UnionPay mini IC card products, smart SD card products, and VIPOS products. This version is mainly located in the upmp_android/sdkPro directory:

 

The APK directory contains the uppaypluginexpro.apk file that is connected with APK.

The jar directory contains the jar packages, so files (supporting arm, armv7, x86, and mips platforms) and resource files required for static library integration.

Note:

The data. binfile is an image resource file and must be stored in the res/drawable directory of the project;

UPPayPluginExPro. jar is a control in the form of a jar package and must be stored in the libs directory of the project;

Libentryexpro. so is a dynamic library file, please store in the libs/xxx/directory of the Project as needed, where xxx is one of armeabi, armeabi-v7a, mips, x86.

  1. Interface Description

The upmp_android/UPPayAssistEx. jar package defines the interface for starting the payment control. The interface definition is as follows:

 

Other auxiliary interfaces:

 

  1. Add SDK package

Copy upmp_android \ sdknocard \ UPPayAssistEx. jar (or upmp_android \ sdkPro \ UPPayAssistEx. jar) to the libs \ directory of the project;

You can also copy upmp_android \ sdknocard \ apk \ UPPayPluginEx.apk (or upmp_android \ sdkPro \ apk \ UPPayPluginExPro.apk) to the assets Directory of the client project. The effect is as follows:

 

Right-click the project and select Configure Build Path… In Build Path ..., Select the Libraries tab and Add Jars... Import the UPPayAssistEx. jar package under the libs directory of the project. For example:

  1. Call the payment control
  1. Introduce the UPPayAssistEx class in the code file that calls the payment control, for example:
  2.  
  3. You can call the payment control in the following ways:
  4.  

After the payment is complete, obtain the payment result of the payment control and add the corresponding processing logic. You only need to call the onActivityResult () method in Activity. The instance code is as follows:

 

5. Mobile Web site

  1. Support for browsers
  • Android version of UC browser (supported by method 1 access, but not detected by method 2)
  • IOS version of UC browser (access through method 2)
  • QQ browser Android 3.6 or later (access through method 2)
  • 360 browser Android 2.7 and later (access through method 2)
  • Operabrowser Android HD version 1.3 and later (access through method 2)
  • Android and iOS versions of the native browser of the system (only access through method 2 is supported)

For more information, see Appendix 1.

  1. Method 1

Code must be embedded to call the Web page of the payment control

 

<Embed> is the UC plug-in tag for UnionPay mobile payment, which is displayed as the UnionPay mobile payment button in the UC browser ,. Do not modify the first few parameters:

Type = "application/x-unionpayplugin" uc_plugin_id = "unionpay" height = "53" width = "178"

For the Order Information Section, see Web order generation.

Example of code embedded in the payment control page (consumption transaction)

 

  1. Method 2

Code must be embedded to call the UnionPay mobile payment control page

 

The <a> label items are used for non-UC browser access controls for UnionPay mobile payment, And the UnionPay mobile payment button is displayed in a non-UC browser ,. The UnionPay mobile payment icon specifies the path of the icon.

 

Sample Code for embedding a payment control page

 

  1. Web order generation

The order information displayed on the web page is generated as follows:

  1. The resultURL value in order information in table 5-1 is encoded in URLEncode format, and the order information is spliced with other fields in Table 5-1 format.
  2. Encode the result in step a) with base64.
  1. Encode the results produced in step B) using URLEncode to obtain the final data displayed.

That is:

Paydata = urlEncode (base64 ("tn =" + tn + ", resultURL =" + urlEncode (resultURL) + ", usetestmode =" + usetestmode ))

 

Each parameter pair in a Web site Order is composed of parameter values, which are separated by commas. Do not have spaces between parameters. The format is as follows:

Table 5-1 web order Composition

 

 

Table 5-2 Description of order information fields

 

  1. Browser access solution recommendation
  1. For UC, QQ, and 360 browsers (the latest version on the Browser Server), you can directly display the corresponding tag on the page.
  2. For Opera (although connected, a newer version of plug-in download is not provided on its server), the page prompts the supported control version, and notifies the user to view the control version and upgrade address.
  3. For non-docked browsers (mainly including native browsers), follow method 2.
  1. Widget

Android

Http://mobile.unionpay.com/getclient? Platform = android & type = securepayplugin

IOS

Http://mobile.unionpay.com/getclient? Platform = ios & type = securepayplugin

Vi. Precautions for developers

  1. When you access the payment control through a browser, the imported resultURL should be accepted by parameters and must be encoded using URLEncode. The url format before encoding is as follows:

Https://example.com/example? ArgName =

VII. Summary of Common Problems

  1. IOS platform FAQ
  • Compilation error solving

During the compilation process of the UPPayDemo project, the Undefined symbols for architecture armv6/armv7/i386 compilation error may occur. If such an error occurs, the following solutions are available:

1) because the payment control uses the C, C ++, and OC hybrid encoding, a link error may occur after the merchant project introduces the UPPayPlugin. h header file. You can solve this problem in two ways:

① Change the suffix names of the source files that reference UPPayPlugin. h to. mm;

② If the merchant does not want to modify the extension name of the source file, add an empty class inherited from NSObject in the project and change the extension name of file. m to. mm. The method is new file-> Objective-C class-> class name self-fetch-> Save-> modify the suffix to. mm.

③ The value of the compile source as option of the project is not Objective-C ++;

2) the User-Defined library file libUPPayPlugin is added to the UPPayDemo project. a. When compiling a Demo project, check the path settings of Framework Search Paths, Header Search Paths, and Library Search Paths in the project settings to check whether the set path is correct, also, check whether there are extra uncertain paths.

Related Article

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.