iOS SDK - Push Notification Management Module
Use the endpoints of this module to enable delivery of alert messages - such as available app updates, new offers, upcoming deadlines, new store locations, etc. - from the mobile app to the device, even when the app is not active.
Note: When implementing push notifications, ensure the app listens for iOS events related to changes to the user's push notification settings. If a user disables notifications for the app, invoke
Unregister
. If the user re-enables notifications, invokeRegister
. Also, when a user re-links a previously unlinked device or links a new device to an existing account, the app must prompt the user to enable push notifications again.
Initialize Push Notification Management Facade
Prior to invoking any push notification management module endpoints:
- Create a new request object for the relevant coordinator.
- Implement the delegate for the coordinator to handle responses.
PDPushNotificationCoordinator *coordinator = [[PDPushNotificationCoordinator alloc] init];
self.PushNotificationCoordinator = coordinator;
[coordinator release];
isDeviceRegisteredForPushNotifications
Checks whether the wallet owner has agreed to receive device alerts from the Paydiant platform.
Element | Value |
---|---|
Method Signature | -(void)isDeviceRegisteredForPushNotifications; |
Success | void (^isDeviceRegisteredForPushNotificationsCompletionBlock(BOOL isRegistered); isRegistered - Indicates whether Paydiant has obtained a device token signaling user consent for push notifications. Valid values are:Yes - Paydiant has a valid device token.No - Paydiant has no device token. Invoke registration. |
Failure | void (^isDeviceRegisteredForPushNotificationsFailureBlock)( PDPaydiantError *pushNotificationManagementError); |
Configure user error messages for this call with the key kUserErrorisDeviceRegisteredForPushNotificationsDomain
.
Error | Description |
---|---|
403 |
The user must be logged in to make this call. |
500 |
An unknown error occurred internally in the server. |
registerDeviceForPushNotifications
Captures and store the device token generated when the user consents to receive push notifications from Paydiant.
Element | Value |
---|---|
Method Signature | -(void)registerDeviceForPushNotifications:(NSString *)deviceToken; deviceToken - The value of the iOS-generated token signaling the user's consent to receive push notifications from Paydiant. |
Success | void (^RegisterDeviceForPushNotificationsCompletionBlock); |
Failure | void (^RegisterDeviceForPushNotificationsFailureBlock)( PDPaydiantError *pushNotificationManagementError); |
Configure user error messages for this call with the key kUserErrorRegisterDeviceForPushNotificationsDomain
.
Error | Description |
---|---|
400 |
Could not register the device due to invalid arguments in the request. |
403 |
The user must be logged in to make this call. |
500 |
An unknown error occurred internally in the server. |
unregisterDeviceForPushNotifications
Removes the device token that identifies the device as registered to receive push notifications from Paydiant.
Element | Value |
---|---|
Method Signature | -(void)unregisterDeviceForPushNotifications:(); |
Success | void (^UnregisterDeviceForPushNotificationsCompletionBlock)(); |
Failure | void (^UnregisterDeviceForPushNotificationsFailureBlock)( PDPaydiantError *pushNotificationManagementError); |
Configure user error messages for this call with the key kUserErrorUnregisterDeviceForPushNotificationsDomain
.
Error | Description |
---|---|
400 |
Could not unregister the device because it is not registered. |
403 |
The user must be logged in to make this call. |
500 |
An unknown error occurred internally in the server. |