{"id":16728381,"url":"https://github.com/ragboyjr/go-to-billing-client-php","last_synced_at":"2025-03-15T16:21:25.722Z","repository":{"id":62532739,"uuid":"87684590","full_name":"ragboyjr/go-to-billing-client-php","owner":"ragboyjr","description":"Go To Billing API PHP Client","archived":false,"fork":false,"pushed_at":"2017-08-11T00:46:12.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T06:15:53.116Z","etag":null,"topics":["api-client","go-to-billing"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ragboyjr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-09T05:13:27.000Z","updated_at":"2024-10-02T22:40:04.000Z","dependencies_parsed_at":"2022-11-02T14:45:54.767Z","dependency_job_id":null,"html_url":"https://github.com/ragboyjr/go-to-billing-client-php","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragboyjr%2Fgo-to-billing-client-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragboyjr%2Fgo-to-billing-client-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragboyjr%2Fgo-to-billing-client-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragboyjr%2Fgo-to-billing-client-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ragboyjr","download_url":"https://codeload.github.com/ragboyjr/go-to-billing-client-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243754764,"owners_count":20342702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","go-to-billing"],"created_at":"2024-10-12T23:10:08.093Z","updated_at":"2025-03-15T16:21:25.700Z","avatar_url":"https://github.com/ragboyjr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go To Billing API Client\n\nSimple PHP Client for interacting with the Go To Billing API.\n\n## Installation\n\nInstall with composer at `ragboyjr/go-to-billing-client`\n\n## Usage\n\n```php\n\u003c?php\n\nuse Ragboyjr\\GoToBilling;\n\n$client = new GoToBilling\\GuzzleGoToBillingApiClient(\n    new GoToBilling\\Config($user, $pin, $debug = $true)\n);\n\n$merchant = new GoToBilling\\Model\\Merchant('127.0.0.1');\n$customer = new GoToBilling\\Model\\Customer('0');\n$customer-\u003efirst_name = \"RJ\";\n$customer-\u003elast_name = \"Garcia\";\n$ach = new GoToBilling\\Model\\ACHTransaction('DH', '1', '1.00', GoToBilling\\Model\\ACHPaymentType::WEB);\n$ach-\u003each_account = '000123456789';\n$ach-\u003each_route = '110000000';\n$ach-\u003each_account_type = GoToBilling\\Model\\ACHAccountType::PERSONAL_CHECKING;\n$ach-\u003each_verification = true;\n\n$resp = $client-\u003etransact(new GoToBilling\\Model\\Request($merchant, $customer, $ach));\nvar_dump($resp-\u003egetBody());\n```\n\nThis will print something out like:\n\n```\narray(7) {\n  [\"status\"]=\u003e\n  string(1) \"R\"\n  [\"order_number\"]=\u003e\n  string(29) \"238665-20170408-58e982c1d0607\"\n  [\"term_code\"]=\u003e\n  string(1) \"0\"\n  [\"tran_amount\"]=\u003e\n  string(4) \"1.00\"\n  [\"tran_date\"]=\u003e\n  string(8) \"20170408\"\n  [\"tran_time\"]=\u003e\n  string(6) \"193929\"\n  [\"invoice_id\"]=\u003e\n  string(1) \"1\"\n}\n```\n\nThe Model objects reflect the GoToBilling documentation request fields. You can look through the source code to see the supported request types.\n\n### Transaction Responses\n\nTransaction Responses also have a few helper methods for grabbing data from the response. Here's an example with a CC auth and capture using the same client and merchant details as above.\n\n```php\n\u003c?php\n\n$cc = CCTransaction::createWithCard(\n    TransactionType::AUTHORIZE_CAPTURE,\n    uniqid(),\n    '123.40',\n    new Card('370000000000002', '0521', '999')\n);\n\n$resp = $client-\u003etransact(new Request($merchant, $customer, $cc));\n\n$resp-\u003egetTicketId(); // return the ticket id\n$resp-\u003egetStatus(); // return the transaction status\n$resp-\u003eisApproved(); // check if status is approved\n$resp-\u003eisReceived(); // check if status is received\n$resp-\u003eisDeclined(); // check if status is declined\n$resp-\u003eisCancelled(); // check if status is cancelled\n$resp-\u003eisTimeout(); // check if status is timeout\n```\n\n### Soap Api\n\nYou can also utilize the soap api with the `GoToBillingSoapApiClient`\n\n```php\n\u003c?php\n\nuse Ragboyjr\\GoToBilling;\n\n$client = GoToBilling\\GoToBillingSoapApiClient::createFromConfig(\n    new GoToBilling\\Config($user, $pin, $debug = $true)\n);\n$client-\u003egetAccounts();\n$client-\u003egetTransactions([\n    'po_number' =\u003e '1234'\n]);\n// return the inner soap client\n$soap = $client-\u003egetSoapClient();\n```\n\nThe SoapApiClient will forward all calls to the internal php SoapClient class. However, it will inject an instance of `Ragboyjr\\GoToBilling\\Model\\Soap\\MerchantAuth` as the first parameter so that you don't have to for each call.\n\n### Pimple Service Provider\n\nYou can also use the Pimple service provider to create the services.\n\n```php\n\u003c?php\n\nuse Ragboyjr\\GoToBilling;\n\n// you can use these env vars to configure the GoToBilling\\Config entity or just extend it in pimple.\nputenv('GO_TO_BILLING_MERCHANT_ID={id}');\nputenv('GO_TO_BILLING_MERCHANT_PIN={pin}');\nputenv('GO_TO_BILLING_DEBUG=1');\n\n$pimple-\u003eregister(new GoToBilling\\Provider\\Pimple\\GoToBillingServiceProvider(), [\n    'ragboyjr.go_to_billing.soap_options' =\u003e [\n        // any SoapClient options can go here\n    ]\n]);\n$rest_api = $pimple[GoToBilling\\GoToBillingApi::class];\n$soap_api = $pimple[GoToBilling\\GoToBillingSoapApi::class];\n```\n\n### Laravel Service Provider\n\n```php\n\u003c?php\n\nuse Ragboyjr\\GoToBilling\\Provider\\Laravel\\GoToBillingServiceProvider;\n\n// in your app service provider\n$this-\u003eapp-\u003eregister(GoToBillingServiceProvider::class);\n// configure soap options\n$this-\u003eapp['config']-\u003eset('go_to_billing.soap_options', [\n    // soap options go here\n]);\n\n// then you can use the following services\n$rest_api = app('Ragboyjr\\GoToBilling\\GoToBillingApi');\n$soap_api = app('Ragboyjr\\GoToBilling\\GoToBillingSoapApi');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragboyjr%2Fgo-to-billing-client-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragboyjr%2Fgo-to-billing-client-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragboyjr%2Fgo-to-billing-client-php/lists"}