Giter VIP home page Giter VIP logo

openpay-swift-ios's Introduction

Openpay iOS

iOS swift library for tokenizing credit/debit card and collect device information

Current version: v2.0.0

Looking for Objective-C Version? Checkout: (https://github.com/open-pay/openpay-ios)

Please refer to the following documentation sections for field documentation:

Requirements

  • iOS SDK 10.3+
  • ARC
  • WebKit.framework

Installation

  • Download the latest released version (SDK-v2.0.0.zip).
  • Add openpay framework (openpay-v2.0.0.framework) to General -> Linked Framework and Libraries.
  • Add openpay framework (openpay-v2.0.0.framework) to General -> Embeded Binaries.
  • Add webkit framework to Build Phases -> Link Binary With Libraries.

Usage

import Openpay

Create a instance object

For create an instance Openpay needs:

  • MerchantId
  • Public API Key
let openpay = Openpay(withMerchantId: "Your Merchant ID",
							   andApiKey: "Your Private Key",
						isProductionMode: false,
						         isDebug: false)

Production Mode

Use isProductionMode = true

let openpay = Openpay(withMerchantId: "Your Merchant ID",
							   andApiKey: "Your Private Key",
						isProductionMode: true,
						         isDebug: false)

Create a SessionID

The framework contains a function for generate a device sessionID. The following parameters are required: -Function to call when SessionID is generated -Function to call when error occurs

let openpay = Openpay(withMerchantId: "Your Merchant ID",
							   andApiKey: "Your Private Key",
						isProductionMode: true,
						         isDebug: false)

openpay.createDeviceSessionId(successFunction: successSessionID,
							  failureFunction: failSessionID)

Display Card Form

The framework contains a form for the user directly capture his card's minimum required data. For display the form you need to pass the following parameters: -Current UIViewController -Function to call when capture ends -Function to call when error occurs -The title to display at the top of form

openpay.loadCardForm(in: self,
		successFunction: successCard,
		failureFunction: failCard,
			  formTitle: "Openpay")

Create a token

For more information about how to create a token, please refer to [Create a token] (http://www.openpay.mx/docs/api/#crear-un-nuevo-token)

With only required fields captured by the user
let openpay = Openpay(withMerchantId: "Your Merchant ID",
							   andApiKey: "Your Private Key",
						isProductionMode: true,
						         isDebug: false)

openpay.loadCardForm(in: self,
		successFunction: successCard,
		failureFunction: failCard,
			  formTitle: "Openpay")

openpay.createTokenWithCard(address: nil,
					successFunction: successToken,
					failureFunction: failToken)
Response

If the request is correct, return an instance of OPToken.

openpay-swift-ios's People

Contributors

igrijalva avatar hugohernandez avatar astrocumbia avatar rbccavalcanti avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  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.