Git Product home page Git Product logo

braspag's Introduction

Brapag PHP Library

Welcome

Braspag for PHP aims to make life easier for developers who need to use a Brazillian gateway called Braspag via WebService. Currently the library is only implemented with transactions via credit cards. Feedbacks and collaborations will be highly appreciated.

Usage example

Authorize and capture payment:

<?php

//Import Braspag library
require_once 'Braspag.php';

$Braspag = new Braspag('homologation');

///////////////
//Customer
///////////////
$Customer = new BraspagCustomerData();
$Customer->setName('Robson Morais');
$Customer->setID('1001');
$Customer->setEmail('[email protected]');

//Customer address (optional)
$AddressData = new BraspagAddressData();
$AddressData->Street = 'Blvd. 28 de Setembro';
$AddressData->Number = '389';
$AddressData->Complement = 'Sala 512';
$AddressData->District = 'Vila Isabel';
$AddressData->City = 'Rio de Janeiro';
$AddressData->State = 'RJ';
$AddressData->ZipCode = '20551030';
$AddressData->Country = 'BR';

//Set address data is optional
$Customer->setAddressData($AddressData);
$Customer->setDeliveryAddressData($AddressData);

///////////////
//Credit card
///////////////
$CreditCard = new BraspagCreditCardModel();

//Capture transaction after authorization
$CreditCard->setTransactionType(BraspagCreditCardModel::TRANSACTION_TYPE_AUTOCAPTURE);

//Testing
$CreditCard->setMethod(BraspagCreditCardModel::METHOD_HOMOLOGATION);

//Order and payment info
$CreditCard->setOrderId('3598754');
$CreditCard->setCardNumber('0000000000000001');
$CreditCard->setCardHolder("ROBSON M SANTOS");
$CreditCard->setCardExpirationDate('06', '2015');
$CreditCard->setCardSecurityCode('345');
$CreditCard->setCurrency('BRL');
$CreditCard->setCountry('BRA');
$CreditCard->setAmount(1500);
$CreditCard->setPaymentPlan(BraspagCreditCardModel::PAYMENT_PLAN_FINANCED_STORE);
$CreditCard->setNumberOfPayments(3);
$CreditCard->setSaveCreditCard(true);

//Execute transaction
$response = $Braspag->authorizeCreditCardTransaction($CreditCard, $Customer);

//Echoes result
$Braspag->dump($response);

?>

License

Except as otherwise noted, the Braspag for PHP is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

braspag's People

Contributors

carneiro avatar gabrielsme avatar

Stargazers

Daniel Hernandes avatar Gleidson Brito avatar Lucas Pirola avatar Júlio César Gonçalves de Oliveira avatar Gabriel Koerich avatar  avatar Mário Mello avatar Fernando Dias avatar Fabio Ribeiro avatar felipe bastos avatar Raffael Tancman avatar

Watchers

 avatar Júlio César Gonçalves de Oliveira avatar James Cloos avatar  avatar Robson Morais Santos avatar Leandro Galuzzi avatar Fabrício Morais avatar Bruno Alves avatar

braspag's Issues

Informações sobre a biblioteca

Bom dia, Carneiro. Tudo bem?

A sua biblioteca tem mais de 5 anos. Ela ainda é válida se usarmos hoje (2021) em nossas aplicações? Pois de todas que procuramos, a sua parece ser a mais fácil de usar.

Obrigado!

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.