Alipay+ DocsAlipay+ Docs

decode

In entry code scenarios, Alipay+ stores the payment information as a code value. The Alipay+ client SDK calls the decode API to send the code value to the Mobile Payment Provider (MPP). The MPP can then call the server API userInitiatedPay to decode the code value and obtain the payment information.

Note: For entry codes to work, the MPP must implement the decode API.

Method signature

copy
NS_ASSUME_NONNULL_BEGIN
@protocol MPPAlipayPlusClientMPMProtocol <NSObject>
- (void)decode:(MPPDecodeServiceParams *)params
    payCompletionHandler:(void(^)(MPPDecodeServiceResult *_Nullable result, NSError * _Nullable error))payCompletionHandler;
@end
NS_ASSUME_NONNULL_END

Request parameters

Item

Type

Description

Required

params

MPPDecodeServiceParams

The parameters that are required to obtain the order information.

M

payCompletionHandler

iOS Block

The callback to be invoked after the decoding process ends. See payCompletionHandler or details.

M

payCompletionHandler

Item

Type

Description

Required

result

MPPDecodeServiceResult

The result information that is required if the decoding is successful.

O

Response parameters

N/A

Sample

Definition of YOUR_MPM_SERVICE_CLASS:

copy
#import <MPPAlipayPlusClientMPM/MPPAlipayPlusClientMPM.h>

@interface YOUR_MPM_SERVICE_CLASS: NSObject <MPPAlipayPlusClientMPMProtocol>
- (void)decode:(MPPDecodeServiceParams *)params
    payCompletionHandler:(void(^)(MPPDecodeServiceResult *_Nullable result, NSError * _Nullable error))payCompletionHandler;
@end

@implementation YOUR_MPM_SERVICE_CLASS

- (void)decode:(MPPDecodeServiceParams *)params
    payCompletionHandler:(void(^)(MPPDecodeServiceResult *_Nullable result, NSError * _Nullable error))payCompletionHandler; {
 // Invoke the cashier after receiving the request from Alipay+
 payCompletionHandler(result, nil); //Payment success
 }
@end

Instance of YOUR_MPM_SERVICE_CLASS:

copy
#import <MPPAlipayPlusClientMPM/MPPAlipayPlusClientMPM.h>

[MPPAlipayPlustClient shared].mpmService = YOUR_MPM_SERVICE_CLASS.new