iOS SDK - Decoder Module
DOCS
Last updated: Aug 15th, 6:14am
Use the endpoints of this module to activate the device camera to scan a QR Code and render its checkout token value.
Initialize Decoder Facade
Prior to invoking any decoder module endpoints:
- Create a new request object for the relevant coordinator.
- Implement the delegate for the coordinator to handle responses.
1PDDecoderCoordinator *decoderCoordinator=[[PDDecoderCoordinator alloc] init];2if(self.decoderCoordinator == nil){3self.decoderCoordinator = [[PDDecoderCoordinator alloc] init];4self.decoderCoordinator.decoderDelegate = self;5}
Set Optional Decoder Properties
Sets any of the following properties during module initialization to fine tune the app's decoding behavior, as needed.
[self.decoderCoordinator set<property>:<property-value>];
Property | Description |
---|---|
playSoundFilePath | Specifies the device location of an audio file to play upon successful capture of the token. |
decoderReaderType | Specifies whether the scanner is enabled to read only QR Codes (FALSE ) or to read and differentiate between both QR Codes and bar codes (TRUE ). The default value is FALSE in order to maximize performance and because multi-code recognition is typically not applicable to WLW mobile wallet usage. |
formatOfQRCode | Specify which type of QR Code the decoder should expect. Valid values are:kPDQRCodeFormatAll kPDQRCodeFormatQR kPDQRCodeFormatQRVersion1 kPDQRCodeFormatQR11 kPDQRCodeFormatNone The default value of kPDQRCodeFormatQRVersion1 is the code format generated by WLW's transaction manager. |
startDecoderSession
Activates the camera and begins scanning for a relevant QR Code.
Element | Value |
---|---|
Method Signature | -(void)startDecoderSession:(UIView *)cameraView frameRect:(CGRect)paramFrameRect; cameraView - The coordinates of the screen representing the center of the camera's focus. For example, 0,34 indicates the horizontal center of the screen, 34 pixels from the top.paramFrameRect - The dimensions of the space on which the camera should focus in order to scan the image. For example, a value of 320, 401 indicates a rectangle 320 pixels high by 401 pixels long. |
Returns | This method does not return a response. |
decodeImage
Converts a scanned image into a checkout token value representing an active WLW transaction.
Element | Value |
---|---|
Method Signature | -(void)decodeImage:(RawImage *)rawImage; rawImage - The coded data representing the scanned image. |
Success | -(void) didFinishImage:(UIImage *)image decoding:(NSString *)qrCode; image - The original value that was passed which represents the raw image.qrCode - The decoded value of the checkout token needed for the RTMD(DISCOVERY) call to initiate the transaction. |
Failure | didFailDecoding(PDDecoderCoordinator *)decoderCoordinator; The token was not able to be decoded. initializingDecoderFailedWithError:(NSError *)error; - The decoder service could not be reached. |
Configure User Error messages for this call with the key kUserErrorDecoderControllerDomain
.
Error | Description |
---|---|
400 | The specified value is not a valid checkout token. |
500 | An unknown error occurred internally in the server. |
endDecoderSession
Releases the app's use of the camera session.
Element | Value |
---|---|
Method Signature | -(void)endDecoderSession; |
Returns | This method does not return a response. |