/TBPagarME

Facilitador do gateway de pagamento pagar.me

Primary LanguageSwiftMIT LicenseMIT

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.