{"id":15866138,"url":"https://github.com/pagantis/orders-api-client","last_synced_at":"2026-04-28T17:01:29.275Z","repository":{"id":56456256,"uuid":"136147763","full_name":"pagantis/orders-api-client","owner":"pagantis","description":"PHP Client for Pagantis Orders API","archived":false,"fork":false,"pushed_at":"2020-11-06T09:32:37.000Z","size":246,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-14T12:24:14.979Z","etag":null,"topics":["api-client","client","composer","library","orders-api","pagantis","php-library","vendor"],"latest_commit_sha":null,"homepage":"","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/pagantis.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":"2018-06-05T08:45:59.000Z","updated_at":"2020-11-06T09:32:35.000Z","dependencies_parsed_at":"2022-08-15T19:10:15.415Z","dependency_job_id":null,"html_url":"https://github.com/pagantis/orders-api-client","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/pagantis/orders-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagantis%2Forders-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagantis%2Forders-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagantis%2Forders-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagantis%2Forders-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pagantis","download_url":"https://codeload.github.com/pagantis/orders-api-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagantis%2Forders-api-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32390067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api-client","client","composer","library","orders-api","pagantis","php-library","vendor"],"created_at":"2024-10-05T23:04:28.906Z","updated_at":"2026-04-28T17:01:29.232Z","avatar_url":"https://github.com/pagantis.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orders Api Client \u003cimg src=\"https://www.pagantis.com/wp-content/uploads/2019/02/cropped-pagantis_logo-1.png\" width=\"100\" align=\"right\"\u003e\n\nCircleCI: [![CircleCI](https://circleci.com/gh/pagantis/orders-api-client/tree/master.svg?style=svg)](https://circleci.com/gh/pagantis/orders-api-client/tree/master)\n\n[![Latest Stable Version](https://poser.pugx.org/pagantis/orders-api-client/v/stable)](https://packagist.org/packages/pagantis/orders-api-client)\n[![composer.lock](https://poser.pugx.org/pagantis/orders-api-client/composerlock)](https://packagist.org/packages/pagantis/orders-api-client)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pagantis/orders-api-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pagantis/orders-api-client/?branch=master)\n\nOrders API Client offers the merchants working with Pagantis a way to consume the API services without the effort of doing a complete development.\nThe library provides stubs for each type of object withing the API and the method calls. Each Method supported by the API is implemented in this client and\nis documented within the code and [here](https://developer.pagantis.com/api/)\n\nAll the code is tested and inspected by external services.\n\n## How to use\n\nInstall the library by:\n\n- Downloading it from [here](https://github.com/pagantis/orders-api-client/releases/latest)\n\nhttps://github.com/pagantis/orders-api-client/releases/latest\n\n- Using Composer:\n```php\ncomposer require pagantis/orders-api-client\n```\nFinally, be sure to include the autoloader:\n```php\nrequire_once '/path/to/your-project/vendor/autoload.php';\n```\n\nOnce the library is ready and inside the project the stub objects will available and\nthe ordersApiClient will also available.\n\n```php\n//Create a OrdersApiClient object, for example:\n$ordersApiClient = new OrdersApiClient($publicKey, $privateKey);\n\n//Example: get an existing Order status:\n$order = $ordersApiClient-\u003egetOrder($pagantisOrderId); //$pmOrderId is the id of the order\nif ($order instanceof Pagantis\\OrdersApiClient\\Model\\Order) {\n    $orderStatus = $order-\u003egetStatus();\n    echo $orderStatus;\n}\n\n// You can investigate the rest of the methods. And find all the documentation of the API here:\n// https://developer.pagantis.com/api/\n\n```\n\n## Examples / DemoTool\n\nFind [examples in PHP](https://github.com/pagantis/orders-api-client/tree/master/examples) and a [demonstration tool](https://github.com/pagantis/orders-api-client/tree/master/examples) with the complete integration [here](https://github.com/pagantis/orders-api-client/tree/master/examples)\n\n## Objects\n\nThe objects used inside the API are already defined as Classes with the desired properties. Each object has a setup\nof setters and getters for easy validation and OOP.\n\nInside `src/Model` find defined the Order Object. Inside Order folder it is possible to see each element that the main\nOrder object has.\n\nUse always the defined objects when using the API Client. For example when creating a refund:\n```php\n\u003c?php\n\n//Use the API Client to operate with the API\n$orderApiClient = new Pagantis\\OrdersApiClient\\Client(\n    $publicKey,\n    $privateKey\n);\n\n//Create a Refund object and set the amounts:\n$refund = new Pagantis\\OrdersApiClient\\Model\\Order\\Refund();\n$refund\n    -\u003esetPromotedAmount(0)\n    -\u003esetTotalAmount(10)\n;\n\n//Then use the API client to generate a the refund:\n$refundCreated = $apiClient-\u003erefundOrder($orderId, $refund);\n?\u003e\n\n@Exception Handling\n\nuse Try|Catch when using the API methods, since it can cause HTTP exceptions.\n```\n\n## API Methods\n\n### Create Order\n\nTo create a order using the API Client start from a empty Order object,\ncreate the sub-objects and set the mandatory information.\n\nThen send the API Call to Pagantis using the API Client. The result is the same\norder object with the rest of the fields completed. The status is `CREATED`.\n\nStore the relation between Pagantis order id and the merchant order id to be able to identify orders after creation.\n\n\n```php\n\u003c?php\n\n//Use the API Client to operate with the API\n$orderApiClient = new Pagantis\\OrdersApiClient\\Client(\n    $publicKey,\n    $privateKey\n);\n\n$order = new \\Pagantis\\OrdersApiClient\\Model\\Order();\n$order\n    -\u003esetConfiguration($configurationObject)\n    -\u003esetShoppingCart($shoppingCartObject)\n    -\u003esetUser($userObject)\n    -\u003esetMetadata($metadataObject)\n;\n\n//Notice, Create and fill with information the 4 objects\n\n//To see the JSON result of a order Object:\necho json_encode(\n  $order-\u003eexport(),\n  JSON_PRETTY_PRINT |\n  JSON_UNESCAPED_SLASHES |\n  JSON_UNESCAPED_UNICODE\n);\n\n//Finally create the order by using the client:\n$orderCreated = $orderApiClient-\u003ecreateOrder($order);\n\n\n\n/*\n * The Order object is defined inside the library and is prepared for OOP.\n * The attributes work with GETTERS and SETTERS\n *\n * The Response is parsed within the Client and is transformed into a Previously Defined Object with\n * useful methods.\n */\n\n?\u003e\n\n@Exception Handling\n\nuse Try|Catch when using order Create method, since it can cause HTTP exceptions.\n\nWhen setting data into the order object there is Client Exceptions that may force to set the attributes in the\ncorrect format.\n```\n\n### Get Order\n\nUse the method Get Order to retrieve the order again from Pagantis server. The order retrieved has updated status.\nStore the relation between Pagantis order id and the merchant order id to be able to identify orders after creation.\n\n\n```php\n\u003c?php\n\n//Use the API Client to operate with the API\n$orderApiClient = new Pagantis\\OrdersApiClient\\Client(\n    $publicKey,\n    $privateKey\n);\n\n//By storing the Pagantis order ID, fetch back the updated order:\n$order = $orderApiClient-\u003egetOrder($orderId);\n\n?\u003e\n\n@Exception Handling\n\nuse Try|Catch when using get Order method, since it can cause HTTP exceptions.\n\n\u003c?php\n\n/** Tip: Navigate inside the fetched order properties:\n\n/** $status array() **/\n$status = $order-\u003egetStatus();\n\n/** $amount int **/\n$amount = $order-\u003egetShoppingCart()-\u003egetTotalAmount();\n\n/** $createdAt \\DateTime **/\n$createdAt = $order-\u003egetCreateAt();\n\n/** $refunds Refund[] **/\n$refunds = $order-\u003egetRefunds();\n```\n\n### List Orders\n\nFind the order, get all orders from yesterday, see online or instore orders, list Confirmed orders.\nUse this service to find orders in the system. Use query string for result filtering.\nSee all the queryString parameters [here](https://developer.pagantis.com/api/)\n\n```php\n\u003c?php\n\n//Use the API Client to operate with the API\n$orderApiClient = new Pagantis\\OrdersApiClient\\Client(\n    $publicKey,\n    $privateKey\n);\n\n//Define the queryString parameters to filter:\n$queryString = [\n    'channel'       =\u003e 'online',\n    'pageSize'      =\u003e 2,\n    'page'          =\u003e 1,\n    'status'        =\u003e Order::STATUS_CONFIRMED,\n    'createdFrom'   =\u003e '2018-06-28T14:08:01',\n    'createdTo'     =\u003e '2018-06-28T14:08:03',\n];\n\n$orders = $orderApiClient-\u003elistOrders($queryString);\n\n?\u003e\n\n@Exception Handling\n\nuse Try|Catch when using get Order method, since it can cause HTTP exceptions.\n\n\n\n\u003c?php\n\n/** Tip: Iterate inside the fetched list of Orders:\n\n// Calculate the total amount of sales withing the orders: List the orders from yesterday with status CONFIRMED and...\n\n$amount = 0;\n\nforeach ($orders as $order) {\n    $amount += $order-\u003egetShoppingCart()-\u003egetTotalAmount();\n}\n\n// In cents, the total amount of sales from yesterday.\necho $amount;\n```\n\n### Confirm Order\n\nWhen the order is AUTHORIZED confirm is the action of the merchant that informs the payment method that he validates\nand confirms that the user has paid the order.\nConfirmed orders are processed and the loan is created. Once a loan is confirmed it is able to have refunds.\n\nSeveral callbacks can be added to the order for notification of orders authorized or rejected.\nAlso it is possible to list all the orders that are pending confirmation.\n\n```php\n\u003c?php\n\n//Use the API Client to operate with the API\n$orderApiClient = new Pagantis\\OrdersApiClient\\Client(\n    $publicKey,\n    $privateKey\n);\n\n$order = $orderApiClient-\u003econfirmOrder($orderId);\n\n/** @See https://github.com/pagantis/orders-api-client **/\n\n?\u003e\n\n@Exception Handling\n\nuse Try|Catch when using get Order method, since it can cause HTTP exceptions.\n\n\u003c?php\n\n/** Tip: List the AUTHORIZED orders and confirm them to prevent loosing any transaction:\n\n$authorizedOrders = $orderApiClient-\u003elistOrders([\n    'status' =\u003e Order::STATUS_AUTHORIZED,\n]);\n\nforeach ($orders as $order) {\n    // validate the payment in the merchant system and then inform Pagantis API that\n    // the order is processed and valid in the merchant\n    $orderConfirmed = $orderApiClient-\u003econfirmOrder($order-\u003egetId());\n}\n\n?\u003e\n\nRemember that if a AUTHORIZED order is not confirmed, the payment will\nbe released and the loan will not be created. It is mandatory to\nconfirm all AUTHORIZED orders.\n```\n\n### Refund Order\n\nRefund is a deduction of the order total_amount. Refund can only be requested over a confirmed order.\nThe refund of an order is automatically decreasing the amount from the end of the installments.\n\nA order can have several refunds, as long as they do not reach the order total_amount.\nOnce the total_amount is refunded, the order status will keep to CONFIRMED.\n\n```php\n\u003c?php\n\n//Use the API Client to operate with the API\n$orderApiClient = new Pagantis\\OrdersApiClient\\Client(\n    $publicKey,\n    $privateKey\n);\n\n//Create a Refund object and set the amounts:\n$refund = new Pagantis\\OrdersApiClient\\Model\\Order\\Refund();\n$refund\n    -\u003esetPromotedAmount(0)\n    -\u003esetTotalAmount(10)\n;\n\n//Then use the API client to generate a the refund:\n$refundCreated = $apiClient-\u003erefundOrder($orderId, $refund);\n\n?\u003e\n\n@Exception Handling\n\nuse Try|Catch when using get Order method, since it can cause HTTP exceptions.\n```\n\n## Help us to improve\n\nWe are happy to accept suggestions or pull requests. If you are willing to help us develop better software\nplease create a pull request here following the PSR-2 code style and we will use reviewable to check\nthe code and if al test pass and no issues are detected by SensioLab Insights you could will be ready\nto merge. \n\n* [Issue Tracker](https://github.com/pagantis/orders-api-client/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpagantis%2Forders-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpagantis%2Forders-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpagantis%2Forders-api-client/lists"}