{"id":18851932,"url":"https://github.com/riskiofr/clearhaus-sdk-php","last_synced_at":"2025-10-15T10:44:38.140Z","repository":{"id":56953593,"uuid":"105261890","full_name":"RiskioFr/clearhaus-sdk-php","owner":"RiskioFr","description":"PHP SDK for the Clearhaus API","archived":false,"fork":false,"pushed_at":"2020-07-06T08:39:35.000Z","size":49,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-30T16:54:36.159Z","etag":null,"topics":["capture","card","clearhaus-api","httplug","money","refund","sdk-php"],"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/RiskioFr.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-09-29T10:47:02.000Z","updated_at":"2020-07-03T21:47:31.000Z","dependencies_parsed_at":"2022-08-21T04:10:24.898Z","dependency_job_id":null,"html_url":"https://github.com/RiskioFr/clearhaus-sdk-php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RiskioFr%2Fclearhaus-sdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RiskioFr%2Fclearhaus-sdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RiskioFr%2Fclearhaus-sdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RiskioFr%2Fclearhaus-sdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RiskioFr","download_url":"https://codeload.github.com/RiskioFr/clearhaus-sdk-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239789086,"owners_count":19697307,"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":["capture","card","clearhaus-api","httplug","money","refund","sdk-php"],"created_at":"2024-11-08T03:37:18.478Z","updated_at":"2025-10-15T10:44:33.091Z","avatar_url":"https://github.com/RiskioFr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Clearhaus PHP SDK\n=================\n\nSDK for Clearhaus API written in PHP and decoupled from any HTTP messaging client using HTTPlug.\n\nYou can sign up for a Clearhaus account at https://www.clearhaus.com/.\n\n[![Build Status](https://img.shields.io/travis/RiskioFr/clearhaus-sdk-php.svg?style=flat-square)](http://travis-ci.org/RiskioFr/clearhaus-sdk-php)\n[![Latest Stable Version](http://img.shields.io/packagist/v/clearhaus/sdk.svg?style=flat-square)](https://packagist.org/packages/clearhaus/sdk)\n[![Total Downloads](http://img.shields.io/packagist/dt/clearhaus/sdk.svg?style=flat-square)](https://packagist.org/packages/clearhaus/sdk)\n[![GitHub license](https://img.shields.io/github/license/RiskioFr/clearhaus-sdk-php.svg?style=flat-square)](https://github.com/RiskioFr/clearhaus-sdk-php/blob/master/LICENSE)\n\n## Requirements\n\n* PHP 7.0+\n* [php-http/client-common ^1.3](https://github.com/php-http/client-common)\n* [php-http/discovery ^1.0](https://github.com/php-http/discovery)\n* [php-http/httplug ^1.0](https://github.com/php-http/httplug)\n\n## Installation\n\nClearhaus SDK only officially supports installation through Composer. For Composer documentation, please refer to\n[getcomposer.org](http://getcomposer.org/).\n\nYou can install the module from command line:\n\n```sh\n$ composer require clearhaus/sdk\n```\n\n## Documentation\n\nPlease see http://docs.gateway.clearhaus.com for up-to-date documentation.\n\n### Authentication\n\nFor authentication, you must provide an API key that you will find in your account:\n\n```php\nuse Clearhaus\\Client;\n\n$client = new Client($apiKey);\n```\n\n### Signed requests\n\nThe signature is an RSA signature of the HTTP body; it is represented in Hex. The signee must be identified by the signing API-key.\n\n```php\nuse Clearhaus\\Client;\n\n$client-\u003eenableSignature();\n```\n\n### Authorizations\n\nTo reserve money on a cardholder’s bank account you make a new authorization resource.\n\n```php\n$authorization = $client-\u003eauthorizations-\u003eauthorize([\n    'amount' =\u003e 2050,\n    'currency' =\u003e 'EUR',\n    'ip' =\u003e '1.1.1.1',\n    'card' =\u003e [\n        'number' =\u003e '4111111111111111',\n        'expire_month' =\u003e '06',\n        'expire_year' =\u003e '2018',\n        'csc' =\u003e '123',\n    ],\n]);\n```\n\nYou can also use a card previously tokenized.\n\n```php\n$authorization = $client-\u003eauthorizations-\u003eauthorizeFromCardId($cardId, [\n    'amount' =\u003e 2050,\n    'currency' =\u003e 'EUR',\n    'ip' =\u003e '1.1.1.1',\n]);\n```\n\n### Captures\n\nTo transfer money from a cardholder’s bank account to your merchant bank account you make a new capture resource. You can make multiple captures for an authorization transaction.\n\n```php\n$client-\u003ecaptures-\u003ecapture($authorization['id']);\n```\n\nYou can withdraw a partial amount by providing an amount parameter:\n\n```php\n$client-\u003ecaptures-\u003ecapture($authorization['id'], ['amount' =\u003e 1000]);\n```\n\n### Refunds\n\nTo refund money to a cardholder’s bank account you make a new refund resource. You can make multiple refunds for an authorization transaction.\n\n```php\n$client-\u003erefunds-\u003erefund($authorization['id']);\n```\n\nYou can refund a partial amount by providing an amount parameter:\n\n```php\n$client-\u003erefunds-\u003erefund($authorization['id'], ['amount' =\u003e 500]);\n```\n\n### Voids\n\nTo release reserved money on a cardholder’s bank account you make a new void resource. A reservation normally last for 7 days depending on issuing bank and is then automatically released.\n\n```php\n$client-\u003evoids-\u003evoid($authorization['id']);\n```\n\n### Credits\n\nTo payout (e.g. winnings and not refunds) money to a cardholder’s bank account you make a new credit resource. You must have a card resource to make a credit transaction.\n\n```php\n$client-\u003ecredits-\u003ecredit($card['id'], [\n    'amount' =\u003e 2050,\n    'currency' =\u003e 'EUR',\n]);\n```\n\n### Cards\n\nA card resource (token) corresponds to a payment card and can be used to make a credit or authorization transaction without providing sensitive card data. A card resource must be used to make subsequent recurring authorization transactions.\n\n```php\n$card = $client-\u003ecards-\u003ecreateCard([\n    'card' =\u003e [\n        'number' =\u003e '4111111111111111',\n        'expire_month' =\u003e '06',\n        'expire_year' =\u003e '2018',\n        'csc' =\u003e '123',\n    ],\n]);\n```\n\n### Accounts\n\nThe account resource holds basic merchant account information.\n\n```php\n$account = $client-\u003eaccounts-\u003egetAccount();\n```\n\n### 3-D Secure\n\n3-D Secure is a protocol designed to improve security for online transactions. Before you continue please read more about this protocol at [3Dsecure.io](http://docs.3dsecure.io/).\n\nTo perform a 3-D Secure transaction you make an ordinary authorization including a pares value:\n\n```php\n$authorization = $client-\u003eauthorizations-\u003eauthorize([\n    'amount' =\u003e 2050,\n    'currency' =\u003e 'EUR',\n    'ip' =\u003e '1.1.1.1',\n    'card' =\u003e [\n        'number' =\u003e '4111111111111111',\n        'expire_month' =\u003e '06',\n        'expire_year' =\u003e '2018',\n        'csc' =\u003e '123',\n    ],\n    'threed_secure' =\u003e [\n        'pares' =\u003e '\u003csome-pares-value\u003e',\n    ],\n]);\n```\n\n## PSR-11 factory\n\nYou can use the predefined factory `Clearhaus\\Container\\ClientFactory` to instantiate a Clearhaus client:\n\n```php\nuse Clearhaus\\Container\\ClientFactory;\n\n$factory = new ClientFactory();\n$client = $factory($psrContainer);\n```\n\nThe client configuration must look like below:\n\n```php\nuse Clearhaus\\Client;\n\nreturn [\n    'clearhaus_sdk' =\u003e [\n        'api_key' =\u003e null, // Allow to provide API key that you will find in your account\n        'mode' =\u003e Client::MODE_TEST, // Allow to define the usage of either test or live accounts\n        'use_signature' =\u003e true, // Allow to configure the usage of request signature\n        'plugins' =\u003e [], // HTTPlug plugins that allow to add some processing logic\n    ],\n];\n```\n\n## Testing\n\n``` bash\n$ vendor/bin/phpspec run\n```\n\n## Credits\n\n- [Nicolas Eeckeloo](https://github.com/neeckeloo)\n- [All Contributors](https://github.com/RiskioFr/clearhaus-sdk-php/contributors)\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/RiskioFr/clearhaus-sdk-php/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friskiofr%2Fclearhaus-sdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friskiofr%2Fclearhaus-sdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friskiofr%2Fclearhaus-sdk-php/lists"}