TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Commercial |
ReleasedLast Release | Oct 2015 |
Maintained by Aleksandar Yalnazov.
The iOS/MacOS SDK provides a flexible and easy to integrate payment solution for your iOS/MacOS applications.
Our open source sample / demo app VoucherMill is available for download on the App Store.
In the Honey Store tutorial we show you how to use the iOS SDK together with your backend, enabling returning (1-click) payments. In addition, we integrated the free card.io library for card scanning.
iOS 6.0 or later / OS X 10.6 or later.
Podfile
: pod 'PayMillSDK', '~> 2.2.0'
In cases Cocoapods central repository is not available, you can add folowing line to your Podfile
:
pod 'PayMillSDK', :git=>'https://github.com/paymill/paymill-ios.git', :branch=>'master', :tag=>'2.2.0'
A PMPayment object contains the credit card or bank account information of a customer. A PMPaymentParams object contains the parameters of a payment - amount, currency, description. Both must always be created with the PMFactory class.
Create PMPayment and PMPaymentParams and call PMManager generateTokenWithMethod with your PAYMILL public key and mode.
NSError *error;
PMPaymentParams *params;
id paymentMethod = [PMFactory genCardPaymentWithAccHolder:@"Max Musterman"
cardNumber:@"4711100000000000" expiryMonth:@"12" expiryYear:@"2014"
verification:@"333" error:&error];
if(!error) {
params = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100
description:@"Description" error:&error];
}
if(!error) {
//generate token with PAYMILL public key
[PMManager generateTokenWithPublicKey:myPublicKey testMode:YES
method:paymentMethod parameters:params
success:^(NSString *token) {
//token successfully created
}
failure:^(NSError *error) {
//token generation failed
}];
}
To create transactions and preauthorizations directly from the SDK you first need to install the Mobile App. In the code you will have to initialize the SDK, by calling PMManger initWithTestMode method with your PAYMILL public key and mode.
//init with PAYMILL public key
[PMManager initWithTestMode:YES merchantPublicKey:myPublicKey newDeviceId:nil init:^(BOOL success, NSError *error) {
if(success) {
// init successfull
// start using the SDK
}
}];
NSError *error;
PMPaymentParams *params;
id paymentMethod = [PMFactory genCardPaymentWithAccHolder:@"Max Musterman" cardNumber:@"4711100000000000" expiryMonth:@"12" expiryYear:@"2014"
verification:@"333" error:&error];
if(!error) {
params = [PMFactory genPaymentParamsWithCurrency:@"EUR" amount:100 description:@"Description" error:&error];
}
if(!error) {
[PMManager transactionWithMethod:paymentMethod parameters:params consumable:TRUE success:^(PMTransaction *transaction) {
// transaction successfully created
}
failure:^(NSError *error) {
// transaction creation failed
}];
}