MobPay includes mainstream payment methods such as Alipay and wechat, helping merchants reduce access costs and improve operational efficiency. MobPay is characterized by neutrality, flexibility and convenience. Make App quickly have the ability to pay, make payment easier and faster.


1. Register the app to obtain appKey and appSecret
How applications get appkey and registered at our website, please click on the link to see the inside of the operation steps: http://bbs.mob.com/forum.php?mod=viewthread&tid=8212&extra=page%3D1
Ii. Obtain payment SDK:
Click on the link to download the latest VERSION of SDK and extract the following file structure:



SDK: Payment SDK and dependency libraries. Drag this folder directly into the project.
Catalog Introduction:
Channels: SDK of third-party platforms, including Alipay and wechat
MOBPaySDK: Payment SDK main library
Required: A Required dependency library
3. Integrate payment SDK
1. Add the SDK to the project
(1) Manually drag the SDK folder into the project
I. Check the box in red:



Ii. Set dependencies
List of libraries required by the SDK
libz.tbd
libstdc++.tbd
// Alipay SDK dependency
CoreMotion.framework
// wechat SDK dependency
libsqlite3.tbd



(2) POD import
1. First, CD to the root directory of the project and execute pod Setup.
2. Add commands to your Podfile as needed:
pod’mob_paysdk’
3. If it has not been installed before, perform this operation for the first time
Install library: Pod Install
If it has not been installed before, it only needs to be executed
Update library: POD Update
2. Set Build Settings
-objc needs to be added in Other Linker Flags



3. Configure the whitelist and urlScheme
Wechat: URL Scheme: whitelist of wechat appID: weixin
Alipay: URL Scheme: AP + Alipay appID
Configuration URLSchemes:



Configuring a Whitelist
In the Info. Add in the plist key for LSApplicationQueriesSchemes value as an array of key-value pairs, and add the white list required by each platform in an array
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
</array>



4. Configure AppKey and appSecret
Add a key-value pair to the info.plist file in the project. The key is MOBAppKey and MOBAppSecret, and the value is the appkey and appSecret obtained in Step 1



Use the APIS provided by the SDK
1. Import the header file
#import <MOBPaySDK/MOBPay.h>
2. Set the payment callback agent
/ * *
Set up the observer to listen for payment status changes and callbacks
@param Observer Callback agent
* /
+(void)addObserver:(id<MOBPayObserverDelegate>)observer;
Note: developers should pay attention to the app in jump out to the third party payment platform, the client pays, is back by your app in the background, the app will restart, if you want to get paid as a result, the need to turn the proxy Settings in didFinishLaunchingWithOptions approach



3. Invoke the payment interface for payment
There are two access methods for payment through SDK. For details, please refer to www.mob.com
The first way: pay directly through payment data
Create the data model required for payment: MPSCharge
Call the payment interface for payment



#import



Second method: payment is made through the developer’s own ticketId returned in the background



4. Payment result processing
Returns the payment result via the MOBPayObserverDelegate protocol
Note: the specific payment results should be subject to the query of the background server by the developer, and the results returned by the SDK should not be directly used as payment results to process relevant business.



Code examples: