PHP code example of paggcerto / paggcerto-sdk-php
1. Go to this page and download the library: Download paggcerto/paggcerto-sdk-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
paggcerto / paggcerto-sdk-php example snippets
composer
use Paggcerto\Auth;
use Paggcerto\Auth\NoAuth;
$endpoint = "prod";
$paggcerto = new Paggcerto(new NoAuth, $endpoint);
use Paggcerto\Auth;
use Paggcerto\Auth\Auth;
$endpoint = "prod";
$user = "[email protected] ";
$password = "12345678";
$appId = "LkD";
$paggcerto = new Paggcerto(new Auth($user, $password, $appId), $endpoint);
use Paggcerto\Auth;
use Paggcerto\Auth\Auth;
$endpoint = "prod";
$hash = "Ehjikkja585569779efwrf.ihuheyvvc872622791ndbdehv";
$appId = "LkD";
$paggcerto = new Paggcerto(new AuthHash($hash, $appId), $endpoint);
$holder = $paggcerto->account()
->setHolderFullName("Mariana Fulano de Tal")
->setHolderBirthDate("1995-01-18")
->setHolderGender("F")
->setHolderTaxDocument("927.228.895-95")
->setHolderPhone("(79) 2946-7954")
->setHolderMobile("(79) 99999-9999")
->setCompanyTradeName("Esportes ME")
->setCompanyFullName("Mariana e Emanuelly Esportes ME")
->setCompanyTaxDocument("94.467.995/0001-49")
->setBusinessTypeId("vL")
->setAddressCityCode("2800308")
->setAddressDistrict("Farolândia")
->setAddressLine1("Rua Silvio do Espírito Santos Seixas")
->setAddressLine2("Ap 001, Cleveland House")
->setAddressStreetNumber("92")
->setAddressZipCode("49030-423")
->setBankAccountBankNumber("001")
->setBankAccountNumber("31232156132-12")
->setBankAccountBranchNumber("0031")
->setBankAccountVariation("001")
->setBankAccountType("corrente")
->setBankAccountIsJuridic(true)
->setUserEmail("[email protected] ")
->setUserPassword("12345678")
->setBusinessActivityId("MA")
->setMarketingMediaId("k5")
->setTransferPlanDays(32)
->setTransferPlanAnticipated(true)
->setMothersName("Mothers Name")
->createHolderAccount();
print_r($holder);
$presetsHolder = $paggcerto->account()
->setUserPassword("12345678")
->setPhone("(79) 2946-7954")
->setMobile("(79) 99999-9999")
->setComercialName("Esporte e CIA")
->setSoftDescriptor("Esportes ME")
->setTransferPlanDays(32)
->setTransferPlanAnticipated(true)
->setBankAccountBankNumber("001")
->setBankAccountNumber("31232156132-12")
->setBankAccountBranchNumber("0031")
->setBankAccountVariation("001")
->setBankAccountType("corrente")
->setBankAccountIsJuridic(true)
->setAddressCityCode("2800308")
->setAddressDistrict("Farolândia")
->setAddressLine1("Rua Silvio do Espírito Santos Seixas")
->setAddressLine2("Ap 001, Cleveland House")
->setAddressStreetNumber("92")
->setAddressZipCode("49030-423")
->setMothersName("Mothers Name")
->setupHolderAccount();
$this->assertTrue(true);
$presets = $paggcerto->account()->getSetupHolderAccount();
print_r($presets);
$businessTypes = $paggcerto->businessType()->getRequest();
print_r($businessTypes);
$cities = $paggcerto->city()->getRequest(["SE"]);
print_r($cities);
$banks = $paggcerto->bank()->getRequest();
print_r($banks);
$businessActivities = $paggcerto->businessActivity()->getRequest();
print_r($businessActivities);
$marketingMedias = $paggcerto->marketingMedia()->getRequest();
print_r($marketingMedias);
$paggcerto = new Paggcerto(new Auth("[email protected] ", "12345678", "applicationId"));
$paggcerto = new Paggcerto(new AuthHash("ZAyCNFfbBWp1wYTB6OJx2e1sd45156d4fewfcdsvcd454"));
$paggcerto = new Paggcerto(new AuthHashByPartner("holderId"));
$paggcerto = new Paggcerto(new NoAuth());
$createdRole = $paggcerto->role()
->setName("Administrador")
->createRole();
print_r($createdRole);
$updatedRole = $paggcerto->role()
->setName("Admin Update Test")
->setActive(true)
->setRoleId("a0b1")
->updateRole();
print_r($updatedRole);
$list = $paggcerto->role()
->rolesList();
print_r($list);
$listWithFilters = $paggcerto->role()
->setLength(2)
->setIndex(2)
->rolesList();
print_r($listWithFilters);
$search = $paggcerto->role()
->setRoleId("a0b1")
->searchRole();
print_r($search);
$deactivate = $paggcerto->role()
->setRoleId("a0b1")
->deactivateRole();
print_r($deactivate);
$activate = $paggcerto->role()
->setRoleId("a0b1")
->activateRole();
print_r($activate);
$delete = $paggcerto->role()
->setRoleId("a0b1")
->deleteRole();
print_r($delete);
$paggcerto->roleConcept()
->setRoleId("a0b1")
->setScopes(["account.users.edit", "account.users.readonly"])
->roleGrantPermission();
$paggcerto->roleConcept()
->setRoleId("a0b1")
->setScopes(["account.users.edit", "account.users.readonly"])
->roleRevokePermission();
$createdUser = $paggcerto->user()
->setRoleId("a0b1")
->setFullName("João Mateus dos Santos")
->setEmail("[email protected] ")
->setTaxDocument("123.123.123-87")
->setAppUrl("http://meuaplicativo.com.br")
->createUser();
print_r($createdUser);
$updatedUser = $paggcerto->user()
->setId("d2e2")
->setRoleId("a0b1")
->setFullName("João Mateus dos Santos")
->setEmail("[email protected] ")
->setTaxDocument("123.123.123-87")
->updateUser();
print_r($updatedUser);
$list = $paggcerto->user()
->usersList();
print_r($list);
$listWithFilters = $paggcerto->user()
->setFullName("João Mateus")
->setEmail("[email protected] ")
->setTaxDocument("123.123.123-87")
->setLength(2)
->setIndex(2)
->usersList();
print_r($listWithFilters);
$search = $paggcerto->user()
->setId("d2e2")
->searchUser();
print_r($search);
$deactivate = $paggcerto->user()
->setId("d2e2")
->deactivateUser();
print_r($deactivate);
$activate = $paggcerto->user()
->setId("d2e2")
->activateUser();
print_r($activate);
$result = $paggcerto->cardPayment()
->getCardsBrands();
print_r($result->bins());
$result = $paggcerto->cardPayment()
->setAmount(100)
->setInstallments(2)
->setCardBrand("visa")
->setCredit(true)
->setCustomerPaysFee(true)
->setPinpad(false)
->paySimulate();
print_r($result);
$result = $paggcerto->cardPayment()
->setAmount(158.35)
->addCard("Rodrigo Alves", "5111925270937702", 12, 2018, 158.35, "035", 1, true)
->setPaymentDeviceSerialNumber("8000151509001953")
->setPaymentDeviceModel("mp5")
->pay();
print_r($result);
$result = $paggcerto->cardPayment()
->setAmount(158.35)
->addCard("Rodrigo Alves", "5111925270937702", 12, 2018, 158.35, "035", 1, true)
->setPaymentDeviceSerialNumber("8000151509001953")
->setPaymentDeviceModel("mp5")
->isAuthorizedSale(true)
->setDaysLimitAuthorization(28)
->pay();
print_r($result);
$result = $paggcerto->cardPayment()
->setPaymentId($payment->id)
->addCard("Maria Alves", "6363693078504487", 5, 2020, 50, "587", 1, false)
->payContinue();
print_r($result);
$result = $paggcerto->cardPayment()
->setPaymentId($payment->id)
->setAmount(158.35)
->paymentCapture();
print_r($result);
$receipt = $paggcerto->cardPayment()
->setNsu("1005")
->setEmail("[email protected] ")
->sendReceipt();
$dateDue = (new DateTime())->add(new DateInterval("P10D"));
$result = $paggcerto->bankSlipPayment()
->setDiscount(2.55)
->setDiscountDays(30)
->setFines(5)
->setInterest(3)
->setAcceptedUntil(15)
->addPayer("Rodrigo Alves", "953.262.300-03")
->addInstallment($dateDue->format("Y-m-d"), 100)
->setInstructions("PHP SDK")
->setNote("Descrição")
->pay();
print_r($result);
$conclusion = $paggcerto->payment()
->setPaymentId("a0b1")
->setNote("O valor de R$ 50,00 foi pago em dinheiro.")
->payFinalize();
print_r($conclusion);
$result = $paggcerto->payment()
->setPaymentId("a0b1")
->paymentCancel();
print_r($result);
$result = $paggcerto->cardPayment()
->setNsu("1005")
->cardTransactionCancel();
print_r($result);
$result = $paggcerto->bankSlipPayment()
->setNumber("10000002345")
->cancel();
print_r($result);
$result = $paggcerto->reportsManagement()
->setPaymentId($payment->id)
->getPaymentDetails();
print_r($result);
$createSplit = $paggcerto->split()
->setName("Administrador")
->setHolderName("Mariana Fulano de Tal")
->setTaxDocument("578.585.110-50")
->setAddressCityCode("2800308")
->setAddressDistrict("Smallville")
->setAddressLine1("Rua do Talon")
->setAddressLine2("Ap 001, Cleveland House")
->setAddressStreetNumber("6000")
->setAddressZipCode("49030-620")
->setBankAccountBankNumber("001")
->setBankAccountNumber("31232156132-12")
->setBankAccountBranchNumber("0031")
->setBankAccountType("corrente")
->setTransferDays(32)
->setAnticipatedTransfer(true)
->createSplitter();
print_r($createSplit);
$updateSplit = $paggcerto->split()
->setSplitterId($id)
->setName("Administrado")
->setHolderName("Mariana Fulano de Tal")
->setTaxDocument("029.378.350-07")
->setAddressCityCode("2800308")
->setAddressDistrict("Smallville")
->setAddressLine1("Rua do Talon")
->setAddressLine2("Ap 001, Cleveland House")
->setAddressStreetNumber("6000")
->setAddressZipCode("49030-620")
->setBankAccountBankNumber("001")
->setBankAccountNumber("31232156132-12")
->setBankAccountBranchNumber("0031")
->setBankAccountType("corrente")
->setTransferDays(32)
->setAnticipatedTransfer(false)
->updateSplitter();
print_r($updateSplit);
$split = $paggcerto->split()
->setSplitterId($id)
->searchSplitter();
print_r($split);
$split = $paggcerto->split()
->setName("Fulano")
->splittersList();
print_r($split);