Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

tiagobbraga/TBPagarME

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TBPagarME

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

TBPagarME is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TBPagarME"

Init

Store initial keys

// https://dashboard.pagar.me/#/myaccount/apikeys
TBPagarME.storeKeys(apiKey: "api_key", encryptionKey: "credential_key")

Transaction

Pay

let pagarME = TBPagarME.sharedInstance
        
// card
pagarME.card.cardNumber = "xxxxxxxxxxxxxxxx"
pagarME.card.cardHolderName = "Name Owner Card"
pagarME.card.cardExpirationMonth = "12"
pagarME.card.cardExpirationYear = "17"
pagarME.card.cardCVV = "111"

// customer
pagarME.customer.name = "Onwer Card"
pagarME.customer.document_number = "09809889011"
pagarME.customer.email = "owner@card.com"
pagarME.customer.street = "Street"
pagarME.customer.neighborhood = "Neightborhood"
pagarME.customer.zipcode = "00000"
pagarME.customer.street_number = "1"
pagarME.customer.complementary = "Apt 805"
pagarME.customer.ddd = "031"
pagarME.customer.number = "986932196"

TBPagarME.sharedInstance.transaction("1000", success: { (data) in
    print("data transaction \(data)")
})
{ (message) in
    print("error message \(message)")
}

//get card_hash
TBPagarME.sharedInstance.generateCardHash(success: { (card_hash) in
    debugPrint("card_hash: \(card_hash)")
    
}) { (message) in
    debugPrint("error: \(message)")
}

Author

Tiago Braga, contato@tiagobraga.cc

License

TBPagarME is available under the MIT license. See the LICENSE file for more info.