PHP code example of ragboyjr / go-to-billing-client
1. Go to this page and download the library: Download ragboyjr/go-to-billing-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ragboyjr / go-to-billing-client example snippets
use Ragboyjr\GoToBilling;
$client = new GoToBilling\GuzzleGoToBillingApiClient(
new GoToBilling\Config($user, $pin, $debug = $true)
);
$merchant = new GoToBilling\Model\Merchant('127.0.0.1');
$customer = new GoToBilling\Model\Customer('0');
$customer->first_name = "RJ";
$customer->last_name = "Garcia";
$ach = new GoToBilling\Model\ACHTransaction('DH', '1', '1.00', GoToBilling\Model\ACHPaymentType::WEB);
$ach->ach_account = '000123456789';
$ach->ach_route = '110000000';
$ach->ach_account_type = GoToBilling\Model\ACHAccountType::PERSONAL_CHECKING;
$ach->ach_verification = true;
$resp = $client->transact(new GoToBilling\Model\Request($merchant, $customer, $ach));
var_dump($resp->getBody());
$cc = CCTransaction::createWithCard(
TransactionType::AUTHORIZE_CAPTURE,
uniqid(),
'123.40',
new Card('370000000000002', '0521', '999')
);
$resp = $client->transact(new Request($merchant, $customer, $cc));
$resp->getTicketId(); // return the ticket id
$resp->getStatus(); // return the transaction status
$resp->isApproved(); // check if status is approved
$resp->isReceived(); // check if status is received
$resp->isDeclined(); // check if status is declined
$resp->isCancelled(); // check if status is cancelled
$resp->isTimeout(); // check if status is timeout
use Ragboyjr\GoToBilling;
$client = GoToBilling\GoToBillingSoapApiClient::createFromConfig(
new GoToBilling\Config($user, $pin, $debug = $true)
);
$client->getAccounts();
$client->getTransactions([
'po_number' => '1234'
]);
// return the inner soap client
$soap = $client->getSoapClient();
use Ragboyjr\GoToBilling;
// you can use these env vars to configure the GoToBilling\Config entity or just extend it in pimple.
putenv('GO_TO_BILLING_MERCHANT_ID={id}');
putenv('GO_TO_BILLING_MERCHANT_PIN={pin}');
putenv('GO_TO_BILLING_DEBUG=1');
$pimple->register(new GoToBilling\Provider\Pimple\GoToBillingServiceProvider(), [
'ragboyjr.go_to_billing.soap_options' => [
// any SoapClient options can go here
]
]);
$rest_api = $pimple[GoToBilling\GoToBillingApi::class];
$soap_api = $pimple[GoToBilling\GoToBillingSoapApi::class];
use Ragboyjr\GoToBilling\Provider\Laravel\GoToBillingServiceProvider;
// in your app service provider
$this->app->register(GoToBillingServiceProvider::class);
// configure soap options
$this->app['config']->set('go_to_billing.soap_options', [
// soap options go here
]);
// then you can use the following services
$rest_api = app('Ragboyjr\GoToBilling\GoToBillingApi');
$soap_api = app('Ragboyjr\GoToBilling\GoToBillingSoapApi');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.