parceladousa / gateway
Package to assist in payment integration with ParceladoUSA
1.0.4
2022-05-11 17:58 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
- klebervmv/easycurl: 1.0.*
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This package was developed to facilitate integration with ParceladoUSA new API via PHP.
Installation
Gateway ParceladoUSA is available via Composer:
"parceladousa/gateway": "1.0.*"
or run
composer require parceladousa/gateway
Documentation
Details of Construct:
The construct has 4 parameters mandatory:
1° pubKey - API Key;
2° merchantCode - Account code with ParceladoUSA;
3° environment - Type of environment where the integration will be performed, ParceladoUSA::SANDBOX or ParceladoUSA::PRODUCTION;
4° callback - URL Where the payment status must be informed.
OBS.: The callback route is used to redirect the paying customer to your environment, a parameter will be added to it after the address provided which is the order ID
Construct:
<?php use Parceladousa\ParceladoUSA; require '../vendor/autoload.php'; $gateway = new ParceladoUSA( 'pubKey', 'merchantCode', ParceladoUSA::SANDBOX, "https://urlcallback" );
Example of transaction creation:
<?php //Transaction creation $data = new stdClass(); $data->amount = 99.99; $data->invoice = 'Invoice Text'; $data->currency = ParceladoUSA::AMERICANCURRENCY; $data->name = 'Customer Name'; $data->email = 'email@domainofmail.com'; $data->phone = '(99)99999-9999'; $data->doc = '99999999999'; $data->cep = '99999999'; $data->address = 'Street'; $data->addressNumber = '1'; $data->city = 'City'; $data->state = 'ST'; $gateway->requestPaymentOrder($data); var_dump($gateway->getResult());
Example of transaction query:
<?php //Transaction query $gateway->consultPaymentOrder('orderId'); var_dump($gateway->getResult());
Example of values query:
<?php //Values query $data = new stdClass(); $data->amount = 56.89; $gateway->calculateValues($data); var_dump($gateway->getResult());