{"id":28399179,"url":"https://github.com/zipmark/zipmark-php","last_synced_at":"2025-06-28T19:31:57.236Z","repository":{"id":4637465,"uuid":"5782181","full_name":"zipmark/zipmark-php","owner":"zipmark","description":"Zipmark PHP Client Library","archived":false,"fork":false,"pushed_at":"2016-01-25T20:43:06.000Z","size":434,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-01T15:06:14.496Z","etag":null,"topics":[],"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/zipmark.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":"2012-09-12T15:57:41.000Z","updated_at":"2016-01-25T20:43:07.000Z","dependencies_parsed_at":"2022-09-09T13:00:56.617Z","dependency_job_id":null,"html_url":"https://github.com/zipmark/zipmark-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zipmark/zipmark-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zipmark","download_url":"https://codeload.github.com/zipmark/zipmark-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262484073,"owners_count":23318390,"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":[],"created_at":"2025-06-01T07:14:17.887Z","updated_at":"2025-06-28T19:31:57.229Z","avatar_url":"https://github.com/zipmark.png","language":"PHP","readme":"# Zipmark PHP Client\n\nThe Zipmark PHP Client library is used to interact with Zipmark's [API](https://dev.zipmark.com).\n\n## Installation\n\nThe easiest way to download and install the Zipmark PHP Client is with git:\n\n```\ngit clone git://github.com/zipmark/zipmark-php.git /path/to/zipmark/client\n```\n\n### Requirements\n\nThis library depends on PHP 5.3.6 (or higher) and libcurl compiled with OpenSSL support.  phpinfo(); should show information like the following:\n\n```\ncurl\n\ncURL support =\u003e enabled\ncURL Information =\u003e 7.21.4\nAge =\u003e 3\nFeatures\nAsynchDNS =\u003e Yes\nDebug =\u003e No\nGSS-Negotiate =\u003e Yes\nIDN =\u003e No\nIPv6 =\u003e Yes\nLargefile =\u003e Yes\nNTLM =\u003e Yes\nSPNEGO =\u003e No\nSSL =\u003e Yes\nSSPI =\u003e No\nkrb4 =\u003e No\nlibz =\u003e Yes\nCharConv =\u003e No\nProtocols =\u003e dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp\nHost =\u003e universal-apple-darwin11.0\nSSL Version =\u003e OpenSSL/0.9.8r\nZLib Version =\u003e 1.2.5\n\nopenssl\n\nOpenSSL support =\u003e enabled\nOpenSSL Library Version =\u003e OpenSSL 0.9.8r 8 Feb 2011\nOpenSSL Header Version =\u003e OpenSSL 0.9.8r 8 Feb 2011\n```\n\n## Initialization\n\nThe Zipmark PHP Client supports both global and local client credentials.  The client is loaded by requiring a single file:\n\n```php\nrequire_once('./lib/zipmark.php');\n```\n\n## Usage Examples\n\nThe Zipmark PHP client supports objects and lists of objects.  \n\n### Instantiating a client\n\n```php\n$client = new Zipmark_Client(\"Application Identifier\", \"Application Secret\");\n```\n\nApplication Identifier and Application Secret should be replaced with the vendor application identifier and secret provided by Zipmark.\n\n### Production Mode\n\nThe Zipmark PHP client will access Zipmark's sandbox environment by default.  To direct traffic to Zipmark's production environment, enable production mode with the following:\n\n```php\n$client-\u003esetProduction(true);\n```\n\n### Loading a Bill from a known Bill ID\n\n```php\n$bill = $client-\u003ebills-\u003eget(\"Bill ID\");\n```\n\n### Discovering available resources\n\n```php\n$resources = $client-\u003eresources();\n```\n\nResources will contain an array of all available resources.\n\n### Creating a new Bill\n\nCreate a bill object, set required attributes, send it to Zipmark\n\n```php\n$bill_data = array(\n  'identifier'       =\u003e 'abc123',           // Unique Bill Identifier\n  'amount_cents'     =\u003e 100,                // Bill amount in cents\n  'bill_template_id' =\u003e 'UUID',             // UUID of Bill Template from Zipmark\n  'memo'             =\u003e 'Memo to customer', // Text memo shown to customer\n  'date'             =\u003e 'YYYY-MM-DD',       // Date of Bill issuance\n  'content'          =\u003e '{}',               // JSON String with Bill content - rendered with template\n);\n\n$bill = $client-\u003ebills-\u003ecreate($bill_data);\n```\n\nAs an alternative, it is possible to build an object first and then save it afterwards\n\n```php\n$bill_data = array(\n  'identifier'       =\u003e 'abc123',           // Unique Bill Identifier\n  'amount_cents'     =\u003e 100,                // Bill amount in cents\n  'bill_template_id' =\u003e 'UUID',             // UUID of Bill Template from Zipmark\n  'memo'             =\u003e 'Memo to customer', // Text memo shown to customer\n  'date'             =\u003e 'YYYY-MM-DD',       // Date of Bill issuance\n  'content'          =\u003e '{}',               // JSON String with Bill content - rendered with template\n);\n\n$bill = $client-\u003ebills-\u003ebuild($bill_data);\n\n$bill-\u003esave();\n```\n\n### Updating an existing Bill\n\nGet the bill, make a change, send it back to Zipmark\n\n```php\n$bill = $client-\u003ebills-\u003eget(\"Bill ID\");\n\n$bill-\u003ememo = \"Please pay with Zipmark\";\n\n$bill-\u003esave();\n```\n\n### Retrieving a list of all Bills\n\nRetrieve a list of all bills.\n\n```php\n$bills = $client-\u003ebills-\u003egetAll();\n```\n\nGet the number of objects available.\n\n```php\n$bills-\u003ecount();\n```\n\n### Basic Iterator\n\nThe Zipmark_Iterator class understands Zipmark's pagination system.  It loads one page of objects at a time and will retrieve more objects as necessary while iterating through the objects.\n\n```php\n$bills = $client-\u003ebills-\u003egetAll();\n$iterator = new Zipmark_Iterator($bills);\n```\n\nGet the current object (returns null if the iterator has passed either end of the list)\n\n```php\n$bill = $iterator-\u003ecurrent();\n```\n\nGet the next/previous object (returns null if the next/previous object would pass either end of the list)\n\n```php\n$bill = $iterator-\u003enext();\n$bill = $iterator-\u003eprev();\n```\n\n### Iterating through a list of all Bills\n\nThe Zipmark_Iterator can be used to iterate through all objects of a given resource type.\n\n```php\n$iterator = new Zipmark_Iterator($client-\u003ebills-\u003egetAll());\n\nforeach ($iterator as $bill) {\n  print \"Bill \" . $iterator-\u003ekey() . \" is ID \";\n  print $bill-\u003eid . \" for \" . $bill-\u003eamount_cents . \" cents.\\n\";\n}\n```\n\nWhich would result in output similar to:\n\n```\nBill 0 is ID 3cf1290adc08b28899dd7c7e263cca4dc9a2 for 1234 cents\nBill 1 is ID 3cf1b7bc6cfbaeb6b8b2a6001037d284c918 for 100 cents\nBill 2 is ID 3cea3cab019984233228c2eaff0edcbbb733 for 3456 cents\nBill 3 is ID 3ceaf09259f883159622aa4401ab7d06d45a for 2345 cents\nBill 4 is ID 3cea079b288120ffb129dfb62ae18de3dfee for 1234 cents\nBill 5 is ID 3ce95db62b1069e59e122c515eb191c70987 for 12345 cents\nBill 6 is ID 3ce627f7559478bee1129dae3203e373f0df for 1030 cents\nBill 7 is ID 3ce69e91d68417d1e9892ca903eba8c66a2e for 1030 cents\nBill 8 is ID 3ce6eb4a5b433f3e9b073d15a5ff725dec46 for 1020 cents\nBill 9 is ID 3ce66b0e9a510f90fb26906dd0da04df6de0 for 101 cents\n```\n\n### Callback processing\n\nThe client is able to process, verify and extract data from callbacks received from the Zipmark service.\n\n#### Loading a callback response\n\nA Zipmark_Callback object must be initialized with a Zipmark_Client object and the HTTP callback content (headers and body)\n\nThe array of HTTP headers sent in the callback POST should be contained in the $_SERVER variable.\nThe body of the callback POST should be accessible through the call file_get_contents('php://input');\n\n```php\n$callback = new Zipmark_Callback($client, $httpHeaders, $httpBody);\n```\n\n#### Verifying a callback\n\n```php\n$callbackValid = $callback-\u003eisValid();\n```\n\n$callbackValid will contain a true or false value.\n\n#### Retrieving the callback data\n\nValid callbacks contain events, object types and objects.  The below functions will return their respective values/objects, or null if the callback is invalid.\n\n```php\n$callbackEvent      = $callback-\u003eevent();\n$callbackObjectType = $callback-\u003eobjectType();\n$callbackObject     = $callback-\u003eobject();\n```\n\n## API Documentation\n\nPlease see the [Zipmark API](https://dev.zipmark.com) or contact Zipmark Support via [email](mailto:developers@zipmark.com) or [chat](http://bit.ly/zipmarkAPIchat) for more information.\n\n## Unit/Acceptance Tests\n\nThe Zipmark PHP Client library includes unit tests to verify all implemented functionality.  The unit tests are built with [SimpleTest](http://simpletest.org) and can be run from the command line as:\n\n```\n$ /path/to/zipmark/php/client/test/all_tests.php\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipmark%2Fzipmark-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipmark%2Fzipmark-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipmark%2Fzipmark-php/lists"}