MaxLeapPay Class Reference

Inherits from NSObject
Declared in MaxLeapPay.h

Overview

The main SDK class of MaxLeapPay framework.

+ setEnvironment:

Set the payment environment.

+ (void)setEnvironment:(MLPayEnvironment)environment

Parameters

environment

the environment

Discussion

Not all channel support all the environments. You can check whether a channel is avalibale by using method isChannelAvaliable:.

Declared In

MaxLeapPay.h

+ isChannelAvaliable:

Check whether a channel is avaliable.

+ (BOOL)isChannelAvaliable:(MLPayChannel)channel

Parameters

channel

The channel to check.

Return Value

YES if avaliable, otherwise NO.

Discussion

An avaliable channel may satisfy several conditions simutanously. 1. The sdk for this channel is intergrated. 2. Set credentials correctly if needed. 3. PayEnvironment you set is suported.

Declared In

MaxLeapPay.h

+ setWXAppId:wxDelegate:description:

Initialize WeChat pay environment by calling [WXApi registerApp:withDescription:].

+ (BOOL)setWXAppId:(NSString *)appId wxDelegate:(id<WXApiDelegate>)wxDelegate description:(nullable NSString *)description

Parameters

appId

wechat appid

wxDelegate

an object confirms to WXApiDelegate protocol

description

wechat description

Return Value

YES if appId and wxDelegate are invalid.

Declared In

MaxLeapPay.h

+ startPayment:completion:

Start the payment. After transaction completion, the block will be execute on main thread and bring the result. You can check result.code to find out whether the transaction success or not.

+ (void)startPayment:(MLPayment *)payment completion:(MLPayResultBlock)block

Parameters

payment

The payment must be properly configured.

block

Block to execute after transaction finish. It should have the following signature:(MLPayResult *result)

Declared In

MaxLeapPay.h

+ handleOpenUrl:completion:

Some channel(eg. alipayapp) will open their official app to process the transaction. After the transaction finish, their official app will inform the transaction result by openURL: So, it is important for you to call this method in application:openURL:sourceApplication:annotation: or application:openURL:options:.

+ (BOOL)handleOpenUrl:(NSURL *)URL completion:(MLPayResultBlock)block

Parameters

URL

The url passed in by application:openURL:xxx.

block

If your app is killed after opening another app to process the transaction, the block will be executed on main queue.

Return Value

Whether the URL can be handled.

Declared In

MaxLeapPay.h

+ handleWXPayResponse:

Handle the wechat pay response to complete the wechat pay process.

+ (void)handleWXPayResponse:(PayResp *)response

Parameters

response

The PayResp received in WXApiDelegate method ‘onResp:’.

Discussion

This method result in a MLUser logging in or creating. And then the block in method startPayment:completion: will be excuted on main thread. You should call this method when receive the SendAuthResp response.

Declared In

MaxLeapPay.h

+ queryOrderWithBillNo:andChannel:block:

Fetch the order infomation.

+ (void)queryOrderWithBillNo:(NSString *)billNo andChannel:(MLPayChannel)channel block:(MLOrderResultBlock)block

Parameters

billNo

The billNo of the order to query.

channel

The channel of the order.

block

Block callback to bring the query result. It should have the following signature: (MLOrder order, NSError error).

Discussion

This api can be used to verify the authenticity of a transaction by check status of the order. The valid order status is pay.

Declared In

MaxLeapPay.h

+ queryOrderWithBillNo:block:

Query orders with the billNo.

+ (void)queryOrderWithBillNo:(NSString *)billNo block:(MLArrayResultBlock)block

Parameters

billNo

The billNo of the order to query.

block

Block callback to bring the query result. It should have the following signature: (NSArray MLOrder> orderList, NSError *error).

Discussion

Orders in different channel may have the same bill No. This api can be used to verify the authenticity of a transaction by check status of the order. The valid order status is pay.

Declared In

MaxLeapPay.h