Giter Club home page Giter Club logo

paymill-ios's Introduction

PAYMILL icon

PAYMILL iOS/MacOS SDK

The iOS/MacOS SDK provides a flexible and easy to integrate payment solution for your iOS/MacOS applications.

Sample App for iOS

View our open source sample / demo app VoucherMill.

Tutorial

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.

Getting started

  • Start with the SDK guide.
  • Install the latest release.
  • If you want to create transaction and preauthorizations directly from within your app, install the PAYMILL mobile app.
  • Check the sample / demo app VoucherMill for a showcase and stylable payment screens.
  • Check the full API documentation.

Requirements

iOS 6.0 or later / OS X 10.6 or later.

Installation

  • Xcode users add 'PayMillSDK' folder to their project.
  • CocoaPods users add this dependency to their 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'

Working with the SDK

PMPayment, PMParams and PMFactory

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.

Generate a token

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
		}];
	}   

Create a transaction

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  
     }];  
 }     

Release notes

###2.2.0

  • iOS8 supoort added

###2.1.1

  • Bug fixes

###2.1.0

  • Added new methods to create transactions and preauthorizations with a payment object.
  • Added a Safe Store to securely save payment objects with a user password.

###2.0.3

  • Bug fixes

###2.0.2

  • Mandatory changes in infrastructure
  • Bug fixes

###2.0.1

  • MacOS Support
  • Bug fixes

2.0.0

  • Added new method to generate Payments using IBAN and BIC in the PMFactory.
  • Added new methods to generate token without amount and currency in the PMFactory.
  • All failure callbacks are now returning NSError instead PMError. Check PMError.h to see returned error codes.
  • Improved error handling. BRIDGE error type added in PMError. You can use this to give the user concrete information, why his card is rejected.
  • ARM 64 support

1.0.3

  • PMErrorType documented
  • Bug fixes

1.0.2

  • Bridge error response fixed
  • Credit card holder issue fixed
  • Appledoc improved

1.0.1

  • Typos in headers and appledoc fixed
  • Linkage issue fixed

1.0

  • First live release.
  • Added the possiblity to generate tokens without initializing the SDK. The method can be used exactly like the JS-Bridge and does not require extra activation for mobile.
  • Added getVersion for the SDK.
  • Bug fixes

paymill-ios's People

Contributors

yalnazov avatar stoilkov avatar tomoff avatar nikoloff avatar pm-alexander-serbe avatar tanguygo avatar galche avatar

Watchers

James Cloos avatar Christoph Kieslich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.