PaymentEngineAPIDelegate

transactionComplete

-(void)transactionComplete :(PaymentEngineTransactionResponse *)transResponse;

This method is called when a transaction has completed processing: it will be called for all errors, declines or approvals. This is a required delegate method. The delegate method needs to be implemented when user starts a transaction using the middleware. See PaymentEngineTransactionResponse for a complete list fields that get returned.

Example: Extracting the RefNum from transactionComplete

The RefNum is needed if you are going to adjust/void the transaction.

-(void)transactionComplete :(PaymentEngineTransactionResponse *)transResponse
{
     NSLog(@"refNum: %@", transResponse.RefNum);
}

captureSignatureComplete

-(void)captureSignatureComplete :(PaymentEngineTransactionResponse *)transResponse   

This delegate method needs to be implemented when the captureSignature method is used to capture a signature. Read PaymentEngineTransactionResponse for a complete list of returned fields.

Example

-(void)captureSignaureMethod
{
    PaymentEngineAPICom *apiCom = [PaymentEngineAPICom getInstance];
    apiCom.delegate = self;

    UIImage *signatureImg = [UIImage imageNamed:@"signatureImg.png"];
    NSData *imgData = UIImageJPEGRepresentation(signatureImg, 0.5f);
    NSString *imgBase64 = [imgData base64EncodedStringWithOptions:0];

    NSMutableDictionary *transDict = [NSMutableDictionary new];

    [transDict setObject:imgBase64 forKey:@"signature"];
    [transDict setObject:@"1296965885" forKey:@"refNum"];
    [transDict setObject:@"12.01" forKey:@"amount"];
    [transDict setObject:@"capture" forKey:@"command"];

    [apiCom captureSignature:transDict];
}

-(void)captureSignatureComplete :(PaymentEngineTransactionResponse *)transResponse
{
    NSLog(@"signature captured:%@ ", transResponse.Status);
    NSLog(@"signature error reason: %@", transResponse.Error);

}