├── .codeclimate.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README-en.md ├── README.md ├── composer.json ├── examples ├── charges │ ├── billet │ │ ├── cancelBillet.php │ │ ├── createBilletHistory.php │ │ ├── createCharge.php │ │ ├── createOneStepBillet.php │ │ ├── defineBalanceSheetBillet.php │ │ ├── defineBilletPayMethod.php │ │ ├── detailBillet.php │ │ ├── listBillets.php │ │ ├── sendBilletEmail.php │ │ ├── settleBillet.php │ │ ├── updateBillet.php │ │ └── updateBilletMetadata.php │ ├── card │ │ ├── cancelCard.php │ │ ├── cardPaymentRetry.php │ │ ├── createCardHistory.php │ │ ├── createCharge.php │ │ ├── createOneStepCard.php │ │ ├── defineCardPayMethod.php │ │ ├── detailCard.php │ │ ├── getInstallments.php │ │ ├── listCards.php │ │ ├── refundCard.php │ │ └── updateCardMetadata.php │ ├── carnet │ │ ├── cancelCarnet.php │ │ ├── cancelCarnetParcel.php │ │ ├── createCarnet.php │ │ ├── createCarnetHistory.php │ │ ├── detailCarnet.php │ │ ├── listCarnets.php │ │ ├── sendCarnetEmail.php │ │ ├── sendCarnetParcelEmail.php │ │ ├── settleCarnet.php │ │ ├── settleCarnetParcel.php │ │ ├── updateCarnetMetadata.php │ │ ├── updateCarnetParcel.php │ │ └── updateCarnetParcels.php │ ├── marketplace │ │ ├── createOneStepBilletMarketplace.php │ │ └── createOneStepCardMarketplace.php │ ├── notification │ │ └── getNotification.php │ ├── payment-link │ │ ├── cancelLink.php │ │ ├── createCharge.php │ │ ├── createChargeLinkHistory.php │ │ ├── createOneStepLink.php │ │ ├── defineLinkPayMethod.php │ │ ├── detailLink.php │ │ ├── listLinks.php │ │ ├── sendLinkEmail.php │ │ ├── updateLink.php │ │ └── updateLinkMetadata.php │ └── subscription │ │ ├── cancelSubscription.php │ │ ├── createCharge.php │ │ ├── createOneStepBilletSubscription.php │ │ ├── createOneStepCardSubscription.php │ │ ├── createOneStepSubscriptionLink.php │ │ ├── createPlan.php │ │ ├── createSubscriptionHistory.php │ │ ├── defineSubscriptionBillet.php │ │ ├── defineSubscriptionCard.php │ │ ├── deletePlan.php │ │ ├── detailSubscription.php │ │ ├── listPlans.php │ │ ├── listSubscriptions.php │ │ ├── sendSubscriptionLinkEmail.php │ │ ├── updatePlan.php │ │ ├── updateSubscription.php │ │ └── updateSubscriptionMetadata.php ├── credentials │ ├── developmentCertificate.p12 │ ├── options.php │ └── productionCertificate.p12 ├── exclusives │ ├── account │ │ ├── getAccountBalance.php │ │ ├── listAccountConfig.php │ │ └── updateAccountConfig.php │ ├── key │ │ ├── pixCreateEvp.php │ │ ├── pixDeleteEvp.php │ │ └── pixListEvp.php │ ├── med │ │ ├── medDefense.php │ │ └── medList.php │ ├── pix │ │ └── pixGetReceipt.php │ └── report │ │ ├── createReport.php │ │ └── detailReport.php ├── open-finance │ ├── config │ │ ├── ofConfigDetail.php │ │ └── ofConfigUpdate.php │ ├── participants │ │ └── ofListParticipants.php │ └── payments │ │ ├── immediate │ │ ├── ofDevolutionPix.php │ │ ├── ofListPixPayment.php │ │ └── ofStartPixPayment.php │ │ ├── recurrency │ │ ├── ofCancelRecurrencyPix.php │ │ ├── ofDevolutionRecurrencyPix.php │ │ ├── ofListRecurrencyPixPayment.php │ │ ├── ofReplaceRecurrencyPixParcel.php │ │ └── ofStartRecurrencyPixPayment.php │ │ └── schedule │ │ ├── ofCancelSchedulePix.php │ │ ├── ofDevolutionSchedulePix.php │ │ ├── ofListSchedulePixPayment.php │ │ └── ofStartSchedulePixPayment.php ├── payments │ └── billets │ │ ├── payment │ │ ├── payDetailBarCode.php │ │ ├── payDetailPayment.php │ │ ├── payListPayments.php │ │ └── payRequestBarCode.php │ │ └── webhooks │ │ ├── payConfigWebhook.php │ │ ├── payDeleteWebhook.php │ │ └── payListWebhook.php ├── pix │ ├── batch │ │ └── cobv │ │ │ ├── pixCreateDueChargeBatch.php │ │ │ ├── pixDetailDueChargeBatch.php │ │ │ ├── pixListDueChargeBatch.php │ │ │ └── pixUpdateDueChargeBatch.php │ ├── cob │ │ ├── pixCreateCharge.php │ │ ├── pixCreateImmediateCharge.php │ │ ├── pixDetailCharge.php │ │ ├── pixListCharges.php │ │ └── pixUpdateCharge.php │ ├── cobv │ │ ├── pixCreateDueCharge.php │ │ ├── pixDetailDueCharge.php │ │ ├── pixListDueCharges.php │ │ └── pixUpdateDueCharge.php │ ├── location │ │ ├── pixCreateLocation.php │ │ ├── pixDetailLocation.php │ │ ├── pixGenerateQRCode.php │ │ ├── pixLocationList.php │ │ └── pixUnlinkTxidLocation.php │ ├── management │ │ ├── pixDetailDevolution.php │ │ ├── pixDetailReceived.php │ │ ├── pixDevolution.php │ │ └── pixReceivedList.php │ ├── payment │ │ ├── pixQrCodeDetail.php │ │ ├── pixQrCodePay.php │ │ ├── pixSend.php │ │ ├── pixSendDetail.php │ │ ├── pixSendDetailId.php │ │ └── pixSendList.php │ ├── split │ │ ├── cob │ │ │ ├── pixSplitDetailCharge.php │ │ │ ├── pixSplitLinkCharge.php │ │ │ └── pixSplitUnlinkCharge.php │ │ ├── cobv │ │ │ ├── pixSplitDetailDueCharge.php │ │ │ ├── pixSplitLinkDueCharge.php │ │ │ └── pixSplitUnlinkDueCharge.php │ │ └── config │ │ │ ├── pixSplitConfig.php │ │ │ ├── pixSplitConfigId.php │ │ │ └── pixSplitDetailConfig.php │ └── webhooks │ │ ├── pixConfigWebhook.php │ │ ├── pixDeleteWebhook.php │ │ ├── pixDetailWebhook.php │ │ ├── pixListWebhook.php │ │ └── pixResendWebhook.php └── statements │ └── management │ ├── createSftpKey.php │ ├── createStatementRecurrency.php │ ├── getStatementFile.php │ ├── listStatementFiles.php │ ├── listStatementRecurrences.php │ └── updateStatementRecurrency.php ├── migrationChecker.php └── src └── Efi ├── ApiRequest.php ├── Auth.php ├── BaseModel.php ├── Config.php ├── EfiPay.php ├── Endpoints.php ├── Endpoints ├── Charges.php ├── Config.php ├── OpenFinance.php ├── OpeningAccounts.php ├── Payments.php ├── Pix.php └── Statements.php ├── Exception ├── ChargesException.php ├── EfiException.php ├── OpenFinanceException.php ├── OpeningAccountsException.php ├── PaymentsException.php ├── PixException.php └── StatementsException.php ├── FileCacheRetriever.php ├── Request.php ├── Response.php ├── Security.php └── Utils.php /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | version: "1" 2 | checks: 3 | argument-count: 4 | config: 5 | threshold: 4 6 | complex-logic: 7 | config: 8 | threshold: 10 9 | file-lines: 10 | config: 11 | threshold: 250 12 | method-complexity: 13 | config: 14 | threshold: 15 15 | method-count: 16 | config: 17 | threshold: 20 18 | method-lines: 19 | config: 20 | threshold: 30 21 | nested-control-flow: 22 | config: 23 | threshold: 4 24 | return-statements: 25 | config: 26 | threshold: 4 27 | similar-code: 28 | enabled: false 29 | config: 30 | threshold: 100 31 | identical-code: 32 | config: 33 | threshold: 28 34 | exclude_patterns: 35 | - "examples/" 36 | - "migrationChecker.php" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | composer.lock 2 | vendor/ 3 | examples/open-accounts/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 efipay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "efipay/sdk-php-apis-efi", 3 | "description": "SDK PHP para APIs Efi Pay", 4 | "homepage": "https://github.com/efipay/sdk-php-apis-efi/", 5 | "version": "1.13.0", 6 | "type": "library", 7 | "require": { 8 | "php": ">=7.2.5", 9 | "guzzlehttp/guzzle": "^7.0" 10 | }, 11 | "support": { 12 | "docs": "https://dev.sejaefi.com.br/", 13 | "discord": "https://comunidade.sejaefi.com.br/" 14 | }, 15 | "license": "MIT", 16 | "authors": [ 17 | { 18 | "name": "Guilherme Cota" 19 | }, 20 | { 21 | "name": "Jéssica Gava" 22 | }, 23 | { 24 | "name": "Sady Coimbra" 25 | }, 26 | { 27 | "name": "Matheus Rodrigues" 28 | }, 29 | { 30 | "name": "João Oliveira" 31 | }, 32 | { 33 | "name": "Paloma Brito" 34 | } 35 | ], 36 | "autoload": { 37 | "psr-4": { 38 | "Efi\\": "src/Efi" 39 | } 40 | }, 41 | "config": { 42 | "sort-packages": true, 43 | "optimize-autoloader": true, 44 | "minimum-stability": "stable" 45 | } 46 | } -------------------------------------------------------------------------------- /examples/charges/billet/cancelBillet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->cancelCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/billet/createBilletHistory.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "description" => "This billet is about a service" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->createChargeHistory($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/billet/defineBilletPayMethod.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $customer = [ 28 | "name" => "Gorbadoc Oldbuck", 29 | "cpf" => "94271564656" 30 | ]; 31 | 32 | $body = [ 33 | "payment" => [ 34 | "banking_billet" => [ 35 | "expire_at" => "2024-12-10", 36 | "customer" => $customer 37 | ] 38 | ] 39 | ]; 40 | 41 | try { 42 | $api = new EfiPay($options); 43 | $response = $api->definePayMethod($params, $body); 44 | 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
Second step:
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } else { 49 | print_r("
Second step:
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 50 | } 51 | } catch (EfiException $e) { 52 | print_r($e->code . "
"); 53 | print_r($e->error . "
"); 54 | print_r($e->errorDescription) . "
"; 55 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 56 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 57 | } 58 | } catch (Exception $e) { 59 | print_r($e->getMessage()); 60 | } 61 | -------------------------------------------------------------------------------- /examples/charges/billet/detailBillet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->detailCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/billet/sendBilletEmail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "email" => "client_email@server.com.br" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->sendBilletEmail($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/billet/settleBillet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->settleCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } -------------------------------------------------------------------------------- /examples/charges/billet/updateBillet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "expire_at" => "2024-12-10" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->updateBillet($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/billet/updateBilletMetadata.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "custom_id" => "Order_0001", 29 | "notification_url" => "https://your-domain.com.br/notification" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->updateChargeMetadata($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/charges/card/cancelCard.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->cancelCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/card/createCardHistory.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "description" => "This billet is about a service" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->createChargeHistory($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/card/detailCard.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->detailCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/card/getInstallments.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "total" => "20000", 25 | "brand" => "visa" // "mastercard", "amex", "elo", hipercard 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->getInstallments($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/charges/card/listCards.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "charge_type" => "card", 25 | "begin_date" => "2024-01-01", 26 | "end_date" => "2024-12-31", 27 | // "date_of" => "payment", // "creation","payment", "due" 28 | // "status" => "paid", // "new", "waiting", "paid", "unpaid", "canceled" 29 | // "customer_document" => "00000000000", // CPF or CNPJ 30 | // "custom_id" => "000001", 31 | // "value" => "9990", 32 | // "limit" => 50, 33 | // "page" => 2 34 | // "offset" => 25 35 | ]; 36 | 37 | try { 38 | $api = new EfiPay($options); 39 | $response = $api->listCharges($params); 40 | 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } else { 45 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 46 | } 47 | } catch (EfiException $e) { 48 | print_r($e->code . "
"); 49 | print_r($e->error . "
"); 50 | print_r($e->errorDescription) . "
"; 51 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 52 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 53 | } 54 | } catch (Exception $e) { 55 | print_r($e->getMessage()); 56 | } 57 | -------------------------------------------------------------------------------- /examples/charges/card/refundCard.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "amount" => 1000 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->refundCard($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/card/updateCardMetadata.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "custom_id" => "Order_0001", 29 | "notification_url" => "https://your-domain.com.br/notification" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->updateChargeMetadata($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/charges/carnet/cancelCarnet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->cancelCarnet($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/carnet/cancelCarnetParcel.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0, 25 | "parcel" => 1 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->cancelCarnetParcel($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/charges/carnet/createCarnetHistory.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "description" => "This carnet is about a service" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->createCarnetHistory($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/carnet/detailCarnet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->detailCarnet($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/carnet/listCarnets.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "charge_type" => "carnet", 25 | "begin_date" => "2024-01-01", 26 | "end_date" => "2024-12-31", 27 | // "date_of" => "payment", // "creation","payment", "due" 28 | // "status" => "paid", // "new", "waiting", "paid", "unpaid", "canceled" 29 | // "customer_document" => "00000000000", // CPF or CNPJ 30 | // "custom_id" => "000001", 31 | // "value" => "9990", 32 | // "limit" => 50, 33 | // "page" => 2 34 | // "offset" => 25 35 | ]; 36 | 37 | try { 38 | $api = new EfiPay($options); 39 | $response = $api->listCharges($params); 40 | 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } else { 45 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 46 | } 47 | } catch (EfiException $e) { 48 | print_r($e->code . "
"); 49 | print_r($e->error . "
"); 50 | print_r($e->errorDescription) . "
"; 51 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 52 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 53 | } 54 | } catch (Exception $e) { 55 | print_r($e->getMessage()); 56 | } 57 | -------------------------------------------------------------------------------- /examples/charges/carnet/sendCarnetEmail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "email" => "client_email@server.com.br" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->sendCarnetEmail($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/carnet/sendCarnetParcelEmail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0, 25 | "parcel" => 1 26 | ]; 27 | 28 | $body = [ 29 | "email" => "client_email@server.com.br" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->sendCarnetParcelEmail($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/charges/carnet/settleCarnet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->settleCarnet($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/carnet/settleCarnetParcel.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0, 25 | "parcel" => 1 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->settleCarnetParcel($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/charges/carnet/updateCarnetMetadata.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "custom_id" => "Carnet_0001", 29 | "notification_url" => "https://your-domain.com.br/notification/" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->updateCarnetMetadata($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/charges/carnet/updateCarnetParcel.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0, 25 | "parcel" => 1 26 | ]; 27 | 28 | $body = [ 29 | "expire_at" => "2024-12-10" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->updateCarnetParcel($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/charges/carnet/updateCarnetParcels.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "parcels" => [ 29 | [ 30 | "parcel" => 2, 31 | "expire_at" => "2025-02-28" 32 | ], 33 | [ 34 | "parcel" => 3, 35 | "expire_at" => "2025-03-31" 36 | ], 37 | [ 38 | "parcel" => 4, 39 | "expire_at" => "2025-04-30" 40 | ] 41 | ] 42 | ]; 43 | 44 | try { 45 | $api = new EfiPay($options); 46 | $response = $api->updateCarnetParcels($params, $body); 47 | 48 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 49 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 50 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 51 | } else { 52 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 53 | } 54 | } catch (EfiException $e) { 55 | print_r($e->code . "
"); 56 | print_r($e->error . "
"); 57 | print_r($e->errorDescription) . "
"; 58 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 59 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 60 | } 61 | } catch (Exception $e) { 62 | print_r($e->getMessage()); 63 | } 64 | -------------------------------------------------------------------------------- /examples/charges/notification/getNotification.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "token" => $_POST["notification"] // Notification token example: "00000000-0000-0000-0000-000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->getNotification($params); 30 | 31 | header("HTTP/1.1 200"); 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | header("HTTP/1.1 400"); 40 | print_r($e->code . "
"); 41 | print_r($e->error . "
"); 42 | print_r($e->errorDescription) . "
"; 43 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 44 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 45 | } 46 | } catch (Exception $e) { 47 | header("HTTP/1.1 403"); 48 | print_r($e->getMessage()); 49 | } 50 | -------------------------------------------------------------------------------- /examples/charges/payment-link/cancelLink.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->cancelCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/payment-link/createCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $items = [ 24 | [ 25 | "name" => "Product 1", 26 | "amount" => 1, 27 | "value" => 1000 28 | ], 29 | [ 30 | "name" => "Product 2", 31 | "amount" => 2, 32 | "value" => 2000 33 | ] 34 | ]; 35 | 36 | $shippings = [ // Optional 37 | [ 38 | "name" => "Shipping to City", 39 | "value" => 2000 40 | ] 41 | ]; 42 | 43 | $body = [ 44 | "items" => $items, 45 | "shippings" => $shippings 46 | ]; 47 | 48 | try { 49 | $api = new EfiPay($options); 50 | $response = $api->createCharge($params = [], $body); 51 | 52 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 53 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 54 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 55 | } else { 56 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 57 | } 58 | } catch (EfiException $e) { 59 | print_r($e->code . "
"); 60 | print_r($e->error . "
"); 61 | print_r($e->errorDescription) . "
"; 62 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 63 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 64 | } 65 | } catch (Exception $e) { 66 | print_r($e->getMessage()); 67 | } 68 | -------------------------------------------------------------------------------- /examples/charges/payment-link/createChargeLinkHistory.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "description" => "This billet is about a service" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->createChargeHistory($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/payment-link/detailLink.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->detailCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/payment-link/sendLinkEmail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "email" => "client_email@server.com.br" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->sendLinkEmail($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/payment-link/updateLinkMetadata.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "custom_id" => "Order_0001", 29 | "notification_url" => "https://your-domain.com.br/notification" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->updateChargeMetadata($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/charges/subscription/cancelSubscription.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->cancelSubscription($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/subscription/createPlan.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $body = [ 24 | "name" => "My plan", 25 | "interval" => 1, 26 | "repeats" => null 27 | ]; 28 | 29 | try { 30 | $api = new EfiPay($options); 31 | $response = $api->createPlan($params = [], $body); 32 | 33 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 34 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } else { 37 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } 39 | } catch (EfiException $e) { 40 | print_r($e->code . "
"); 41 | print_r($e->error . "
"); 42 | print_r($e->errorDescription) . "
"; 43 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 44 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 45 | } 46 | } catch (Exception $e) { 47 | print_r($e->getMessage()); 48 | } 49 | -------------------------------------------------------------------------------- /examples/charges/subscription/createSubscriptionHistory.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "description" => "This subscription is about a service" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->createSubscriptionHistory($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/subscription/defineSubscriptionBillet.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 // subscription id 25 | ]; 26 | 27 | $customer = [ 28 | "name" => "Gorbadoc Oldbuck", 29 | "cpf" => "94271564656", 30 | ]; 31 | 32 | $body = [ 33 | "payment" => [ 34 | "banking_billet" => [ 35 | 'expire_at' => '2024-12-15', 36 | "customer" => $customer 37 | ] 38 | ] 39 | ]; 40 | 41 | try { 42 | $api = new EfiPay($options); 43 | $response = $api->defineSubscriptionPayMethod($params, $body); 44 | 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } else { 49 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 50 | } 51 | } catch (EfiException $e) { 52 | print_r($e->code . "
"); 53 | print_r($e->error . "
"); 54 | print_r($e->errorDescription) . "
"; 55 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 56 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 57 | } 58 | } catch (Exception $e) { 59 | print_r($e->getMessage()); 60 | } 61 | -------------------------------------------------------------------------------- /examples/charges/subscription/deletePlan.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->deletePlan($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/subscription/detailSubscription.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->detailSubscription($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/charges/subscription/listPlans.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "limit" => 20, 25 | "offset" => 0 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->listPlans($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/charges/subscription/sendSubscriptionLinkEmail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "email" => "client_email@server.com.br" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->sendSubscriptionLinkEmail($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/subscription/updatePlan.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "name" => "My new plan" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->updatePlan($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/charges/subscription/updateSubscriptionMetadata.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | $body = [ 28 | "custom_id" => "Order_0001", 29 | "notification_url" => "https://your-domain.com.br/notification/" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->updateSubscriptionMetadata($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/credentials/developmentCertificate.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efipay/sdk-php-apis-efi/e573f83cbe1fd49e5195232578e882632fb4cc52/examples/credentials/developmentCertificate.p12 -------------------------------------------------------------------------------- /examples/credentials/options.php: -------------------------------------------------------------------------------- 1 | ($sandbox) ? $clientIdHomolog : $clientIdProd, 27 | "clientSecret" => ($sandbox) ? $clientSecretHomolog : $clientSecretProd, 28 | "certificate" => ($sandbox) ? $pathCertificateHomolog : $pathCertificateProd, 29 | "pwdCertificate" => "", // Optional | Default = "" 30 | "sandbox" => $sandbox, // Optional | Default = false 31 | "debug" => false, // Optional | Default = false 32 | "timeout" => 30, // Optional | Default = 30 33 | "responseHeaders" => true, // Optional | Default = false 34 | ]; 35 | -------------------------------------------------------------------------------- /examples/credentials/productionCertificate.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efipay/sdk-php-apis-efi/e573f83cbe1fd49e5195232578e882632fb4cc52/examples/credentials/productionCertificate.p12 -------------------------------------------------------------------------------- /examples/exclusives/account/getAccountBalance.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "bloqueios" => true 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->getAccountBalance($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/exclusives/account/listAccountConfig.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | try { 24 | $api = new EfiPay($options); 25 | $response = $api->listAccountConfig(); 26 | 27 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 28 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 29 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 30 | } else { 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } 33 | } catch (EfiException $e) { 34 | print_r($e->code . "
"); 35 | print_r($e->error . "
"); 36 | print_r($e->errorDescription) . "
"; 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/exclusives/key/pixCreateEvp.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | try { 24 | $api = new EfiPay($options); 25 | $response = $api->pixCreateEvp(); 26 | 27 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 28 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 29 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 30 | } else { 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } 33 | } catch (EfiException $e) { 34 | print_r($e->code . "
"); 35 | print_r($e->error . "
"); 36 | print_r($e->errorDescription) . "
"; 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/exclusives/key/pixDeleteEvp.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "chave" => "00000000-0000-0000-0000-000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDeleteEvp($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/exclusives/key/pixListEvp.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | try { 24 | $api = new EfiPay($options); 25 | $response = $api->pixListEvp(); 26 | 27 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 28 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 29 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 30 | } else { 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } 33 | } catch (EfiException $e) { 34 | print_r($e->code . "
"); 35 | print_r($e->error . "
"); 36 | print_r($e->errorDescription) . "
"; 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/exclusives/med/medDefense.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "idInfracao" => "00000000-0000-0000-0000-000000000000" 25 | ]; 26 | 27 | $body = [ 28 | "analise" => "aceito", 29 | "justificativa" => "Justificativa" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->medDefense($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/exclusives/med/medList.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2024-06-01T00:00:00Z", 25 | "fim" => "2024-12-31T23:59:59Z" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->medList($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/open-finance/config/ofConfigDetail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | try { 24 | $api = new EfiPay($options); 25 | $response = $api->ofConfigDetail(); 26 | 27 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 28 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 29 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 30 | } else { 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } 33 | } catch (EfiException $e) { 34 | print_r($e->code . "
"); 35 | print_r($e->error . "
"); 36 | print_r($e->errorDescription) . "
"; 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/open-finance/config/ofConfigUpdate.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $body = [ 24 | "redirectURL" => "https://your-domain.com.br/redirect/", 25 | "webhookURL" => "https://your-domain.com.br/webhook/", 26 | "webhookSecurity" => [ 27 | "type" => "mtls" 28 | ], 29 | "processPayment" => "async" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->ofConfigUpdate($params = [], $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/open-finance/participants/ofListParticipants.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ // optional 24 | "nome" => "Efi" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->ofListParticipants(); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/open-finance/payments/immediate/ofDevolutionPix.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "identificadorPagamento" => "urn:participant:00000000-0000-0000-0000-000000000000", 25 | ]; 26 | 27 | $body = [ 28 | "valor" => "0.01" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->ofDevolutionPix($params, $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/open-finance/payments/immediate/ofListPixPayment.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2023-01-22", 25 | "fim" => "2024-12-31", 26 | // "quantidade" => 10, 27 | // "página" => 2, 28 | // "status" => "aceito" // "pendente", "rejeitado", "expirado", "aceito", "cancelado" 29 | //"identificador" => "urn:participant:00000000-0000-0000-0000-000000000000" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->ofListPixPayment($params); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/open-finance/payments/recurrency/ofCancelRecurrencyPix.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "identificadorPagamento" => "urn:participant:00000000-0000-0000-0000-000000000000" 25 | ]; 26 | 27 | $body = [ 28 | "endToEndId" => [ 29 | "E0000000000000000000000000000000", 30 | "E0000000000000000000000000000001", 31 | "E0000000000000000000000000000002" 32 | ] 33 | ]; 34 | 35 | try { 36 | $api = new EfiPay($options); 37 | $response = $api->ofCancelRecurrencyPix($params, $body); 38 | 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } catch (EfiException $e) { 41 | print_r($e->code . "
"); 42 | print_r($e->error . "
"); 43 | print_r($e->errorDescription) . "
"; 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/open-finance/payments/recurrency/ofDevolutionRecurrencyPix.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "identificadorPagamento" => "urn:participant:00000000-0000-0000-0000-000000000000" 25 | ]; 26 | 27 | $body = [ 28 | "devolucoes" => [ 29 | [ 30 | "endToEndId" => "E0000000000000000000000000000000", 31 | "valor" => "0.01" 32 | ], 33 | [ 34 | "endToEndId" => "E0000000000000000000000000000001", 35 | "valor" => "0.01" 36 | ] 37 | ] 38 | ]; 39 | 40 | try { 41 | $api = new EfiPay($options); 42 | $response = $api->ofDevolutionRecurrencyPix($params, $body); 43 | 44 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 45 | } catch (EfiException $e) { 46 | print_r($e->code . "
"); 47 | print_r($e->error . "
"); 48 | print_r($e->errorDescription) . "
"; 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/open-finance/payments/recurrency/ofListRecurrencyPixPayment.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2023-01-22", 25 | "fim" => "2024-12-31", 26 | // "quantidade" => 10, 27 | // "página" => 2, 28 | // "status" => "aceito" // "pendente", "agendado", "rejeitado", "expirado", "aceito", "cancelado" 29 | //"identificador" => "urn:participant:00000000-0000-0000-0000-000000000000" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->ofListRecurrencyPixPayment($params); 35 | 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | } catch (Exception $e) { 42 | print_r($e->getMessage()); 43 | } 44 | -------------------------------------------------------------------------------- /examples/open-finance/payments/recurrency/ofReplaceRecurrencyPixParcel.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "identificadorPagamento" => "urn:participant:00000000-0000-0000-0000-000000000000", 25 | "endToEndId" => "E0000000000000000000000000000000" 26 | ]; 27 | 28 | $body = [ 29 | "valor" => "9.99" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->ofReplaceRecurrencyPixParcel($params, $body); 35 | 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | } catch (Exception $e) { 42 | print_r($e->getMessage()); 43 | } 44 | -------------------------------------------------------------------------------- /examples/open-finance/payments/schedule/ofCancelSchedulePix.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "identificadorPagamento" => "urn:efi:e102339e-9294-4176-bb6d-36378d2b731d", 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->ofCancelSchedulePix($params); 30 | 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } catch (EfiException $e) { 33 | print_r($e->code . "
"); 34 | print_r($e->error . "
"); 35 | print_r($e->errorDescription) . "
"; 36 | } catch (Exception $e) { 37 | print_r($e->getMessage()); 38 | } 39 | -------------------------------------------------------------------------------- /examples/open-finance/payments/schedule/ofDevolutionSchedulePix.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "identificadorPagamento" => "urn:participant:00000000-0000-0000-0000-000000000000", 25 | ]; 26 | 27 | $body = [ 28 | "valor" => "0.01" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->ofDevolutionSchedulePix($params, $body); 34 | 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } catch (EfiException $e) { 37 | print_r($e->code . "
"); 38 | print_r($e->error . "
"); 39 | print_r($e->errorDescription) . "
"; 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/open-finance/payments/schedule/ofListSchedulePixPayment.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2023-01-22", 25 | "fim" => "2024-12-31", 26 | // "quantidade" => 10, 27 | // "página" => 2, 28 | // "status" => "aceito" // "pendente", "agendado", "rejeitado", "expirado", "aceito", "cancelado" 29 | //"identificador" => "urn:participant:00000000-0000-0000-0000-000000000000" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->ofListSchedulePixPayment($params); 35 | 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | } catch (Exception $e) { 42 | print_r($e->getMessage()); 43 | } 44 | -------------------------------------------------------------------------------- /examples/open-finance/payments/schedule/ofStartSchedulePixPayment.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $options["headers"] = [ 24 | "x-idempotency-key" => "00000000000000000000000000000008" // Random identifier | minLength: 36 maxLength: 72 25 | ]; 26 | 27 | $body = [ 28 | "pagador" => [ 29 | "idParticipante" => "ebbed125-5cd7-42e3-965d-2e7af8e3b7ae", 30 | "cpf" => "11789337682", 31 | // "cnpj" => "12345678901234" 32 | ], 33 | "favorecido" => [ 34 | "contaBanco" => [ 35 | "codigoBanco" => "364", 36 | "agencia" => "0001", 37 | "conta" => "2712075", 38 | "tipoConta" => "CACC", 39 | "documento" => "11789337682", 40 | "nome" => "Guilherme Soares Cota" 41 | ] 42 | ], 43 | "pagamento" => [ 44 | "valor" => "0.01", 45 | "dataAgendamento" => "2024-08-28", 46 | "infoPagador" => "Order 00001", 47 | "idProprio" => "Client00001Order00001" 48 | ] 49 | ]; 50 | 51 | try { 52 | $api = new EfiPay($options); 53 | $response = $api->ofStartSchedulePixPayment($params = [], $body); 54 | 55 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 56 | } catch (EfiException $e) { 57 | print_r($e->code . "
"); 58 | print_r($e->error . "
"); 59 | print_r($e->errorDescription) . "
"; 60 | } catch (Exception $e) { 61 | print_r($e->getMessage()); 62 | } 63 | -------------------------------------------------------------------------------- /examples/payments/billets/payment/payDetailBarCode.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "codBarras" => "36400000000000000000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->payDetailBarCode($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/payments/billets/payment/payDetailPayment.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "idPagamento" => 0, 25 | // "status" => "REALIZADO" // EM_PROCESSAMENTO, AGENDADO, LIQUIDADO, CANCELADO, NAO_REALIZADO 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->payDetailPayment($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/payments/billets/payment/payListPayments.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "dataInicio" => "2023-01-01", 25 | "dataFim" => "2024-12-31" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->payListPayments($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/payments/billets/payment/payRequestBarCode.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "codBarras" => "36400000000000000000000000000000000000000000000" 25 | ]; 26 | 27 | $body = [ 28 | "valor" => 500, 29 | "dataPagamento" => "2024-12-10", 30 | "descricao" => "Payment of the test billet" 31 | ]; 32 | 33 | try { 34 | $api = new EfiPay($options); 35 | $response = $api->payRequestBarCode($params, $body); 36 | 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } else { 41 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 42 | } 43 | } catch (EfiException $e) { 44 | print_r($e->code . "
"); 45 | print_r($e->error . "
"); 46 | print_r($e->errorDescription) . "
"; 47 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 48 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 49 | } 50 | } catch (Exception $e) { 51 | print_r($e->getMessage()); 52 | } 53 | -------------------------------------------------------------------------------- /examples/payments/billets/webhooks/payConfigWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $options["headers"] = [ 24 | "x-skip-mtls-checking" => false 25 | ]; 26 | 27 | $body = [ 28 | "url" => "https://seudominio.com.br/webhook/" 29 | ]; 30 | 31 | try { 32 | $api = new EfiPay($options); 33 | $response = $api->payConfigWebhook($params = [], $body); 34 | 35 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 36 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } else { 39 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | } 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/payments/billets/webhooks/payDeleteWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $body = [ 24 | "url" => "https://seudominio.com.br/webhook/" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->payDeleteWebhook($params = [], $body); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/payments/billets/webhooks/payListWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "dataInicio" => "2023-01-01T00:00:00Z", 25 | "dataFim" => "2024-12-31T23:59:59Z" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->payListWebhook($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/pix/batch/cobv/pixDetailDueChargeBatch.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 1 // integer($int64) 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDetailDueChargeBatch($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/batch/cobv/pixListDueChargeBatch.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2024-01-01T00:00:00Z", 25 | "fim" => "2024-12-31T23:59:59Z", 26 | // "paginacao.paginaAtual" => 1, 27 | // "paginacao.itensPorPagina" => 10 28 | ]; 29 | 30 | try { 31 | $api = new EfiPay($options); 32 | $response = $api->pixListDueChargeBatch($params); 33 | 34 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 35 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } else { 38 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (EfiException $e) { 41 | print_r($e->code . "
"); 42 | print_r($e->error . "
"); 43 | print_r($e->errorDescription) . "
"; 44 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 45 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 46 | } 47 | } catch (Exception $e) { 48 | print_r($e->getMessage()); 49 | } 50 | -------------------------------------------------------------------------------- /examples/pix/cob/pixDetailCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDetailCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/cob/pixUpdateCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | $body = [ 28 | "valor" => [ 29 | "original" => "123.45" 30 | ], 31 | "solicitacaoPagador" => "Enter the order number or identifier." 32 | ]; 33 | 34 | try { 35 | $api = new EfiPay($options); 36 | $response = $api->pixUpdateCharge($params, $body); 37 | 38 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 39 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } else { 42 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (EfiException $e) { 45 | print_r($e->code . "
"); 46 | print_r($e->error . "
"); 47 | print_r($e->errorDescription) . "
"; 48 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 49 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 50 | } 51 | } catch (Exception $e) { 52 | print_r($e->getMessage()); 53 | } 54 | -------------------------------------------------------------------------------- /examples/pix/cobv/pixDetailDueCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDetailDueCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/cobv/pixUpdateDueCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | $body = [ 28 | "valor" => [ 29 | "original" => "126.45" 30 | ], 31 | "solicitacaoPagador" => "Enter the order number or identifier." 32 | ]; 33 | 34 | try { 35 | $api = new EfiPay($options); 36 | $response = $api->pixUpdateDueCharge($params, $body); 37 | 38 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 39 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } else { 42 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (EfiException $e) { 45 | print_r($e->code . "
"); 46 | print_r($e->error . "
"); 47 | print_r($e->errorDescription) . "
"; 48 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 49 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 50 | } 51 | } catch (Exception $e) { 52 | print_r($e->getMessage()); 53 | } 54 | -------------------------------------------------------------------------------- /examples/pix/location/pixCreateLocation.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $body = [ 24 | "tipoCob" => "cob" // "cob", "cobv" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixCreateLocation($params = [], $body); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/location/pixDetailLocation.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDetailLocation($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/location/pixGenerateQRCode.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 1 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixGenerateQRCode($params); 30 | 31 | $responseBody = (isset($options["responseHeaders"]) && $options["responseHeaders"]) ? $response->body : $response; 32 | 33 | echo "Pix Copia e Cola, QR Code e link de visualização:
"; 34 | print_r("
" . json_encode($responseBody, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | 36 | echo "Imagem:
"; 37 | echo ""; 38 | 39 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 40 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | echo $e->getMessage(); 51 | } 52 | -------------------------------------------------------------------------------- /examples/pix/location/pixLocationList.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2023-01-22T00:00:00Z", 25 | "fim" => "2024-12-22T23:59:59Z" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->pixLocationList($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/pix/location/pixUnlinkTxidLocation.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => 0 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixUnlinkTxidLocation($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/management/pixDetailDevolution.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "e2eId" => "E0000000000000000000000000000000", 25 | "id" => "D0000000000000000000000000000000" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->pixDetailDevolution($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/pix/management/pixDetailReceived.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "e2eId" => "E0000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDetailReceived($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/management/pixDevolution.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "e2eId" => "E0000000000000000000000000000000", 25 | "id" => "D0000000000000000000000000000000" 26 | ]; 27 | 28 | $body = [ 29 | "valor" => "0.01" 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->pixDevolution($params, $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/pix/payment/pixQrCodeDetail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $body = [ 24 | "pixCopiaECola" => "00020101021226850014BR.GOV.BCB.PIX2563qrcodespix.sejaefi.com.br/v2/000000000000000000000000000000000000000053039865802BR5905EFISA6008SAOPAULO62070503***63040E48" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixQrCodeDetail($params = [], $body); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/payment/pixQrCodePay.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "idEnvio" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | $body = [ 28 | "pagador" => [ 29 | "chave" => "00000000-0000-0000-0000-000000000000", 30 | "infoPagador" => "Information about the payment" 31 | ], 32 | "pixCopiaECola" => "00020101021226850014BR.GOV.BCB.PIX2563qrcodespix.sejaefi.com.br/v2/000000000000000000000000000000000000000053039865802BR5905EFISA6008SAOPAULO62070503***63040E48" 33 | ]; 34 | 35 | try { 36 | $api = new EfiPay($options); 37 | $response = $api->pixQrCodePay($params, $body); 38 | 39 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } catch (EfiException $e) { 42 | print_r($e->code . "
"); 43 | print_r($e->error . "
"); 44 | print_r($e->errorDescription) . "
"; 45 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 46 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 47 | } 48 | } catch (Exception $e) { 49 | print_r($e->getMessage()); 50 | } 51 | -------------------------------------------------------------------------------- /examples/pix/payment/pixSendDetail.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "e2eId" => "E0000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixSendDetail($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/payment/pixSendDetailId.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "idEnvio" => "00000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixSendDetailId($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/payment/pixSendList.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2023-01-22T00:00:00Z", 25 | "fim" => "2024-12-31T23:59:59Z", 26 | // "status" => "REALIZADO", // "EM_PROCESSAMENTO", "REALIZADO", "NAO_REALIZADO" 27 | // "devolucaoPresente" => true, 28 | // "paginacao.paginaAtual" => 1, 29 | // "paginacao.itensPorPagina" => 10 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->pixSendList($params); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/pix/split/cob/pixSplitDetailCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixSplitDetailCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/split/cob/pixSplitLinkCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000", 25 | "splitConfigId" => "splitConfigId0000000000000000000" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->pixSplitLinkCharge($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/pix/split/cob/pixSplitUnlinkCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixSplitUnlinkCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/split/cobv/pixSplitDetailDueCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixSplitDetailDueCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/split/cobv/pixSplitLinkDueCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000", 25 | "splitConfigId" => "splitConfigId0000000000000000000" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->pixSplitLinkDueCharge($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/pix/split/cobv/pixSplitUnlinkDueCharge.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "txid" => "00000000000000000000000000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixSplitUnlinkDueCharge($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/split/config/pixSplitDetailConfig.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "id" => "splitConfigId0000000000000000000", 25 | "revisao" => 0 // Optional 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->pixSplitDetailConfig($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/pix/webhooks/pixConfigWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $options["headers"] = [ 24 | "x-skip-mtls-checking" => false 25 | ]; 26 | 27 | $params = [ 28 | "chave" => "00000000-0000-0000-0000-000000000000" 29 | ]; 30 | 31 | $body = [ 32 | "webhookUrl" => "https://seudominio.com.br/webhook/" 33 | ]; 34 | 35 | try { 36 | $api = new EfiPay($options); 37 | $response = $api->pixConfigWebhook($params, $body); 38 | 39 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 40 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 42 | } else { 43 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (EfiException $e) { 46 | print_r($e->code . "
"); 47 | print_r($e->error . "
"); 48 | print_r($e->errorDescription) . "
"; 49 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 50 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 51 | } 52 | } catch (Exception $e) { 53 | print_r($e->getMessage()); 54 | } 55 | -------------------------------------------------------------------------------- /examples/pix/webhooks/pixDeleteWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "chave" => "00000000-0000-0000-0000-000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDeleteWebhook($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/webhooks/pixDetailWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "chave" => "00000000-0000-0000-0000-000000000000" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->pixDetailWebhook($params); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/pix/webhooks/pixListWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "inicio" => "2023-01-01T00:00:00Z", 25 | "fim" => "2024-12-31T23:59:59Z" 26 | ]; 27 | 28 | try { 29 | $api = new EfiPay($options); 30 | $response = $api->pixListWebhook($params); 31 | 32 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 33 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | } else { 36 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 37 | } 38 | } catch (EfiException $e) { 39 | print_r($e->code . "
"); 40 | print_r($e->error . "
"); 41 | print_r($e->errorDescription) . "
"; 42 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 43 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 44 | } 45 | } catch (Exception $e) { 46 | print_r($e->getMessage()); 47 | } 48 | -------------------------------------------------------------------------------- /examples/pix/webhooks/pixResendWebhook.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $body = [ 24 | "tipo" => "PIX_RECEBIDO", // PIX_RECEBIDO, PIX_ENVIADO, DEVOLUCAO_RECEBIDA, DEVOLUCAO_ENVIADA 25 | "e2eids" => [ // maximum 1000 26 | "E0000000000000000000000000000000", 27 | "E0000000000000000000000000000001", 28 | "E0000000000000000000000000000002" 29 | ] 30 | ]; 31 | 32 | try { 33 | $api = new EfiPay($options); 34 | $response = $api->pixResendWebhook($params = [], $body); 35 | 36 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 37 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } else { 40 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } 42 | } catch (EfiException $e) { 43 | print_r($e->code . "
"); 44 | print_r($e->error . "
"); 45 | print_r($e->errorDescription) . "
"; 46 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 47 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 48 | } 49 | } catch (Exception $e) { 50 | print_r($e->getMessage()); 51 | } 52 | -------------------------------------------------------------------------------- /examples/statements/management/createSftpKey.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | try { 24 | $api = new EfiPay($options); 25 | $response = $api->createSftpKey(); 26 | 27 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 28 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 29 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 30 | } else { 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } 33 | } catch (EfiException $e) { 34 | print_r($e->code . "
"); 35 | print_r($e->error . "
"); 36 | print_r($e->errorDescription) . "
"; 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/statements/management/createStatementRecurrency.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $body = [ 24 | "periodicidade" => "diario", // "diario", "semanal", "mensal" 25 | "envia_email" => true, 26 | "comprimir_arquivos" => false // true - arquivo compactado em formato .zip / false - arquivo não compactado em formato .txt 27 | ]; 28 | 29 | try { 30 | $api = new EfiPay($options); 31 | $response = $api->createStatementRecurrency($params = [], $body); 32 | 33 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 34 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 35 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } else { 37 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 38 | } 39 | } catch (EfiException $e) { 40 | print_r($e->code . "
"); 41 | print_r($e->error . "
"); 42 | print_r($e->errorDescription) . "
"; 43 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 44 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 45 | } 46 | } catch (Exception $e) { 47 | print_r($e->getMessage()); 48 | } 49 | -------------------------------------------------------------------------------- /examples/statements/management/getStatementFile.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "nome_arquivo" => "EFI_00000000_00000000_000000_CNAB_240.txt" 25 | ]; 26 | 27 | try { 28 | $api = new EfiPay($options); 29 | $response = $api->getStatementFile($params ); 30 | 31 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 32 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 33 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 34 | } else { 35 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 36 | } 37 | } catch (EfiException $e) { 38 | print_r($e->code . "
"); 39 | print_r($e->error . "
"); 40 | print_r($e->errorDescription) . "
"; 41 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 42 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (Exception $e) { 45 | print_r($e->getMessage()); 46 | } 47 | -------------------------------------------------------------------------------- /examples/statements/management/listStatementFiles.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | try { 24 | $api = new EfiPay($options); 25 | $response = $api->listStatementFiles(); 26 | 27 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 28 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 29 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 30 | } else { 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } 33 | } catch (EfiException $e) { 34 | print_r($e->code . "
"); 35 | print_r($e->error . "
"); 36 | print_r($e->errorDescription) . "
"; 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/statements/management/listStatementRecurrences.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | try { 24 | $api = new EfiPay($options); 25 | $response = $api->listStatementRecurrences(); 26 | 27 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 28 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 29 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 30 | } else { 31 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 32 | } 33 | } catch (EfiException $e) { 34 | print_r($e->code . "
"); 35 | print_r($e->error . "
"); 36 | print_r($e->errorDescription) . "
"; 37 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 38 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 39 | } 40 | } catch (Exception $e) { 41 | print_r($e->getMessage()); 42 | } 43 | -------------------------------------------------------------------------------- /examples/statements/management/updateStatementRecurrency.php: -------------------------------------------------------------------------------- 1 | $autoload."); 11 | } 12 | require_once $autoload; 13 | 14 | use Efi\Exception\EfiException; 15 | use Efi\EfiPay; 16 | 17 | $optionsFile = __DIR__ . "/../../credentials/options.php"; 18 | if (!file_exists($optionsFile)) { 19 | die("Options file not found or on path $options."); 20 | } 21 | $options = include $optionsFile; 22 | 23 | $params = [ 24 | "identificador" => "diario" // "diario", "semanal", "mensal" 25 | ]; 26 | 27 | $body = [ 28 | "periodicidade" => "diario", // "diario", "semanal", "mensal" 29 | "envia_email" => true, 30 | "comprimir_arquivos" => false, 31 | "status" => "ativo" // "ativo" ou "inativo" 32 | ]; 33 | 34 | try { 35 | $api = new EfiPay($options); 36 | $response = $api->updateStatementRecurrency($params, $body); 37 | 38 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 39 | print_r("
" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 40 | print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 41 | } else { 42 | print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 43 | } 44 | } catch (EfiException $e) { 45 | print_r($e->code . "
"); 46 | print_r($e->error . "
"); 47 | print_r($e->errorDescription) . "
"; 48 | if (isset($options["responseHeaders"]) && $options["responseHeaders"]) { 49 | print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
"); 50 | } 51 | } catch (Exception $e) { 52 | print_r($e->getMessage()); 53 | } 54 | -------------------------------------------------------------------------------- /src/Efi/BaseModel.php: -------------------------------------------------------------------------------- 1 | properties)) { 18 | return $this->properties[$property]; 19 | } 20 | 21 | if (property_exists($this, $property)) { 22 | return $this->$property; 23 | } 24 | 25 | return null; 26 | } 27 | 28 | /** 29 | * Magic method to set the value of a property. 30 | * 31 | * @param string $property The name of the property. 32 | * @param mixed $value The value to set. 33 | */ 34 | public function __set(string $property, $value) 35 | { 36 | if (property_exists($this, $property)) { 37 | $this->$property = $value; 38 | } 39 | 40 | $this->properties[$property] = $value; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Efi/Endpoints/Config.php: -------------------------------------------------------------------------------- 1 | [ 12 | "CHARGES" => $charges, 13 | "PIX" => $pix, 14 | "OPEN-FINANCE" => $openFinance, 15 | "PAYMENTS" => $payments, 16 | "OPENING-ACCOUNTS" => $openingAccounts, 17 | "STATEMENTS" => $statements, 18 | ] 19 | ]; 20 | -------------------------------------------------------------------------------- /src/Efi/Endpoints/OpeningAccounts.php: -------------------------------------------------------------------------------- 1 | [ 5 | "production" => "https://abrircontas.api.efipay.com.br", 6 | "sandbox" => "https://abrircontas-h.api.efipay.com.br" 7 | ], 8 | "ENDPOINTS" => [ 9 | "authorize" => [ 10 | "route" => "/v1/oauth/token", 11 | "method" => "post" 12 | ], 13 | "createAccount" => [ 14 | "route" => "/v1/conta-simplificada", 15 | "method" => "post", 16 | "scope" => "gn.registration.write" 17 | ], 18 | "getAccountCredentials" => [ 19 | "route" => "/v1/conta-simplificada/:idContaSimplificada/credenciais", 20 | "method" => "get", 21 | "scope" => "gn.registration.read" 22 | ], 23 | "createAccountCertificate" => [ 24 | "route" => "/v1/conta-simplificada/:idContaSimplificada/certificado", 25 | "method" => "post", 26 | "scope" => "gn.registration.read" 27 | ], 28 | "accountConfigWebhook" => [ 29 | "route" => "/v1/webhook", 30 | "method" => "post", 31 | "scope" => "gn.registration.webhook.write" 32 | ], 33 | "accountListWebhook" => [ 34 | "route" => "/v1/webhooks", 35 | "method" => "get", 36 | "scope" => "gn.registration.webhook.read" 37 | ], 38 | "accountDetailWebhook" => [ 39 | "route" => "/v1/webhook/:identificadorWebhook", 40 | "method" => "get", 41 | "scope" => "gn.registration.webhook.read" 42 | ], 43 | "accountDeleteWebhook" => [ 44 | "route" => "/v1/webhook/:identificadorWebhook", 45 | "method" => "delete", 46 | "scope" => "gn.registration.webhook.write" 47 | ] 48 | ] 49 | ]; 50 | -------------------------------------------------------------------------------- /src/Efi/Endpoints/Payments.php: -------------------------------------------------------------------------------- 1 | [ 5 | "production" => "https://pagarcontas.api.efipay.com.br", 6 | "sandbox" => null 7 | ], 8 | "ENDPOINTS" => [ 9 | "authorize" => [ 10 | "route" => "/v1/oauth/token", 11 | "method" => "post" 12 | ], 13 | "payDetailBarCode" => [ 14 | "route" => "/v1/codBarras/:codBarras", 15 | "method" => "get", 16 | "scope" => "gn.barcode.read" 17 | ], 18 | "payRequestBarCode" => [ 19 | "route" => "/v1/codBarras/:codBarras", 20 | "method" => "post", 21 | "scope" => "gn.barcode.pay.write" 22 | ], 23 | "payDetailPayment" => [ 24 | "route" => "/v1/:idPagamento", 25 | "method" => "get", 26 | "scope" => "gn.barcode.read" 27 | ], 28 | "payListPayments" => [ 29 | "route" => "/v1/resumo", 30 | "method" => "get", 31 | "scope" => "gn.barcode.read" 32 | ], 33 | "payConfigWebhook" => [ 34 | "route" => "/v1/webhook", 35 | "method" => "put", 36 | "scope" => "payment.webhook.write" 37 | ], 38 | "payDeleteWebhook" => [ 39 | "route" => "/v1/webhook", 40 | "method" => "delete", 41 | "scope" => "payment.webhook.write" 42 | ], 43 | "payListWebhook" => [ 44 | "route" => "/v1/webhook", 45 | "method" => "get", 46 | "scope" => "payment.webhook.read" 47 | ] 48 | ] 49 | ]; 50 | -------------------------------------------------------------------------------- /src/Efi/Endpoints/Statements.php: -------------------------------------------------------------------------------- 1 | [ 5 | "production" => "https://extratos.api.efipay.com.br", 6 | "sandbox" => null 7 | ], 8 | "ENDPOINTS" => [ 9 | "authorize" => [ 10 | "route" => "/v1/oauth/token", 11 | "method" => "post" 12 | ], 13 | "listStatementFiles" => [ 14 | "route" => "/v1/extrato-cnab/arquivos", 15 | "method" => "get", 16 | "scope" => "gn.cnab-statement.statement.read" 17 | ], 18 | "getStatementFile" => [ 19 | "route" => "/v1/extrato-cnab/download/:nome_arquivo", 20 | "method" => "get", 21 | "scope" => "gn.cnab-statement.statement.read" 22 | ], 23 | "listStatementRecurrences" => [ 24 | "route" => "/v1/extrato-cnab/agendamentos", 25 | "method" => "get", 26 | "scope" => "gn.cnab-statement.statement.read" 27 | ], 28 | "createStatementRecurrency" => [ 29 | "route" => "/v1/extrato-cnab/agendar", 30 | "method" => "post", 31 | "scope" => "gn.cnab-statement.statement.write" 32 | ], 33 | "updateStatementRecurrency" => [ 34 | "route" => "/v1/extrato-cnab/agendar/:identificador", 35 | "method" => "patch", 36 | "scope" => "gn.cnab-statement.statement.write" 37 | ], 38 | "createSftpKey" => [ 39 | "route" => "/v1/extrato-cnab/gerar-chaves", 40 | "method" => "post", 41 | "scope" => "gn.cnab-statement.statement.write" 42 | ], 43 | ] 44 | ]; 45 | -------------------------------------------------------------------------------- /src/Efi/Exception/ChargesException.php: -------------------------------------------------------------------------------- 1 | code = $error['code'] ?? $code; 19 | $this->error = self::getErrorTitle($error, $this->code); 20 | $this->errorDescription = self::getErrorDescription($error, $this->code); 21 | 22 | parent::__construct($this->errorDescription, $this->code); 23 | } 24 | 25 | private static function getErrorTitle(array $error, int $code): string 26 | { 27 | if (isset($error['error']) && is_string($error['error'])) { 28 | return $error['error']; 29 | } 30 | return $code === 401 ? 'unauthorized' : 'request_error'; 31 | } 32 | 33 | private function getErrorDescription(array $error, int $code): string 34 | { 35 | $description = ''; 36 | if (isset($error['error_description'])) { 37 | if (is_array($error['error_description'])) { 38 | $description = isset($error['error_description']['message']) 39 | ? 'Propriedade: "' . $error['error_description']['property'] . '". ' . $error['error_description']['message'] 40 | : $error['error_description']; 41 | } else { 42 | $description = ($code === 401) ? 'Credenciais inválidas ou inativas' : $error['error_description']; 43 | } 44 | } elseif (isset($error['error']) && isset($error['error_description'])) { 45 | $description = $error['error_description']; 46 | } elseif (isset($error['sprintfParams']) && is_string($error['sprintfParams'])) { 47 | $description = $error['sprintfParams']; 48 | } else { 49 | $description = 'Ocorreu um erro. Entre em contato com o suporte Efí para mais detalhes.'; 50 | } 51 | return $description; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Efi/Exception/OpenFinanceException.php: -------------------------------------------------------------------------------- 1 | code = $code; 19 | $this->error = self::getErrorTitle($error, $this->code); 20 | $this->errorDescription = self::getErrorDescription($error, $this->code); 21 | 22 | parent::__construct($this->errorDescription, $this->code); 23 | } 24 | 25 | private static function getErrorTitle(array $error, int $code): string 26 | { 27 | return $error['nome'] ?? $error['error'] ?? ($code === 401 ? 'unauthorized' : 'request_error'); 28 | } 29 | 30 | private function getErrorDescription(array $error, int $code): string 31 | { 32 | return $error['mensagem'] ?? $error['error_description'] ?? (($code === 401) ? 'Credenciais inválidas ou inativas' : 'Ocorreu um erro. Entre em contato com o suporte Efí para mais detalhes.'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Efi/Exception/OpeningAccountsException.php: -------------------------------------------------------------------------------- 1 | code = $code; 19 | $this->error = self::getErrorTitle($error, $this->code); 20 | $this->errorDescription = self::getErrorDescription($error, $this->code); 21 | 22 | parent::__construct($this->errorDescription, $this->code); 23 | } 24 | 25 | private static function getErrorTitle(array $error, int $code): string 26 | { 27 | return $error['nome'] ?? $error['error'] ?? ($code === 401 ? 'unauthorized' : 'Precondition failed'); 28 | } 29 | 30 | private function getErrorDescription(array $error, int $code): string 31 | { 32 | return $error['mensagem'] ?? $error['error_description'] ?? (($code === 401) ? 'Credenciais inválidas ou inativas' : 'Acesse a documentação API Efí para mais detalhes do código de erro.'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Efi/Exception/PaymentsException.php: -------------------------------------------------------------------------------- 1 | code = $code; 19 | $this->error = self::getErrorTitle($error, $this->code); 20 | $this->errorDescription = self::getErrorDescription($error, $this->code); 21 | 22 | parent::__construct($this->errorDescription, $this->code); 23 | } 24 | 25 | private static function getErrorTitle(array $error, int $code): string 26 | { 27 | return $error['nome'] ?? $error['error'] ?? ($code === 401 ? 'unauthorized' : 'request_error'); 28 | } 29 | 30 | private function getErrorDescription(array $error, int $code): string 31 | { 32 | return $error['mensagem'] ?? $error['error_description'] ?? (($code === 401) ? 'Credenciais inválidas ou inativas' : 'Ocorreu um erro. Entre em contato com o suporte Efí para mais detalhes.'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Efi/Exception/StatementsException.php: -------------------------------------------------------------------------------- 1 | code = $code; 19 | $this->error = self::getErrorTitle($error, $this->code); 20 | $this->errorDescription = self::getErrorDescription($error, $this->code); 21 | 22 | parent::__construct($this->errorDescription, $this->code); 23 | } 24 | 25 | private static function getErrorTitle(array $error, int $code): string 26 | { 27 | return $error['nome'] ?? $error['error'] ?? ($code === 401 ? 'unauthorized' : 'request_error'); 28 | } 29 | 30 | private function getErrorDescription(array $error, int $code): string 31 | { 32 | return $error['mensagem'] ?? $error['error_description'] ?? (($code === 401) ? 'Credenciais inválidas ou inativas' : 'Ocorreu um erro. Entre em contato com o suporte Efí para mais detalhes.'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Efi/Response.php: -------------------------------------------------------------------------------- 1 | body = $body; 21 | $this->headers = $headers; 22 | } 23 | 24 | /** 25 | * Magic getter method to access the properties of the exception. 26 | * 27 | * @param string $property The property name. 28 | * @return mixed|null The value of the property or null if it doesn't exist. 29 | */ 30 | public function __get($property) 31 | { 32 | if (property_exists($this, $property)) { 33 | return $this->$property; 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Efi/Utils.php: -------------------------------------------------------------------------------- 1 |