{"id":23436602,"url":"https://github.com/optimisthub/moka-php","last_synced_at":"2025-08-09T05:33:19.716Z","repository":{"id":65496637,"uuid":"541372360","full_name":"optimisthub/moka-php","owner":"optimisthub","description":"Moka API PHP Client","archived":false,"fork":false,"pushed_at":"2023-05-22T20:16:53.000Z","size":29,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T04:13:12.150Z","etag":null,"topics":["moka-pay","moka-payment","moka-pos","optimist-hub","php-api-client","php-client"],"latest_commit_sha":null,"homepage":"","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/optimisthub.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":"2022-09-26T02:06:19.000Z","updated_at":"2024-09-23T00:06:29.000Z","dependencies_parsed_at":"2023-02-14T13:02:33.328Z","dependency_job_id":null,"html_url":"https://github.com/optimisthub/moka-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimisthub%2Fmoka-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimisthub%2Fmoka-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimisthub%2Fmoka-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimisthub%2Fmoka-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/optimisthub","download_url":"https://codeload.github.com/optimisthub/moka-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661720,"owners_count":21141451,"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":["moka-pay","moka-payment","moka-pos","optimist-hub","php-api-client","php-client"],"created_at":"2024-12-23T13:19:47.826Z","updated_at":"2025-08-09T05:33:19.683Z","avatar_url":"https://github.com/optimisthub.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moka United API PHP Client\r\n\r\nThe Moka United API PHP Client provides convenient access to the [Moka United API](https://developer.mokaunited.com/) from applications written in the PHP language.\r\n\r\n![image](https://optimisthub.com/cdn/moka/moka-api-php-client.png?v4)\r\n\r\n## Requirements\r\n\r\nPHP 5.6.0 and later.\r\n\r\n## Composer\r\n\r\nYou can install the bindings via [Composer](http://getcomposer.org/). Run the following command:\r\n\r\n```bash\r\ncomposer require moka/moka-php\r\n```\r\n\r\nTo use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):\r\n\r\n```php\r\nrequire_once('vendor/autoload.php');\r\n```\r\n\r\n## Manual Installation\r\n\r\nIf you do not wish to use Composer, you can download the [latest release](https://github.com/optimisthub/moka-php/releases). Then, to use the bindings, include the `autoload.php` file.\r\n\r\n```php\r\nrequire_once('autoload.php');\r\n```\r\n\r\n## Dependencies\r\n\r\nThe bindings require the following extensions in order to work properly:\r\n\r\n-   [`curl`](https://secure.php.net/manual/en/book.curl.php)\r\n-   [`json`](https://secure.php.net/manual/en/book.json.php)\r\n\r\nIf you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.\r\n\r\n# SSL / TLS\r\nPCI-DSS rules only allow the use of TLS 1.2 and above protocols. Please ensure that your application POST to Moka URL over these protocols. Otherwise, errors such as 'Connection will be closed or Connection Closed' will be received.\r\n\r\n## Getting Started\r\n\r\nSimple usage looks like\r\n\r\n```php\r\n$moka = new \\Moka\\MokaClient([\r\n    'dealerCode' =\u003e 'xxx',\r\n    'username' =\u003e 'xxx',\r\n    'password' =\u003e 'xxx',    \r\n]);\r\n```\r\nBy default PHP client connects to Live Environment URL: https://service.moka.com For testing purposes please use Test Environment URL: https://service.refmoka.com\r\n\r\n```php\r\n$moka = new \\Moka\\MokaClient([\r\n    'dealerCode' =\u003e 'xxx',\r\n    'username' =\u003e 'xxx',\r\n    'password' =\u003e 'xxx',    \r\n    'baseUrl' =\u003e 'https://service.refmoka.com'\r\n]);\r\n```\r\n## Create Payment\r\n\r\n```php\r\n$moka = new \\Moka\\MokaClient([\r\n    'dealerCode' =\u003e 'xxx',\r\n    'username' =\u003e 'xxx',\r\n    'password' =\u003e 'xxx',    \r\n]);\r\n\r\n$request = new Moka\\Model\\CreatePaymentRequest();\r\n\r\n$request-\u003esetCardHolderFullName('John Doe');\r\n$request-\u003esetCardNumber('5555666677778888');\r\n$request-\u003esetExpMonth('09');\r\n$request-\u003esetExpYear('2024');\r\n$request-\u003esetCvcNumber('123');\r\n$request-\u003esetAmount(0.01);\r\n$request-\u003esetCurrency('TL');\r\n$request-\u003esetInstallmentNumber(1);\r\n$request-\u003esetClientIp('192.168.1.116');\r\n$request-\u003esetOtherTrxCode('3D5ABC24-456\"');\r\n$request-\u003esetIsPoolPayment(0);\r\n$request-\u003esetIsTokenized(0);\r\n$request-\u003esetIntegratorId(0);\r\n$request-\u003esetSoftware('Software');\r\n$request-\u003esetDescription('');\r\n$request-\u003esetIsPreAuth(0);\r\n\r\n$buyer = new Moka\\Model\\Buyer();\r\n$buyer-\u003esetBuyerFullName('John Doe');\r\n$buyer-\u003esetBuyerGsmNumber('5551110022');\r\n$buyer-\u003esetBuyerEmail('email@email.com');\r\n$buyer-\u003esetBuyerAddress('Levent Mah. Meltem Sok. İş Kuleleri Kule 2 No: 10 / 4 Beşiktaş / İstanbul');\r\n\r\n$request-\u003esetBuyerInformation($buyer);\r\n\r\n$payment = $moka-\u003epayments()-\u003ecreate($request);\r\n\r\n$payment-\u003egetData();\r\n$payment-\u003egetResultCode();\r\n$payment-\u003egetResultMessage();\r\n$payment-\u003egetException();\r\n```\r\n## Documentation\r\n\r\nSee the [Moka United API docs](https://developer.mokaunited.com).\r\n\r\n## Test Cards\r\n\r\nSee the [Test Cards](https://developer.mokaunited.com/home.php?page=test-kartlari).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimisthub%2Fmoka-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptimisthub%2Fmoka-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimisthub%2Fmoka-php/lists"}