Payment Requests


Once initialization is completed, you can start using the myPOS iOS SDK to accept card payments. Host application has to specify an amount of the transaction, with an automated print of the slip after the transaction. A checkout and refund request are generated identically by passing an amount, currency, and item name.

 

Checkout request


MPCheckoutRequest *checkoutRequest = [MPCheckoutRequest requestWithTotal:[NSDecimalNumber decimalNumberWithString:@"1.00"]
                                                                   title:@"Some item"
                                                                currency:MPCurrencyEUR];
let checkoutRequest = MPCheckoutRequest(total: NSDecimalNumber(string: "1.00"),
                                        title: "Some item",
                                        currency: .EUR)

 

Refund request


MPRefundRequest *refundRequest = [MPRefundRequest requestWithTotal:[NSDecimalNumber decimalNumberWithString:@"1.00"]
                                                             title:@"Some item"
                                                          currency:MPCurrencyEUR];
MPRefundRequest *refundRequest = [MPRefundRequest requestWithTotal:[NSDecimalNumber decimalNumberWithString:@"1.00"]
                                                             title:@"Some item"
                                                          currency:MPCurrencyEUR];

Please note that you need to pass an NSDecimalNumber as the total value. While NSDecimalNumber is a subclass of NSNumber it is not advised to use the convenience method of NSNumber to create an NSDecimalNumber

An optional transaction reference of type NSString can be passed to the request.

[request setTransactionReference:@"my_transaction_reference"];
request.setTransactionReference("my_transaction_reference")

 

Initiate checkout request


With this method host application initates checkout command to th terminal.

[myPOSService checkoutWithRequest:checkoutRequest
               fromViewController:self
                       completion:^(NSError * _Nullable error) {
                           
                       }];
myPOSService.checkout(with: checkoutRequest, from: self) { (error) in
    
}

 

Initiate refund request


With this method host application could initiate refund transaction to the customers’ card account with the specified amount.

[myPOSService requestRefund:refundRequest
         fromViewController:self
                 completion:^(NSError * _Nullable error) {
                     
                 }];
myPOSService.requestRefund(refundRequest, from: self) { (error) in
    
}

 

Reprint last receipt


With this method host application could request reprint of last transaction slip.

[myPOSService reprintLastReceiptWithCompletion:^(NSError * _Nullable error) {
    
}];
myPOSService.reprintLastReceipt { (error) in
    
}