{"id":26596971,"url":"https://github.com/dipnot/paytr-php","last_synced_at":"2025-03-23T17:21:06.650Z","repository":{"id":56969381,"uuid":"311972377","full_name":"dipnot/paytr-php","owner":"dipnot","description":"Unofficial PHP wrapper for PayTR API","archived":false,"fork":false,"pushed_at":"2023-06-13T11:17:21.000Z","size":47,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-18T02:18:45.437Z","etag":null,"topics":["composer","payment-gateway","paytr","php-library"],"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/dipnot.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-11T13:02:28.000Z","updated_at":"2023-08-28T11:24:52.000Z","dependencies_parsed_at":"2024-11-15T21:41:22.674Z","dependency_job_id":"cbff4f6e-403c-4783-87ff-ad9bfe814739","html_url":"https://github.com/dipnot/paytr-php","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"96ecf90dcbda446322ced1e758e2cab3fc23dcac"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipnot%2Fpaytr-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipnot%2Fpaytr-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipnot%2Fpaytr-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipnot%2Fpaytr-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dipnot","download_url":"https://codeload.github.com/dipnot/paytr-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244972974,"owners_count":20541012,"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":["composer","payment-gateway","paytr","php-library"],"created_at":"2025-03-23T17:21:05.980Z","updated_at":"2025-03-23T17:21:06.614Z","avatar_url":"https://github.com/dipnot.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PayTR API Wrapper for PHP\n\n[![Latest Stable Version](https://poser.pugx.org/dipnot/paytr-php/v)](https://packagist.org/packages/dipnot/paytr-php) [![Total Downloads](https://poser.pugx.org/dipnot/paytr-php/downloads)](https://packagist.org/packages/dipnot/paytr-php)\n\nThis is an unofficial PHP wrapper for the [PayTR API](https://www.paytr.com/entegrasyon)\n\n## Requirements\n\n- PHP 5.6.36 or higher\n- ext-curl\n- ext-json\n\n## Installation\n\nTo install, run the following command using [Composer](https://getcomposer.org/).\n\n```sh\ncomposer require dipnot/paytr-php\n```\n\n## Examples\n\nFull usage examples can be found in the [examples](https://github.com/dipnot/paytr-php/tree/main/examples) folder.\n\n### Config\n\nBefore making any requests, a `Config` object must be created and set with real merchant information.\n\n```php\nuse Dipnot\\PayTR\\Config;\n\n$config = new Config();\n$config-\u003esetMerchantId(\"TODO\");\n$config-\u003esetMerchantKey(\"TODO\");\n$config-\u003esetMerchantSalt(\"TODO\");\n```\n\n### Creating a payment form\n\n```php\nuse Dipnot\\PayTR\\Model\\Buyer;\nuse Dipnot\\PayTR\\Model\\Currency;\nuse Dipnot\\PayTR\\Model\\Language;\nuse Dipnot\\PayTR\\Model\\Product;\nuse Dipnot\\PayTR\\Request\\CreatePaymentFormRequest;\n\n$buyer = new Buyer();\n$buyer-\u003esetEmailAddress(\"email@address.com\");\n$buyer-\u003esetFullName(\"Full Name\");\n$buyer-\u003esetAddress(\"The World\");\n$buyer-\u003esetPhoneNumber(\"0000000000\");\n$buyer-\u003esetIpAddress(\"0.0.0.0\");\n\n$product1 = new Product();\n$product1-\u003esetTitle(\"Computer\");\n$product1-\u003esetPrice(4000);\n$product1-\u003esetQuantity(1);\n\n$product2 = new Product();\n$product2-\u003esetTitle(\"Phone\");\n$product2-\u003esetPrice(5000);\n$product2-\u003esetQuantity(2);\n\n$orderId = \"UNIQUEORDERCODE\" . time();\n\n$createPaymentFormRequest = new CreatePaymentFormRequest($config);\n$createPaymentFormRequest-\u003esetBuyer($buyer);\n$createPaymentFormRequest-\u003esetCurrency(Currency::TL);\n$createPaymentFormRequest-\u003esetLanguage(Language::TR);\n$createPaymentFormRequest-\u003esetAmount(9000);\n$createPaymentFormRequest-\u003esetOrderId($orderId);\n$createPaymentFormRequest-\u003esetSuccessUrl(\"http://localhost/paytr-php/examples/order.php?orderId={$orderId}\u0026status=success\");\n$createPaymentFormRequest-\u003esetFailedUrl(\"http://localhost/paytr-php/examples/order.php?orderId={$orderId}\u0026status=failed\");\n$createPaymentFormRequest-\u003eaddProduct($product1);\n$createPaymentFormRequest-\u003eaddProduct($product2);\n// $createPaymentFormRequest-\u003eaddProducts([$product1, $product2]); // You can add multiple products at once\n$createPaymentFormRequest-\u003esetTimeout(30);\n$createPaymentFormRequest-\u003esetNoInstallment(true);\n$createPaymentFormRequest-\u003esetMaxInstallment(0);\n\ntry {\n  $paymentForm = $createPaymentFormRequest-\u003eexecute();\n  $paymentForm-\u003eprintPaymentForm();\n} catch(Exception $e) {\n  echo $e-\u003egetMessage();\n}\n```\n\n### Getting a payment (Webhook)\n\n```php\nuse Dipnot\\PayTR\\Response\\GetPayment;\n\n$getPayment = new GetPayment($config);\n$getPayment-\u003esetData($_POST);\n\ntry {\n  $payment = $getPayment-\u003eexecute();\n  exit(\"OK\");\n} catch(Exception $exception) {\n  exit($exception-\u003egetMessage());\n}\n```\n\n## License\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-%232fdcff)](https://github.com/dipnot/paytr-php/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipnot%2Fpaytr-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdipnot%2Fpaytr-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipnot%2Fpaytr-php/lists"}