{"id":41021117,"url":"https://github.com/w3guy/omnipay-2checkout","last_synced_at":"2026-01-22T09:33:51.249Z","repository":{"id":56956647,"uuid":"48254458","full_name":"w3guy/omnipay-2checkout","owner":"w3guy","description":"2Checkout driver for the Omnipay PHP payment processing library","archived":false,"fork":false,"pushed_at":"2019-10-21T09:35:53.000Z","size":68,"stargazers_count":29,"open_issues_count":5,"forks_count":26,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-11-07T18:29:15.780Z","etag":null,"topics":["2checkout","omnipay","payment","payment-gateway","payment-integration"],"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/w3guy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-18T20:13:15.000Z","updated_at":"2024-11-06T17:58:23.000Z","dependencies_parsed_at":"2022-08-21T08:50:45.049Z","dependency_job_id":null,"html_url":"https://github.com/w3guy/omnipay-2checkout","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/w3guy/omnipay-2checkout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3guy%2Fomnipay-2checkout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3guy%2Fomnipay-2checkout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3guy%2Fomnipay-2checkout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3guy%2Fomnipay-2checkout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w3guy","download_url":"https://codeload.github.com/w3guy/omnipay-2checkout/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3guy%2Fomnipay-2checkout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28660770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":["2checkout","omnipay","payment","payment-gateway","payment-integration"],"created_at":"2026-01-22T09:33:51.173Z","updated_at":"2026-01-22T09:33:51.238Z","avatar_url":"https://github.com/w3guy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Omnipay: 2checkout\n\n**2checkout gateway for the Omnipay PHP payment processing library**\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/collizo4sky/omnipay-2checkout.svg?style=flat-square)](https://packagist.org/packages/collizo4sky/omnipay-2checkout)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/collizo4sky/omnipay-2checkout/master.svg?style=flat-square)](https://travis-ci.org/collizo4sky/omnipay-2checkout)\n[![Coverage Status](https://coveralls.io/repos/collizo4sky/omnipay-2checkout/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/collizo4sky/omnipay-2checkout?branch=master)\n[![Code Climate](https://codeclimate.com/github/collizo4sky/omnipay-2checkout/badges/gpa.svg)](https://codeclimate.com/github/collizo4sky/omnipay-2checkout)\n[![Dependency Status](https://www.versioneye.com/user/projects/56790f2210799700300013b8/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56790f2210799700300013b8)\n[![Total Downloads](https://img.shields.io/packagist/dt/collizo4sky/omnipay-2checkout.svg?style=flat-square)](https://packagist.org/packages/collizo4sky/omnipay-2checkout)\n\n\n[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment\nprocessing library for PHP 5.3+. This package implements 2checkout support for Omnipay.\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require collizo4sky/omnipay-2checkout\n```\n\n## Usage\n\nThe following gateways are provided by this package:\n\n * TwoCheckoutPlus\n * TwoCheckoutPlus_Token\n \n### TwoCheckoutPlus\n``` php\n\nuse Omnipay\\Omnipay;\n\n$gateway = Omnipay::create('TwoCheckoutPlus');\n$gateway-\u003esetAccountNumber($this-\u003eaccount_number);\n$gateway-\u003esetSecretWord($this-\u003esecret_word);\n$gateway-\u003esetTestMode($this-\u003eis_sandbox_test());\n// activate test mode by passing demo parameter to checkout parameters.\n$gateway-\u003esetDemoMode($this-\u003eis_test_mode());\n\n\ntry {\n    $formData = array(\n        'firstName' =\u003e $order-\u003eget_billing_first_name(),\n        'lastName' =\u003e $order-\u003eget_billing_last_name(),\n        'email' =\u003e $order-\u003eget_billing_email(),\n        'address1' =\u003e $order-\u003eget_billing_address_1(),\n        'address2' =\u003e $order-\u003eget_billing_address_2(),\n        'city' =\u003e $order-\u003eget_billing_city(),\n        'state' =\u003e $order-\u003eget_billing_state(),\n        'postcode' =\u003e $order-\u003eget_billing_postcode(),\n        'country' =\u003e $order-\u003eget_billing_country(),\n    );\n\n    $order_cart = $order-\u003eget_items();\n\n    $cart = array();\n\n    $i = 0;\n    foreach ($order_cart as $order_item_id =\u003e $product) {\n        $product_id = $product['product_id'];\n        $cart[$i]['name'] = $product['name'];\n        $cart[$i]['quantity'] = $product['qty'];\n        $cart[$i]['type'] = 'product';\n        $cart[$i]['price'] = round($product['line_subtotal'] / $product['qty'], 2);\n        $cart[$i]['product_id'] = $product_id;\n\n        $i++;\n    }\n\n    if (($shipping_total = $order-\u003eget_shipping_total()) \u003e 0) {\n        $cart[] = array(\n            'name' =\u003e 'Shipping Fee',\n            'quantity' =\u003e 1,\n            'type' =\u003e 'shipping',\n            'price' =\u003e round($shipping_total, 2),\n        );\n    }\n\n    if (($discount_total = $order-\u003eget_total_discount()) \u003e 0) {\n        $cart[] = array(\n            'name' =\u003e 'Discount',\n            'quantity' =\u003e 1,\n            'type' =\u003e 'coupon',\n            'price' =\u003e round($discount_total, 2),\n        );\n    }\n\n    if (($tax_total = $order-\u003eget_total_tax()) \u003e 0) {\n        $cart[] = array(\n            'name' =\u003e 'Tax Fee',\n            'type' =\u003e 'tax',\n            'quantity' =\u003e 1,\n            'price' =\u003e round($tax_total, 2),\n        );\n    }\n\n    $gateway-\u003esetCart($cart);\n\n    $response = $gateway-\u003epurchase(\n        array(\n            'card' =\u003e $formData,\n            'transactionId' =\u003e $order-\u003eget_order_number(),\n            'currency' =\u003e 'USD',\n            // add a query parameter to the returnUrl to listen and complete payment\n            'returnUrl' =\u003e $this-\u003ereturnUrl,\n        )\n    )-\u003esend();\n\n\n    if ($response-\u003eisRedirect()) {\n        $response-\u003egetRedirectUrl();\n\n    } else {\n        $error = $response-\u003egetMessage();\n    }\n} catch (Exception $e) {\n    $e-\u003egetMessage();\n}\n```\n\n### TwoCheckoutPlus_Token\n\n``` php\nuse Omnipay\\Omnipay;\n\ntry {\n    $gateway = Omnipay::create('TwoCheckoutPlus_Token');\n    $gateway-\u003esetAccountNumber($this-\u003eaccount_number);\n    $gateway-\u003esetTestMode($this-\u003eis_sandbox_test());\n    $gateway-\u003esetPrivateKey($this-\u003eprivate_key);\n\n    $formData = array(\n        'firstName' =\u003e $order-\u003eget_billing_first_name(),\n        'lastName' =\u003e $order-\u003eget_billing_last_name(),\n        'email' =\u003e $order-\u003eget_billing_email(),\n        'billingAddress1' =\u003e $order-\u003eget_billing_address_1(),\n        'billingAddress2' =\u003e $order-\u003eget_billing_address_2(),\n        'billingCity' =\u003e $order-\u003eget_billing_city(),\n        'billingPostcode' =\u003e $order-\u003eget_billing_postcode(),\n        'billingState' =\u003e $order-\u003eget_billing_state(),\n        'billingCountry' =\u003e $order-\u003eget_billing_country(),\n    );\n\n\n    $purchase_request_data = array(\n        'card' =\u003e $formData,\n        'token' =\u003e sanitize_text_field($_POST['twocheckout_token']),\n        'transactionId' =\u003e $order-\u003eget_order_number(),\n        'currency' =\u003e 'USD',\n        'amount' =\u003e $order-\u003eorder_total,\n    );\n\n    $response = $gateway-\u003epurchase($purchase_request_data)-\u003esend();\n\n    if ($response-\u003eisSuccessful()) {\n        $transaction_ref = $response-\u003egetTransactionReference();\n    } else {\n        $error = $response-\u003egetMessage();\n    }\n} catch (Exception $e) {\n    $e-\u003egetMessage();\n}\n```\n\nFor general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay) repository.\n\n## Support\n\nIf you are having general issues with Omnipay, we suggest posting on\n[Stack Overflow](http://stackoverflow.com/). Be sure to add the\n[omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found.\n\nIf you want to keep up to date with release anouncements, discuss ideas for the project,\nor ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which\nyou can subscribe to.\n\nIf you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/collizo4sky/omnipay-2checkout/issues),\nor better yet, fork the library and submit a pull request.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Security\n\nIf you discover any security related issues, please email me@w3guy.com instead of using the issue tracker.\n\n## Credits\n\n- [Agbonghama Collins](https://github.com/collizo4sky)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3guy%2Fomnipay-2checkout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw3guy%2Fomnipay-2checkout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3guy%2Fomnipay-2checkout/lists"}