PHPackages                             zipmark/zipmark-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. zipmark/zipmark-php

ActiveLibrary

zipmark/zipmark-php
===================

PHP Client for Zipmark API

162PHP

Since Jan 25Pushed 10y ago9 watchersCompare

[ Source](https://github.com/zipmark/zipmark-php)[ Packagist](https://packagist.org/packages/zipmark/zipmark-php)[ RSS](/packages/zipmark-zipmark-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Zipmark PHP Client
==================

[](#zipmark-php-client)

The Zipmark PHP Client library is used to interact with Zipmark's [API](https://dev.zipmark.com).

Installation
------------

[](#installation)

The easiest way to download and install the Zipmark PHP Client is with git:

```
git clone git://github.com/zipmark/zipmark-php.git /path/to/zipmark/client

```

### Requirements

[](#requirements)

This library depends on PHP 5.3.6 (or higher) and libcurl compiled with OpenSSL support. phpinfo(); should show information like the following:

```
curl

cURL support => enabled
cURL Information => 7.21.4
Age => 3
Features
AsynchDNS => Yes
Debug => No
GSS-Negotiate => Yes
IDN => No
IPv6 => Yes
Largefile => Yes
NTLM => Yes
SPNEGO => No
SSL => Yes
SSPI => No
krb4 => No
libz => Yes
CharConv => No
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp
Host => universal-apple-darwin11.0
SSL Version => OpenSSL/0.9.8r
ZLib Version => 1.2.5

openssl

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 0.9.8r 8 Feb 2011
OpenSSL Header Version => OpenSSL 0.9.8r 8 Feb 2011

```

Initialization
--------------

[](#initialization)

The Zipmark PHP Client supports both global and local client credentials. The client is loaded by requiring a single file:

```
require_once('./lib/zipmark.php');
```

Usage Examples
--------------

[](#usage-examples)

The Zipmark PHP client supports objects and lists of objects.

### Instantiating a client

[](#instantiating-a-client)

```
$client = new Zipmark_Client("Application Identifier", "Application Secret");
```

Application Identifier and Application Secret should be replaced with the vendor application identifier and secret provided by Zipmark.

### Production Mode

[](#production-mode)

The 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:

```
$client->setProduction(true);
```

### Loading a Bill from a known Bill ID

[](#loading-a-bill-from-a-known-bill-id)

```
$bill = $client->bills->get("Bill ID");
```

### Discovering available resources

[](#discovering-available-resources)

```
$resources = $client->resources();
```

Resources will contain an array of all available resources.

### Creating a new Bill

[](#creating-a-new-bill)

Create a bill object, set required attributes, send it to Zipmark

```
$bill_data = array(
  'identifier'       => 'abc123',           // Unique Bill Identifier
  'amount_cents'     => 100,                // Bill amount in cents
  'bill_template_id' => 'UUID',             // UUID of Bill Template from Zipmark
  'memo'             => 'Memo to customer', // Text memo shown to customer
  'date'             => 'YYYY-MM-DD',       // Date of Bill issuance
  'content'          => '{}',               // JSON String with Bill content - rendered with template
);

$bill = $client->bills->create($bill_data);
```

As an alternative, it is possible to build an object first and then save it afterwards

```
$bill_data = array(
  'identifier'       => 'abc123',           // Unique Bill Identifier
  'amount_cents'     => 100,                // Bill amount in cents
  'bill_template_id' => 'UUID',             // UUID of Bill Template from Zipmark
  'memo'             => 'Memo to customer', // Text memo shown to customer
  'date'             => 'YYYY-MM-DD',       // Date of Bill issuance
  'content'          => '{}',               // JSON String with Bill content - rendered with template
);

$bill = $client->bills->build($bill_data);

$bill->save();
```

### Updating an existing Bill

[](#updating-an-existing-bill)

Get the bill, make a change, send it back to Zipmark

```
$bill = $client->bills->get("Bill ID");

$bill->memo = "Please pay with Zipmark";

$bill->save();
```

### Retrieving a list of all Bills

[](#retrieving-a-list-of-all-bills)

Retrieve a list of all bills.

```
$bills = $client->bills->getAll();
```

Get the number of objects available.

```
$bills->count();
```

### Basic Iterator

[](#basic-iterator)

The 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.

```
$bills = $client->bills->getAll();
$iterator = new Zipmark_Iterator($bills);
```

Get the current object (returns null if the iterator has passed either end of the list)

```
$bill = $iterator->current();
```

Get the next/previous object (returns null if the next/previous object would pass either end of the list)

```
$bill = $iterator->next();
$bill = $iterator->prev();
```

### Iterating through a list of all Bills

[](#iterating-through-a-list-of-all-bills)

The Zipmark\_Iterator can be used to iterate through all objects of a given resource type.

```
$iterator = new Zipmark_Iterator($client->bills->getAll());

foreach ($iterator as $bill) {
  print "Bill " . $iterator->key() . " is ID ";
  print $bill->id . " for " . $bill->amount_cents . " cents.\n";
}
```

Which would result in output similar to:

```
Bill 0 is ID 3cf1290adc08b28899dd7c7e263cca4dc9a2 for 1234 cents
Bill 1 is ID 3cf1b7bc6cfbaeb6b8b2a6001037d284c918 for 100 cents
Bill 2 is ID 3cea3cab019984233228c2eaff0edcbbb733 for 3456 cents
Bill 3 is ID 3ceaf09259f883159622aa4401ab7d06d45a for 2345 cents
Bill 4 is ID 3cea079b288120ffb129dfb62ae18de3dfee for 1234 cents
Bill 5 is ID 3ce95db62b1069e59e122c515eb191c70987 for 12345 cents
Bill 6 is ID 3ce627f7559478bee1129dae3203e373f0df for 1030 cents
Bill 7 is ID 3ce69e91d68417d1e9892ca903eba8c66a2e for 1030 cents
Bill 8 is ID 3ce6eb4a5b433f3e9b073d15a5ff725dec46 for 1020 cents
Bill 9 is ID 3ce66b0e9a510f90fb26906dd0da04df6de0 for 101 cents

```

### Callback processing

[](#callback-processing)

The client is able to process, verify and extract data from callbacks received from the Zipmark service.

#### Loading a callback response

[](#loading-a-callback-response)

A Zipmark\_Callback object must be initialized with a Zipmark\_Client object and the HTTP callback content (headers and body)

The array of HTTP headers sent in the callback POST should be contained in the $\_SERVER variable. The body of the callback POST should be accessible through the call file\_get\_contents('php://input');

```
$callback = new Zipmark_Callback($client, $httpHeaders, $httpBody);
```

#### Verifying a callback

[](#verifying-a-callback)

```
$callbackValid = $callback->isValid();
```

$callbackValid will contain a true or false value.

#### Retrieving the callback data

[](#retrieving-the-callback-data)

Valid callbacks contain events, object types and objects. The below functions will return their respective values/objects, or null if the callback is invalid.

```
$callbackEvent      = $callback->event();
$callbackObjectType = $callback->objectType();
$callbackObject     = $callback->object();
```

API Documentation
-----------------

[](#api-documentation)

Please 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.

Unit/Acceptance Tests
---------------------

[](#unitacceptance-tests)

The 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:

```
$ /path/to/zipmark/php/client/test/all_tests.php

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/28f8fe0294868fa79bd106496c7fb4166b9babe010af0625bb421f82035456f2?d=identicon)[jakehow](/maintainers/jakehow)

---

Top Contributors

[![mecampbellsoup](https://avatars.githubusercontent.com/u/2043821?v=4)](https://github.com/mecampbellsoup "mecampbellsoup (40 commits)")[![jakehow](https://avatars.githubusercontent.com/u/209?v=4)](https://github.com/jakehow "jakehow (1 commits)")

### Embed Badge

![Health badge](/badges/zipmark-zipmark-php/health.svg)

```
[![Health](https://phpackages.com/badges/zipmark-zipmark-php/health.svg)](https://phpackages.com/packages/zipmark-zipmark-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
