{"id":34675284,"url":"https://github.com/pckg/payment","last_synced_at":"2025-12-24T20:27:56.148Z","repository":{"id":6877708,"uuid":"55511646","full_name":"pckg/payment","owner":"pckg","description":"Payment modules","archived":false,"fork":false,"pushed_at":"2022-04-22T19:35:44.000Z","size":416,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"next-8.0","last_synced_at":"2024-03-26T19:35:03.753Z","etag":null,"topics":["credit-card","icepay","ideal","moneta","payments","paymill","paypal","proforma","sepa"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pckg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-05T13:49:04.000Z","updated_at":"2024-03-26T19:35:03.754Z","dependencies_parsed_at":"2022-08-06T20:00:53.442Z","dependency_job_id":null,"html_url":"https://github.com/pckg/payment","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pckg/payment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pckg%2Fpayment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pckg%2Fpayment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pckg%2Fpayment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pckg%2Fpayment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pckg","download_url":"https://codeload.github.com/pckg/payment/tar.gz/refs/heads/next-8.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pckg%2Fpayment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28008183,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["credit-card","icepay","ideal","moneta","payments","paymill","paypal","proforma","sepa"],"created_at":"2025-12-24T20:27:55.413Z","updated_at":"2025-12-24T20:27:56.131Z","avatar_url":"https://github.com/pckg.png","language":"PHP","funding_links":["https://api-3t.sandbox.paypal.com/nvp'","https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout\u0026token="],"categories":[],"sub_categories":[],"readme":"# About project\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8b5c27a4a33c4fada3115a9ec7b17872)](https://www.codacy.com/app/schtr4jh/payment?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=pckg/payment\u0026utm_campaign=badger)\n\n![Build status](https://github.com/pckg/payment/workflows/Pckg%20Payment%20CI/badge.svg)\n\nProject provides abstract implementation for payment providers:\n- paypal (classic API, REST API)\n- paymill (credit cards, sepa, paypal)\n- icepay (credit cards, bancontact, eps, giropay, ideal, sofort)\n- braintree\n- axcess\n- valu\n- proforma / upn\n\nCurrently waiting for implementation:\n- paywiser\n- activa\n- megapos\n\n# Instalation\nYou can install package via composer.\n```sh\n$ composer require schtr4jh/payment\n```\n## Paymill\n### Credit cards\n```php\n'enabled'     =\u003e true,\n'private_key' =\u003e env('PAYMILL_PRIVATE_KEY'),\n'public_key'  =\u003e env('PAYMILL_PUBLIC_KEY'),\n```\n### Paypal\n```php\n'enabled'     =\u003e true,\n'private_key' =\u003e env('PAYMILL_PRIVATE_KEY'),\n'public_key'  =\u003e env('PAYMILL_PUBLIC_KEY'),\n'url_return'  =\u003e 'payment.success',\n'url_cancel'  =\u003e 'payment.error',\n```\n### Sepa\n```php\n'enabled'     =\u003e true,\n'private_key' =\u003e env('PAYMILL_PRIVATE_KEY'),\n'public_key'  =\u003e env('PAYMILL_PUBLIC_KEY'),\n```\n## Paypal\n### Classic API\n```php\n'enabled'    =\u003e true,\n'username'   =\u003e 'schtr4jh-facilitator_api1.schtr4jh.net',\n'password'   =\u003e '1390585136',\n'signature'  =\u003e 'AOZR6pqlRlwo0Ex9.oQbP2uvOalsAHQdlhdfczB0.B699lqJXv8pigFj',\n'url'        =\u003e 'https://api-3t.sandbox.paypal.com/nvp',\n'url_token'  =\u003e 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout\u0026token=[token]',\n'url_return' =\u003e 'payment.success',\n'url_cancel' =\u003e 'payment.error',\n```\n### REST API\n```php\n'enabled'    =\u003e false,\n'id'         =\u003e 'AYlzupNqmg7177ZI57MfI26mgkzN-n8QQewuicaHmi7OOEf5LNy5FIi7ooFIbwo-t9_LQR9NOqtLslF_',\n'secret'     =\u003e 'ECQLZ6zyH8b6JgG3hGN8Qg1u6ezDiT0HpfCK7MnKcQyyQoYtghnAndYJLu5p1g0UJmLMj7_IV1Qdbsv3',\n'mode'       =\u003e 'sandbox',\n'url_return' =\u003e 'payment.success',\n'url_cancel' =\u003e 'payment.error',\n'log'        =\u003e [\n    'enabled' =\u003e true,\n    'level'   =\u003e 'DEBUG', // 'FINE' for production\n],\n```\n## Proforma\n### Config\n```php\n'enabled'     =\u003e false,\n'url_waiting' =\u003e 'payment.waiting',\n```\n# Implementation\nEach project needs to have implemented \\Pckg\\Payment\\Adapter\\Order|Product|Customer|Log|Environment (called ProjectOrder, ProjectProduct, ProjectCustomer and ProductLog) which provides proper mappers.\nFor usage in Laravel project you can simply use Pckg\\Payment\\Service\\LaravelPayment trait which creates payment service with Laravel environment for handling request, responses, url generation and redirects.\nFor usage in other project simply implement Payment\\Adapter\\Environment.\n## Routes\n```php\n// list payments\n'payment'          =\u003e route('PaymentController@payment', 'payment/{listing}', 'GET'),\n\n// apply promo code\n'payment.promo'    =\u003e route('PaymentController@promo', 'payment/{handler}/{listing}/promo', 'POST'),\n\n// validate payment request\n'payment.validate' =\u003e route('PaymentController@validate', 'payment/{handler}/{listing}/validate', 'POST'),\n\n// start payment process\n'payment.start'    =\u003e route('PaymentController@start', 'payment/{handler}/{listing}/start', 'POST|GET'),\n\n// payment valid\n'payment.success'  =\u003e route('PaymentController@success', 'payment/{handler}/{listing}/success', 'GET'),\n\n// payment invalid\n'payment.error'    =\u003e route('PaymentController@error', 'payment/{handler}/{listing}/error', 'GET'),\n\n// payment not processed yet\n'payment.waiting'  =\u003e route('PaymentController@waiting', 'payment/{handler}/{listing}/waiting', 'GET'),\n```\n## Controller\nExample of full Laravel implementation\n```php\n\u003c?php namespace Net\\Http;\n\nuse Illuminate\\Http\\Request;\nuse Net\\Http\\Payment\\ZoneLog;\nuse Net\\Http\\Payment\\ZoneOrder;\nuse Net\\Http\\Requests\\PromoCodeRequest;\nuse Pckg\\Payment\\Service\\LaravelPayment;\nuse Zone\\Content\\SelectItem;\nuse Zone\\Listing\\Listing;\nuse Zone\\Listing\\PaymentMethod;\nuse Zone\\Listing\\PromoCode;\n\nclass PaymentController extends BaseController\n{\n\n    use LaravelPayment;\n\n    protected $paymentService;\n\n    public function __construct()\n    {\n        $this-\u003epaymentService = $this-\u003ecreatePaymentService();\n    }\n\n    private function preparePaymentService($handler, Listing $listing)\n    {\n        $listing-\u003eabortIfNotMine();\n\n        $this-\u003epaymentService-\u003eprepare(new ZoneOrder($listing), $handler, new ZoneLog($listing));\n    }\n\n    public function getPayment(Listing $listing)\n    {\n        $listing-\u003eabortIfNotMine();\n\n        $this-\u003epaymentService-\u003esetOrder(new ZoneOrder($listing));\n\n        $this-\u003evendorAsset('schtr4jh/payment/src/Pckg/Payment/public/payment.js', 'footer');\n\n        return view('payment.index', [\n            'listing'        =\u003e $listing,\n            'paymentMethods' =\u003e PaymentMethod::where('enabled', 1)-\u003eget(),\n            'paymentService' =\u003e $this-\u003epaymentService,\n            'expYears'       =\u003e range(date('Y') + 0, date('Y') + 16),\n            'expMonths'      =\u003e SelectItem::cardExpirationMonths()-\u003eget(),\n        ]);\n    }\n\n    public function postStart($handler, Listing $listing)\n    {\n        $this-\u003epreparePaymentService($handler, $listing);\n        $success = $this-\u003epaymentService-\u003egetHandler()-\u003estart();\n\n        return [\n            'success' =\u003e true,\n            'modal'   =\u003e $success\n                ? '#dialog-payment-success'\n                : '#dialog-payment-error',\n        ];\n    }\n\n    public function getStart($handler, Listing $listing)\n    {\n        return $this-\u003egetStatus($handler, $listing, 'start');\n    }\n\n    public function getSuccess($handler, Listing $listing)\n    {\n        return $this-\u003egetStatus($handler, $listing, 'success');\n    }\n\n    public function getError($handler, Listing $listing)\n    {\n        return $this-\u003egetStatus($handler, $listing, 'error');\n    }\n\n    public function getWaiting($handler, Listing $listing)\n    {\n        return $this-\u003egetStatus($handler, $listing, 'waiting');\n    }\n\n    public function postValidate($handler, Listing $listing, Request $request)\n    {\n        $this-\u003epreparePaymentService($handler, $listing);\n\n        return $this-\u003epaymentService-\u003egetHandler()-\u003evalidate($request);\n    }\n\n    public function postPromo($handler, Listing $listing, PromoCodeRequest $request)\n    {\n        $this-\u003epreparePaymentService($handler, $listing);\n\n        $canApply = false;\n        $code = PromoCode::where('code', $request-\u003epromo_code)-\u003efirst();\n        if ($code \u0026\u0026 (($code-\u003ediscount_value \u0026\u0026 $code-\u003ediscount_value \u003c $this-\u003epaymentService-\u003egetTotal()) || $code-\u003ediscount_percentage)) {\n            $listing-\u003eforceFill([\n                'promo_code_id' =\u003e $code-\u003eid,\n            ])-\u003esave();\n\n            $canApply = true;\n        } else {\n            $listing-\u003eforceFill([\n                'promo_code_id' =\u003e null,\n            ])-\u003esave();\n        }\n\n        return [\n            'success'           =\u003e true,\n            'promo_notice'      =\u003e $request-\u003epromo_code\n                ? ($canApply\n                    ? trans(\n                        'payment.label.promo_code_valid',\n                        ['discount' =\u003e $listing-\u003epromoCode-\u003egetDiscount($this-\u003epaymentService-\u003egetCurrency())]\n                    ) : trans('payment.label.promo_code_invalid')\n                ) : '',\n            'new_handler_price' =\u003e $this-\u003epaymentService-\u003egetHandler()-\u003egetTotalToPay(),\n            'new_button'        =\u003e trans('payment.paymill.btn.pay') . ' ' . $this-\u003epaymentService-\u003egetTotalToPayWithCurrency(),\n        ];\n    }\n\n    protected function getStatus($handler, Listing $listing, $action)\n    {\n        $this-\u003epreparePaymentService($handler, $listing);\n        $this-\u003epaymentService-\u003egetHandler()-\u003e{$action}();\n\n        return view('payment.' . $action, [\n            'listing' =\u003e $listing,\n        ]);\n    }\n\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpckg%2Fpayment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpckg%2Fpayment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpckg%2Fpayment/lists"}