Latest 0.3.0
License MIT
Platforms ios 7.0, requires ARC
Dependencies AFNetworking, PromiseKit, RegexKitLite


A simple lib for easy integration of your mobile app with the payment services
provided by Gerencianet.

warning: This module is under development and is based on the new API that Gerencianet is about to release. It won’t work in production by now.

Build Status
Coverage Status
Pod version


  • iOS 7.0+
  • ARC



Via CocoaPods:

pod 'GNApi-Sdk-iOS', '~> 0.3'

Direct download:

Drag the GNApiSdk/ folder to you project and install dependencies.


Import the sdk header file with #import "GNApiSdk.h" or #import <GNApi-Sdk-iOS/GNApiSdk.h> if you are using CocoaPods.

Instantiate a GNConfig object defining your account code. If you’re in development phase, set the sandbox flag to YES:

GNConfig *gnConfig = [[GNConfig alloc] initWithAccountCode:@"YOUR_ACCOUNT_CODE" sandbox:YES];

Create an GNApiEndpoints instance passing your GNConfig:

GNApiEndpoints *gnApi = [[GNApiEndpoints alloc] initWithConfig:gnConfig];

To receive a payment token you need to create a GNCreditCard object and call paymentTokenForCreditCard: or paymentTokenForCreditCard:completion::

GNCreditCard *creditCard = [[GNCreditCard alloc] init];
creditCard.number = @"4012001038443335";
creditCard.brand = kGNMethodBrandVisa;
creditCard.expirationMonth = @"05";
creditCard.expirationYear = @"2018";
creditCard.cvv = @"123";

[gnApi paymentTokenForCreditCard:creditCard]
.then(^(GNPaymentToken *paymentToken){
NSLog(@"%@", paymentToken.token);
.catch(^(GNError *error){
NSLog(@"An error occurred: %@", error.message);

GNApiEndpoints methods always returns a promise object provided by PromiseKit library.

You can also get the installments before getting the payment token.
All you need is the total amount and the method brand:

// The following code will fetch installments for a total of R$10,00 with MasterCard card brand.
GNMethod *method = [[GNMethod alloc] initWithBrand:kGNMethodBrandMasterCard total:@(1000)];
[_gnApi fetchInstallmentsWithMethod:method]
.then(^(GNPaymentData *paymentData){
NSLog(@"%@", paymentData);
.catch(^(GNError *error){
NSLog(@"An error occurred: %@", error.message);

If you want to get the payment data for a banking billet instead of a credit card you just need to init the GNMethod object with the brand kGNMethodBrandBankingBillet.

The available method brands are defined in the following constants:

  • kGNMethodBrandVisa
  • kGNMethodBrandMasterCard
  • kGNMethodBrandAmex
  • kGNMethodBrandDiners
  • kGNMethodBrandDiscover
  • kGNMethodBrandJCB
  • kGNMethodBrandElo
  • kGNMethodBrandAura
  • kGNMethodBrandBankingBillet

This project already includes a sample application.
To use it just clone this repo, install dependencies with pod install and open with Xcode. The example requires you to provide your account code.



Latest podspec

    "name": "GNApi-Sdk-iOS",
    "version": "0.3.0",
    "summary": "A simple lib for easy integration of your mobile app with the payment services provided by Gerencianet.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "thomazfeitoza": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.3.0"
    "source_files": [
    "requires_arc": true,
    "platforms": {
        "ios": "7.0"
    "dependencies": {
        "AFNetworking": [
        "PromiseKit": [
            "~> 1.5"
        "RegexKitLite": []

Pin It on Pinterest

Share This