AMSPaymentProtocol
Callback protocol for payment or card binding processes. This protocol defines callback methods for payment and card binding lifecycle events. All methods are optional. To receive these callbacks, set the paymentDelegate property on AMSPaymentElement.shared or AMSVaultElement.shared.
Declaration
@protocol AMSPaymentProtocol <NSObject>
@optional
- (void)onLaunch;
- (void)onReady;
- (void)onEventCallback:(NSString * _Nonnull)eventCode
eventResult:(AMSEventResult * _Nonnull)eventResult;
- (void)onSizeChanged:(CGFloat)width
height:(CGFloat)height;
- (void)onBeforeSubmit:(NSDictionary * _Nullable)paymentInfo
completion:(void (^)(AMSResultInfo * _Nonnull))completion;
- (void)onSubmitPayCallback:(AMSStatusResult * _Nullable)eventResult;
@endCallback methods
onLaunch()
Called when SDK initialization is completed.
- (void)onLaunch;onReady()
Called when list data rendering is completed and buyers can start interacting.
- (void)onReady;onEventCallback()
Called when internal SDK events occur.
- (void)onEventCallback:(NSString * _Nonnull)eventCode
eventResult:(AMSEventResult * _Nonnull)eventResult;Parameter | Type | Required | Description |
eventCode | String | Yes | Event code, identifying the event type. |
eventResult | Yes | Event result. |
onSizeChanged()
Called when component size changes.
- (void)onSizeChanged:(CGFloat)width
height:(CGFloat)height;Parameter | Type | Required | Description |
width | CGFloat | Yes | Component‘s new width. |
height | CGFloat | Yes | Component‘s new height. |
onBeforeSubmit()
Custom processing callback before payment submission or card binding. Merchants can modify payment or card binding parameters or decide whether to continue submission in this callback.
- (void)onBeforeSubmit:(NSDictionary * _Nullable)paymentInfo
completion:(void (^)(AMSResultInfo * _Nonnull))completion;Parameter | Type | Required | Description |
paymentInfo | [AnyHashable: Any]? | Yes | Payment or card binding information to be processed. |
completion | (AMSResultInfo) -> Void | Yes | Control the payment or card binding process through |
onSubmitPayCallback()
Result callback after submitting payment or card binding.
- (void)onSubmitPayCallback:(AMSStatusResult * _Nullable)eventResult;Parameter | Type | Required | Description |
eventResult | Yes | Submission result, including status code or error information. |