This repository provides a native iOS SDK, which enables to integrate your Mobile App with myPOS Card terminals, processed by its platform, to accept card payments (including but not limited to VISA, Mastercard, UnionPay International, JCB, Bancontact). myPOS SDK iOS communicates transparently to the card terminal(s) via Bluetooth. To process checkout SDK provides management of the terminal to complete all the steps for transaction processing, return or refund, card storage for recurring transactions, and communicates to the application transaction status, card token, card masked PAN.
No sensitive card data is ever passed through to or stored on the merchant's phone. All data is encrypted by the card terminal, which has been fully certified to the highest industry standards (PCI, EMV I & II, Visa, MasterCard & Amex).
- Merchant account on www.myPOS.eu (or received a test account).
- Received myPOS terminal
- Requested Access Developers myPOS site.
- Deployment Target iOS 6.0 or later.
- Xcode 7 and iOS SDK 9 or later.
- iPhone or iPad.
- Add the myPOSService.framework to your Xcode project.
- Link your app against myPOSService.framework.
NSBluetoothPeripheralUsageDescription
#import <myPOSBluetoothSDK/myPOSBluetoothSDK.h>
If you are using swift, you will need to create a bridging header and import the framework there. For more information about bridging headers, please visit Apple's documentation.
##Call the initialization method Call the initialization method while passing the currency for financial operations (purchase, refund, etc.)
[myPOSService startInitializationFromController:self
withCompletion:^(MPPOSDeviceMode posDeviceMode, NSError * _Nullable error) {
}];
myPOSService.startInitialization(from: self) { (posDeviceMode, error) in
}
You can set a custom navigation title in the SDK screens, by using the method below:
[myPOSService setAppName:@"My App Name"];
myPOSService.setAppName("My App Name")
Once initialization is completed, you can start using the myPOS SDK iOS to accept card payments. Host application has to specify amount of the transaction, with automated print of the slip after transaction. A checkout and refund request are generated identiacally by passing an amount, currency, and item name
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)
MPRefundRequest *refundRequest = [MPRefundRequest requestWithTotal:[NSDecimalNumber decimalNumberWithString:@"1.00"]
title:@"Some item"
currency:MPCurrencyEUR];
let refundRequest = MPRefundRequest(total: NSDecimalNumber(string: "1.00"),
title: "Some item",
currency: .EUR)
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
[request setTransactionReference:@"my_transaction_reference"];
request.setTransactionReference("my_transaction_reference")
ith 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
}
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
}
With this method host application could request print of custom receipt..
MPReceiptData *receiptData = [[MPReceiptData alloc] init];
[receiptData addRowWithText:@"Some text"];
[receiptData addEmptyRow];
[receiptData addRowWithText:@"Center text!" aligned:MPReceiptTextAlignCenter withFontSize:MPReceiptTextFontSizeDouble];
[myPOSService printReceipt:receiptData completion:^(NSError * _Nullable error) {
}];
let receiptData = MPReceiptData()
receiptData.addRow(withText: "Normal row")
receiptData.addEmptyRow()
receiptData.addRow(withText: "Center text!", aligned: .center, with: .double)
myPOSService.printReceipt(receiptData) { (error) in
}
With this method host application could request reprint of last transaction slip.
[myPOSService reprintLastReceiptWithCompletion:^(NSError * _Nullable error) {
}];
myPOSService.reprintLastReceipt { (error) in
}
Before using terminal for a first time the SDK has to initiate Terminal activation, which will setup terminal for processing transaction, setting up Terminal ID, Merchant ID etc.
[myPOSService requestActivateTerminalFromController:self withCompletion:^(NSError * _Nullable error) {
}];
myPOSService.requestActivateTerminal(from: self) { (error) in
}
Each time terminal processing transaction, processor host checks for existing pending updates, and inform terminal if any. In that case by this method software update is activated, and terminal is going in the update mode.
[myPOSService requestUpdateTerminalFromController:self withCompletion:^(NSError * _Nullable error) {
}];
myPOSService.requestUpdateTerminal(from: self) { (error) in
}
[myPOSService requestDeactivateTerminalFromController:self withCompletion:^(NSError * _Nullable error) {
}];
myPOSService.requestDeactivateTerminal(from: self) { (error) in
}
You can get/set a default serial number of a myPOS terminal to which to connect upon discovery
[myPOSService defaultSerialNumber];
[myPOSService setDefaultPOSDeviceSerialNumber:@""];
myPOSService.defaultSerialNumber()
myPOSService.setDefaultPOSDeviceSerialNumber("")
You can get/set a prefered language for the POS device screens, by using the method below:
[myPOSService preferredLanguage];
[myPOSService setPreferredLanguage:MPLanguageEnglish];
myPOSService.preferredLanguage()
myPOSService.setPreferredLanguage(.english)
You can get the terminal ID of the connected myPOS device, by using the method below:
[myPOSService terminalId];
myPOSService.terminalId()
You can get the data of the last processed trnasaction on the POS device, by using the method below:
[myPOSService lastTransactionData];
myPOSService.lastTransactionData()
You can check whether the POS device has a printer available.
[myPOSService hasPrinter];
myPOSService.hasPrinter()
You can check whether the there is an active connection to a POS device.
[myPOSService isConnected];
myPOSService.isConnected()