You need to provide UI for signature capture. The SDK tells you which method to show in the actionRequired
block.
actionRequired:^(MPTransactionProcess *process, MPTransaction *transaction, MPTransactionAction action, MPTransactionActionSupport *support) { switch (action) { case MPTransactionActionCustomerSignature: { NSLog(@"show a UI that let's the customer provide his/her signature!"); // In a live app, this image comes from your signature screen UIGraphicsBeginImageContext(CGSizeMake(1, 1)); UIImage *capturedSignature = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [process continueWithCustomerSignature:capturedSignature verified:YES]; break; } case MPTransactionActionCustomerIdentification: { // always return NO here [process continueWithCustomerIdentityVerified:NO]; break; } default: { break; } } }
Signature
The merchant hands the device to the customer. The customer either signs and accepts, or cancels. Then, the merchant compares the signature on the screen and on the card. We provide an open source signature screen. Once you have the signature, continue the transaction:
[process continueWithCustomerSignature:capturedSignature verified:YES];
Make sure to add a cancel button to enable the shopper to abort the transaction. If he presses cancel, continue the transaction like this:
[process continueWithCustomerSignature:nil verified:NO];
You need to provide UI for signature capture. The SDK tells you which method to show by calling onCustomerSignatureRequired
or onCustomerVerificationRequired
on your TransactionProcessListener
:
@Override public void onCustomerSignatureRequired(TransactionProcess process, Transaction transaction) { // in a live app, this image comes from your signature screen Bitmap.Config conf = Bitmap.Config.ARGB_8888; Bitmap bm = Bitmap.createBitmap(1, 1, conf); // Submit the signature digitally as part of the transaction byte[] signature = SignatureHelper.byteArrayFromBitmap(bm); process.continueWithCustomerSignature(signature, true); // Or alternatively if you would like to collect the signature on the printed receipt // process.continueWithCustomerSignatureOnReceipt(); } @Override public void onCustomerVerificationRequired(TransactionProcess process, Transaction transaction) { // always return false here process.continueWithCustomerIdentityVerified(false); } }
The SDK will compress each signature image that you will send. To avoid errors during the compression process because of extremely large signature images or unsupported image formats we recommend the submitted signature images to follow these guidelines:
- Dimensions similar to the target image size of 960x720 pixels
- JPEG or PNG as image format
- Grayscale image
Signature
The merchant hands the device to the customer. The customer either signs and accepts, or cancels. Then, the merchant compares the signature on the screen and on the card and compares them.