{"id":24780448,"url":"https://github.com/webgriffe/lib-monetaweb2","last_synced_at":"2025-10-06T20:49:00.134Z","repository":{"id":62547708,"uuid":"98623244","full_name":"webgriffe/lib-monetaweb2","owner":"webgriffe","description":"Webgriffe Setefi MonetaWeb 2.0 PHP library","archived":false,"fork":false,"pushed_at":"2018-11-16T15:18:34.000Z","size":91,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-21T22:57:43.685Z","etag":null,"topics":["monetaweb","monetaweb2","payment","payment-gateway","paymentgateway","setefi","webgriffe"],"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/webgriffe.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-07-28T07:42:28.000Z","updated_at":"2021-12-29T14:17:02.000Z","dependencies_parsed_at":"2022-11-02T22:30:33.289Z","dependency_job_id":null,"html_url":"https://github.com/webgriffe/lib-monetaweb2","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/webgriffe/lib-monetaweb2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Flib-monetaweb2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Flib-monetaweb2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Flib-monetaweb2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Flib-monetaweb2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webgriffe","download_url":"https://codeload.github.com/webgriffe/lib-monetaweb2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Flib-monetaweb2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278678252,"owners_count":26027049,"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-10-06T02:00:05.630Z","response_time":65,"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":["monetaweb","monetaweb2","payment","payment-gateway","paymentgateway","setefi","webgriffe"],"created_at":"2025-01-29T10:30:52.031Z","updated_at":"2025-10-06T20:49:00.114Z","avatar_url":"https://github.com/webgriffe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nWebgriffe MonetaWeb 2.0 PHP library\n===================================\n\n[![Run Status](https://travis-ci.org/webgriffe/lib-monetaweb2.svg?branch=master)](https://travis-ci.org/webgriffe/lib-monetaweb2.svg?branch=master)\n\nThis library provides a complete integration for the XML Hosted 3DSecure protocol of Setefi MonetaWeb 2.0 payment gateway.\nIt was developed following the technical documentation provided by Setefi released in July 2017.\n\nInstallation\n------------\n\nIn order to use this library, first of all import it using composer:\n\n```\ncomposer require webgriffe/lib-monetaweb2\n```\n\nUsage\n-----\n\n### Payment initialization\n\nYou can generate a payment initialization URL using the `GatewayClient` class:\n\n    $gatewayClient = new Webgriffe\\LibMonetaWebDue\\Api\\GatewayClient();\n\t$getPaymentPageInfo = $gatewayClient-\u003egetPaymentPageInfo(\n        'https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet',\n        '99999999',\n        '99999999',\n        1428.7,\n        'EUR',\n        'ITA',\n        'http://www.merchant.it/notify/',\n        'http://www.merchant.it/error/',\n        'TRCK0001',\n        'Descrizione',\n        'Nome Cognome',\n        'nome@dominio.com',\n        'Campo Personalizzabile'\n    );\n    \nThe `getPaymentPageInfo` method returns a `GatewayPageInfo` value object that encapsulates 3 values: \n* Payment ID, unique ID of the payment session\n* Security Token, an hash that should be compared to the one returned in the response of the notify request (server-to-server notification, of which we talk below)\n* Hosted Page URL, the URL to which the user must be redirected in order to perform the payment\n\n### Server to server notification\n\nOnce that you redirected the user to the `Hosted Page URL` a server-to-server notification will be perfomed by MonetaWebDue to one of the 2 urls that you specified when you called `getPaymentPageInfo`.\nIn the example of the payment initialization the user will be redirected to `http://www.merchant.it/notify/` in case of successful operation and to `http://www.merchant.it/error/` otherwise.\n\nYou can handle this request by using the `handleNotify` method of the `GatewayClient` class:\n\n    $gatewayClient = new Webgriffe\\LibMonetaWebDue\\Api\\GatewayClient();\n    ...\n    // $psrRequest must be an instance of an object that implements the \\Psr\\Http\\Message\\RequestInterface\n\t$paymentResult = $gatewayClient-\u003ehandleNotify($psrRequest);\n    \nThe result of the `handleNotify` method could be a `PaymentResultInfo` object or a `PaymentResultErrorInfo`:\n* The former object is returned when the notify request comunicates that the payment was handled successfully (this does not means that the payment was successful!).\nThe properties of this object are mapped 1to1 with the successful notify response parameters, so refer to the payment gateway's integration documentation for more details about them. \n* Instead, the latter object is returned when the notify request comunicates an error. This means that something went unexpectedly wrong during the payment. This has nothing to do with, for example, a \"canceled\" order: cases like this are not unexpected and so they generates a PaymentResultInfo object (as explained above).\nEven the properties of this object are mapped 1to1 with the parameters of the \"faulty notify response\", so refer to the payment gateway's integration documentation for more details about them.\n\nThe Security Token is a value that is comunicated by Setefi both in the payment initialization response and the server to server notification. You should compare them to be ensure the integrity of the payment.\nIn order to do this, the `GatewayClient` class has a method called `verifySecurityToken` that accepts the initialization's security token and the payment result info (returned by the handle notify) as parameters and returns a boolean:\n\n    $gatewayClient = new Webgriffe\\LibMonetaWebDue\\Api\\GatewayClient();\n    ...\n\t$match = $gatewayClient-\u003everifySecurityToken($storedSecurityToken, $paymentResult);\n\nSo an example of a real implementation for the server to server notification could be this:\n\n    $gatewayClient = new Webgriffe\\LibMonetaWebDue\\Api\\GatewayClient();\n    ...\n\t$paymentResult = $gatewayClient-\u003ehandleNotify($psrRequest);\n    if ($paymentResult instanceof PaymentResultErrorInfo) {\n        ..\n    } else {\n        /** @var PaymentResultInfo $paymentResult */\n        if (!$paymentResult-\u003eisCanceled()) { // the security token is not returned if the payment was canceled\n            if (!$gatewayClient-\u003everifySecurityToken($storedSecurityToken, $paymentResult)) {\n                // error\n                ..\n            }\n        }\n        ..\n    }\n\n### \n\n\nContributing\n------------\n\nFork this repository, make your changes and submit a pull request.\nPlease run the tests and the coding standards checks before submitting a pull request. You can do it with:\n\n```\nvendor/bin/phpspec run\nvendor/bin/phpcs --standard=PSR2 src/\n```\n\nLicense\n-------\n\nThis library is under the MIT license. See the complete license in the LICENSE file.\n\nCredits\n-------\n\nDeveloped by [Webgriffe®](http://www.webgriffe.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebgriffe%2Flib-monetaweb2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebgriffe%2Flib-monetaweb2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebgriffe%2Flib-monetaweb2/lists"}