showAuthPage
The Alipay+ client SDK calls the showAuthPage API to display the authorization page for the user to proceed with the authorization.
Method signature
copy
NS_ASSUME_NONNULL_BEGIN
@protocol MPPAlipayPlusClientAutoDebitProtocol <NSObject>
- (void)showAuthPage:(MPPSignContractOAuthServiceParams *)params
completionHandler:(void(^)(MPPSignContractOAuthServiceResult * _Nullable result, NSError * _Nullable error))completionHandler;
@end
NS_ASSUME_NONNULL_END
Request parameters
Item | Type | Description | Required |
params | Parameters that are required to render the authorization page. | M | |
completionHandler | iOS block | The callback to be invoked after the authorization process ends. See completionHandler for details. | M |
completionHandler
Item | Type | Description | Required |
result | The authorization information that is required if the authorization is successful. | O | |
error | NSError | The error that is required if the authorization fails. | O |
Response parameters
N/A
Sample
Definition of YOUR_AUTODEBIT_SERVICE_CLASS:
copy
@interface YOUR_AUTODEBIT_SERVICE_CLASS: NSObject <MPPAlipayPlusClientAutoDebitProtocol>
- (void)showAuthPageWithParams:(MPPSignContractOAuthServiceParams *)params
completionHandler:(void(^)(MPPSignContractOAuthServiceResult * _Nullable result, NSError * _Nullable error))callback;
@end
@implementation YOUR_AUTODEBIT_SERVICE_CLASS
- (void)showAuthPageWithParams:(MPPSignContractOAuthServiceParams *)params
completionHandler:(void(^)(MPPSignContractOAuthServiceResult * _Nullable result, NSError * _Nullable error))callback; {
//Open the authUrl
//Callback when user confirms authorization
callback(result, nil);
}
@end
Instance of YOUR_AUTODEBIT_SERVICE_CLASS:
copy
#import <MPPAlipayPlusClientAutoDebit/MPPAlipayPlusClientAutoDebit.h>
[AlipayPlustClient shared].autoDebitService = YOUR_AUTODEBIT_SERVICE_CLASS.new