{"id":15068552,"url":"https://github.com/terentev-space/qiwi-php-client","last_synced_at":"2025-04-10T17:44:16.256Z","repository":{"id":59294037,"uuid":"536030606","full_name":"terentev-space/qiwi-php-client","owner":"terentev-space","description":"Universal payments API SDK (UNOFFICIAL QIWI CLIENT)","archived":false,"fork":false,"pushed_at":"2022-09-14T08:19:38.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T15:22:01.928Z","etag":null,"topics":["client","php","php-library","php7","qiwi","qiwi-api","zorra"],"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/terentev-space.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-13T08:29:30.000Z","updated_at":"2023-01-11T10:27:25.000Z","dependencies_parsed_at":"2022-09-15T02:51:11.444Z","dependency_job_id":null,"html_url":"https://github.com/terentev-space/qiwi-php-client","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/terentev-space%2Fqiwi-php-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terentev-space%2Fqiwi-php-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terentev-space%2Fqiwi-php-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terentev-space%2Fqiwi-php-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terentev-space","download_url":"https://codeload.github.com/terentev-space/qiwi-php-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262299,"owners_count":21074283,"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":["client","php","php-library","php7","qiwi","qiwi-api","zorra"],"created_at":"2024-09-25T01:38:03.682Z","updated_at":"2025-04-10T17:44:16.239Z","avatar_url":"https://github.com/terentev-space.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Qiwi Php Client\n\n[![Latest Version](https://img.shields.io/github/release/terentev-space/qiwi-php-client.svg?style=flat-square)](https://github.com/terentev-space/qiwi-php-client/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n[![Total Downloads](https://img.shields.io/packagist/dt/terentev-space/qiwi-php-client.svg?style=flat-square)](https://packagist.org/packages/terentev-space/qiwi-php-client)\n\nEspecially for **[🦊 Zorra Telecom](https://zorra.com)** and **👥 Everyone else**\n\n## Привет\nAttention: At the moment the number of methods is very limited, they will be added later if QIWI does not make a normal alternative...\nВнимание: На данный момент количество методов сильно ограниченно, они будут добавлены позже, если QIWI не сделает нормальную альтернативу...\n\n## Минимальный набор API - ЕСТЬ\n\n#### ✅ [Создание счета](https://developer.qiwi.com/ru/payments/#invoice_put)\nЗапрос создает платежный счет.\n```\nPUT /payin/v1/sites/{siteId}/bills/{billId}\n```\n\n#### ✅ [Статус счета](https://developer.qiwi.com/ru/payments/#invoice-details)\nЗапрос предназначен для получения деталей платежного счета. В успешном ответе приходит список данных по счету и его платежам с запрошенным billId.\n```\nGET /payin/v1/sites/{siteId}/bills/{billId}/details\n```\n\n#### ❔ [Получение списка платежей по счету](https://developer.qiwi.com/ru/payments/#invoice-payments)\nПолучение списка платежей по счету\n```\nGET /payin/v1/sites/{siteId}/bills/{billId}\n```\n_МОЖНО ИСПОЛЬЗОВАТЬ: [Статус счета](https://developer.qiwi.com/ru/payments/#invoice-details)_\n\n#### ❌ [Платеж](https://developer.qiwi.com/ru/payments/#payments)\nЗапрос создает платежную транзакцию.\n```\nPUT /payin/v1/sites/{siteId}/payments/{paymentId}\n```\n_ПОКА НЕ ПРИГОДИЛСЯ_\n#### ❔ [Статус платежа](https://developer.qiwi.com/ru/payments/#payment_get)\nПолучить информацию о платежной транзакции.\n```\nGET /payin/v1/sites/{siteId}/payments/{paymentId}\n```\n_ПОКА НЕ ПРИГОДИЛСЯ_\n\n_МОЖНО ИСПОЛЬЗОВАТЬ: [Статус счета](https://developer.qiwi.com/ru/payments/#invoice-details)_\n\n#### ❌ [Завершение аутентификации клиента](https://developer.qiwi.com/ru/payments/#payment_complete)\nПосле успешного прохождения дополнительной аутентификации, ТСП необходимо отправить запрос с параметрами соответствующими типу дополнительной аутентификации для завершения проверки.\n```\nPOST /payin/v1/sites/{siteId}/payments/{paymentId}/complete\n```\n_ПОКА НЕ ПРИГОДИЛСЯ_\n\n#### ❌ [Подтверждение платежа](https://developer.qiwi.com/ru/payments/#capture)\nПодтверждает платеж после холдирования средств. Если используется двухшаговый сценарий, то мерчанту необходимо отправить этот запрос после авторизации платежа.\n```\nPUT /payin/v1/sites/{siteId}/payments/{paymentId}/captures/{captureId}\n```\n_ПОКА НЕ ПРИГОДИЛСЯ_\n\n#### ❌ [Статус подтверждения](https://developer.qiwi.com/ru/payments/#capture_get)\nЗапрашивает статус указанного подтверждения платежа.\n```\nGET /payin/v1/sites/{siteId}/payments/{paymentId}/captures/{captureId}\n```\n_ПОКА НЕ ПРИГОДИЛСЯ_\n\n#### ❌ [Операция возврата](https://developer.qiwi.com/ru/payments/#refund-api)\nЗапрос предназначен для возврата средств по завершенному платежу. ТСП может выполнить несколько запросов для возврата частичных сумм.\n```\nPUT /payin/v1/sites/{siteId}/payments/{paymentId}/refunds/{refundId}\n```\n_ПОКА НЕ ПРИГОДИЛСЯ_\n\n## Install\n\n#### Composer\n```shell\ncomposer require terentev-space/qiwi-php-client\n```\n\n## Usage\n\n1) Set up QIWI: https://developer.qiwi.com/ru/payments/#start\n2) Connect the library\n3) Prepare\n```php\n// Factories\n$configFactory = new \\QiwiClient\\Factories\\ConfigFactory();\n$clientFactory = new \\QiwiClient\\Factories\\ClientFactory();\n\n// Make Config\n$config = $configFactory-\u003emake(\n    'siteId',\n    'token',\n    'publicKey' // optional\n);\n/* OR */\n$config = new \\QiwiClient\\Entities\\ClientConfig(\n    'siteId',\n    'publicKey',\n    'token'\n);\n\n// Make Client\n$client = $clientFactory-\u003emake(\n    'siteId',\n    'token',\n    'publicKey' // optional\n);\n/* OR */\n$client = Qiwi::client(\n    'siteId',\n    'token'\n);\n/* OR */\n$client = new \\QiwiClient\\Client(\n    $config,\n    new \\GuzzleHttp\\Client(),\n    new \\Psr\\Log\\NullLogger()\n);\n```\n4) Use\n```php\n$billId = '...';\n\n$amount = 1.01;\n/* OR */\n$amount = 1.019; // = 1.01\n\n$currency = Qiwi::CURRENCY_RUB;\n/* OR */\n$currency = 'RUB';\n\n$expiration = null; // +1 day\n/* OR */\n$expiration = '2022-01-01T00:00:00+00:00';\n/* OR */\n$expiration = new DateTime();\n/* OR */\n$expiration = $datetime-\u003eformat(\\QiwiClient\\Qiwi::DATETIME_FORMAT);\n\n$flags = [\n    \\QiwiClient\\Qiwi::FLAG_SALE, // optional\n    \\QiwiClient\\Qiwi::FLAG_BIND_PAYMENT_TOKEN, // optional\n];\n\n$account = 'string(64) - id';\n$email = 'string(64) or null - email';\n$phone = 'string(15) or null - phone';\n\n$country = 'string(1000) or null';\n$city = 'string(1000) or null';\n$region = 'string(1000) or null';\n$details = 'string(1000) or null';\n\n$pan = 'string(19) or null';\n$wallet = 'string(64) or null';\n$inn = 'string(12) or null';\n$phone = 'string(15) or null';\n$bankAccount = 'string(20) or null';\n$bic = 'string(9) or null';\n\n$cf1 = 'string(256) or null';\n$cf2 = 'string(256) or null';\n$cf3 = 'string(256) or null';\n$cf4 = 'string(256) or null';\n$cf5 = 'string(256) or null';\n$merchantThemeCode = 'string(256) or null';\n$merchantContractId = 'string(256) or null';\n$merchantBookingNumber = 'string(256) or null';\n$merchantPhone = 'string(256) or null';\n$merchantFullName = 'string(256) or null';\n$invoiceCallbackUrl = 'string(256) or null';\n\n/** @var array $cheque Данные чека для операции. */\n$cheque = [/* ... */];\n\n$request = PaySiteBillQuery::make($billId, $amount, $currency)\n    -\u003esetExpirationDateTime($expiration) // optional\n    -\u003esetFlags(...$flags) // optional\n    -\u003esetCustomer(\n        $account,\n        $email, // optional\n        $phone // optional\n    ) // optional\n    -\u003esetAddress(\n        $country, // optional\n        $city, // optional\n        $region, // optional\n        $details // optional\n    ) // optional\n    -\u003esetReceiverData(\n        $pan, // optional\n        $wallet, // optional\n        $inn, // optional\n        $phone, // optional\n        $bankAccount, // optional\n        $bic // optional\n    ) // optional\n    -\u003esetCustomFields(\n        $cf1, // optional\n        $cf2, // optional\n        $cf3, // optional\n        $cf4, // optional\n        $cf5, // optional\n        $merchantThemeCode, // optional\n        $merchantContractId, // optional\n        $merchantBookingNumber, // optional\n        $merchantPhone, // optional\n        $merchantFullName, // optional\n        $invoiceCallbackUrl // optional\n    ) // optional\n    -\u003esetCheque($cheque)\n;\n/* OR */\n$request = [\n    'billId' =\u003e $billId,\n    'amount' =\u003e [\n        'value' =\u003e $amount,\n        'currency' =\u003e $currency,\n    ],\n    'expirationDateTime' =\u003e $expiration,\n    'flags' =\u003e $flags,\n    'customer' =\u003e [\n        'account' =\u003e $account,\n        'email' =\u003e $email,\n        'phone' =\u003e $phone,\n    ],\n    'address' =\u003e [\n        'country' =\u003e $country,\n        'city' =\u003e $city,\n        'region' =\u003e $region,\n        'details' =\u003e $details,\n    ],\n    'receiverData' =\u003e [\n        'pan' =\u003e $pan,\n        'wallet' =\u003e $wallet,\n        'inn' =\u003e $inn,\n        'phone' =\u003e $phone,\n        'bankAccount' =\u003e $bankAccount,\n        'bic' =\u003e $bic,\n    ],\n    'customFields' =\u003e [\n        'cf1' =\u003e $cf1,\n        'cf2' =\u003e $cf2,\n        'cf3' =\u003e $cf3,\n        'cf4' =\u003e $cf4,\n        'cf5' =\u003e $cf5,\n        'merchantThemeCode' =\u003e $merchantThemeCode,\n        'merchantContractId' =\u003e $merchantContractId,\n        'merchantBookingNumber' =\u003e $merchantBookingNumber,\n        'merchantPhone' =\u003e $merchantPhone,\n        'merchantFullName' =\u003e $merchantFullName,\n        'invoiceCallbackUrl' =\u003e $invoiceCallbackUrl,\n    ],\n    'cheque' =\u003e $cheque,\n];\n\n$response = $client-\u003epaySiteBill($request);\n$response-\u003egetCode(); // Response code 200\n$response-\u003egetBody(); // Response data array\n/** @var \\QiwiClient\\Entities\\Results\\PaySiteBillResult $data */\n$data = $response-\u003eparseData();\n\n// ...\n$billId = $data-\u003egetBillId();\n// 1.01\n$amount = $data-\u003egetAmountValue();\n// RUB\n$currency = $data-\u003egetAmountCurrency();\n// 2000-00-00T00:00:00+00:00\n$exp = $data-\u003egetExpirationDateTime();\n// 00000000-0000-0000-0000-000000000000\n$invoice = $data-\u003egetInvoiceUid();\n// CREATED\n$status = $data-\u003egetStatusValue();\n// 2000-00-00T00:00:00+00:00\n$statusChanged = $data-\u003egetStatusChangedDateTime();\n// https://oplata.qiwi.com/form?invoiceUid=00000000-0000-0000-0000-000000000000\n$url = $data-\u003egetPayUrl();\n\n$response = $client-\u003egetSiteBillDetails('1663126085');\n$response-\u003egetCode(); // Response code 200\n$response-\u003egetBody(); // Response data array\n/** @var \\QiwiClient\\Entities\\Results\\GetSiteBillDetailsResult $data */\n$data = $response-\u003eparseData();\n\n// ...\n$billId = $data-\u003egetBillId();\n// 1.01\n$amount = $data-\u003egetAmountValue();\n// RUB\n$currency = $data-\u003egetAmountCurrency();\n// CREATED\n$status = $data-\u003egetStatusValue();\n// 2000-00-00T00:00:00+00:00\n$statusChanged = $data-\u003egetStatusChangedDateTime();\n/* ... */\n// https://oplata.qiwi.com/form?invoiceUid=00000000-0000-0000-0000-000000000000\n$url = $data-\u003egetPayUrl();\n\n/** @var \\QiwiClient\\Entities\\Items\\SiteBillPayment $payment */\n$payment = $data-\u003egetPayments()[0];\n\n// siteId\n$siteId = $payment-\u003egetSiteId();\n// ...\n$billId = $payment-\u003egetBillId();\n// 1.01\n$amount = $payment-\u003egetAmountValue();\n// RUB\n$currency = $payment-\u003egetAmountCurrency();\n// CREATED\n$status = $payment-\u003egetStatusValue();\n/* ... */\n// []\n$status = $payment-\u003egetCustomFields();\n```\n\n## Доработка библиотеки\n1. В библиотеке присутствует [Dockerfile](Dockerfile), сбилдить образ докера можно так: ``docker build -t \"qiwi-php-client\" .``\n2. Запускать докер-контейнер можно так: ``docker run -it -v $(pwd):/qiwi-php-client qiwi-php-client bash``\n3. При первом запуске надо подтянуть зависимости, в контейнере выполнить: ``composer install``\n4. Настроено тестовое окружение, для его работы неоходимо скопировать файл `phpunit.xml.dist` в `phpunit.xml`\n5. Запуск тестов в контейнере: ``./vendor/bin/phpunit`` \n\n## Credits\n\n- [Ivan Terentev](https://github.com/terentev-space)\n- [All Contributors](https://github.com/terentev-space/qiwi-php-client/contributors)\n\n## License\n\nThe MIT License. Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterentev-space%2Fqiwi-php-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterentev-space%2Fqiwi-php-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterentev-space%2Fqiwi-php-client/lists"}