{"id":28399180,"url":"https://github.com/zipmark/zipmark-ruby","last_synced_at":"2025-06-11T23:04:21.158Z","repository":{"id":5304243,"uuid":"6485647","full_name":"zipmark/zipmark-ruby","owner":"zipmark","description":"Official Ruby Client for the Zipmark API","archived":false,"fork":false,"pushed_at":"2015-07-10T21:50:37.000Z","size":447,"stargazers_count":1,"open_issues_count":5,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-01T15:06:01.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/zipmark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-01T06:03:57.000Z","updated_at":"2015-10-28T18:55:10.000Z","dependencies_parsed_at":"2022-07-05T07:02:18.604Z","dependency_job_id":null,"html_url":"https://github.com/zipmark/zipmark-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zipmark/zipmark-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zipmark","download_url":"https://codeload.github.com/zipmark/zipmark-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zipmark%2Fzipmark-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259360797,"owners_count":22845818,"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:18.017Z","updated_at":"2025-06-11T23:04:21.152Z","avatar_url":"https://github.com/zipmark.png","language":"Ruby","readme":"[![Build Status](https://secure.travis-ci.org/zipmark/zipmark-ruby.png?branch=master)](https://travis-ci.org/zipmark/zipmark-ruby)\n[![Dependency Status](https://gemnasium.com/zipmark/zipmark-ruby.png)](https://gemnasium.com/zipmark/zipmark-ruby)\n[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/zipmark/zipmark-ruby)\n\n\n# Zipmark Ruby Client\n\nThe Zipmark Ruby Client library is used to interact with Zipmark's [API](https://dev.zipmark.com).\n\n## Installation\n\n```sh\ngem install zipmark\n```\nor in your Gemfile\n\n```ruby\ngem \"zipmark\"\n```\n\n### Instantiating a client\n\n```ruby\nrequire 'zipmark'\n\nclient = Zipmark::Client.new(\n  :application_id =\u003e \"app-id\",\n  :application_secret =\u003e \"my-secret\",\n  :vendor_identifier =\u003e \"vendor-ident\"\n)\n```\n\nVendor Identifier, Application Identifier, Application Secret should be replaced with the\nvalues provided by Zipmark.\n\n### Production Mode\n\nBy default, Zipmark::Client sends all requests to our sandbox environment.  This environment is identical to production except money never actually is moved.  When you are putting your application into production and want people to actually be able to pay, you need to turn production mode on.\n\n```ruby\nclient = Zipmark::Client.new(\n  :application_id =\u003e \"app-id\",\n  :application_secret =\u003e \"my-secret\",\n  :vendor_identifier =\u003e \"vendor-ident\",\n  :production =\u003e true\n)\n```\n\n### Loading a Bill from a known Bill ID\n\n```ruby\nclient.bills.find(\"bill-id\")\n```\n\nAttempting to find a bill that doesn't exist will raise a Zipmark::NotFound error.\n\n### Discovering available resources\n\nResources will contain an array of all available resources.\n\n```ruby\nclient.resources.keys\n```\n\n### Creating a new Bill\n\nCreate a bill object, set required attributes, send it to Zipmark\n\n```ruby\nbill = client.bills.create(\n  :identifier =\u003e \"1234\",\n  :amount_cents =\u003e 100,\n  :bill_template_id =\u003e bill_template_id,\n  :memo =\u003e \"My memo\",\n  :content =\u003e '{\"memo\":\"My Memo\"}',\n  :customer_id =\u003e \"Customer 1\",\n  :date =\u003e \"20130805\")\n```\n\nAs an alternative, it is possible to build an object first and then save it afterwards\n\n```ruby\nbill = client.bills.build(\n  :identifier =\u003e \"1234\",\n  :amount_cents =\u003e 100,\n  :bill_template_id =\u003e bill_template_id,\n  :memo =\u003e \"My memo\",\n  :content =\u003e '{\"memo\":\"My Memo\"}',\n  :customer_id =\u003e \"Customer 1\",\n  :date =\u003e \"20130805\")\nbill.save\n```\n\nRegardless of which method is used, if a bill is valid, it was successfully saved to Zipmark:\n\n```ruby\nputs bill.errors unless bill.valid?\n```\n\n### Updating an existing Bill\n\nGet the bill, make a change, send it back to Zipmark\n\n### Retrieving a list of all Bills\n\nRetrieve a list of all bills.\n\nGet the number of objects available.\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\nGet the current object (returns null if the iterator has passed either end of the list)\n\nGet the next/previous object (returns null if the next/previous object would pass either end of the list)\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### Callback processing\n\nThe client is able to process, verify and extract data from callbacks received from the Zipmark service.\n\n#### Setting up a Callback\n\nCallbacks have to be enabled by creating a callback with an event type and the callback URL. To enable Zipmark to send a callback:\n\n```ruby\ncallback = client.callbacks.create(\n  :url =\u003e 'https://example.com/callback',\n  :event =\u003e 'name_of_event')\n```\n\nThe possible event names include:\n\n * bill.create\n * bill.update\n * bill_payment.create\n * bill_payment.update\n\n#### Loading a callback response\n\n#### Verifying a callback\n\nTo verify a callback, you need the entire request (headers, request body, etc.) so it has to be done from the context of the controller layer (or a model that is passed the entire request).\n\n```ruby\n# In a controller:\nclient.build_callback(request).valid?\n```\n\nWill return true or false, based on a signed header from Zipmark.\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## 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\nTests are written in rspec.  To run the full test suite, execute the following:\n\n```\nbundle install\n\nbundle exec rake spec\n```\n\n\n#### Creating a Token\n\nFor a Workflow\n```\nworkflow = client.workflow.create(name: 'enrollment', data: { customer_id: 'some unique permanent id' })\nworkflow.token\n```\n\nFor a Display\n```\ndisplay = client.display.create(name: 'recent-transaction', data: { customer_id: 'some unique permanet id' })\ndisplay.token\n```\n\n\n#### Deposits Resource\n\n**Get deposits**\n`client.get('deposits')`\n\n**Get a specific deposit**\n`client.get('deposits/DEPOSIT_ID')`\n\n**Cancel a deposit**\n`client.put('deposits/DEPOSIT_ID/cancel', '')`\n\n**Make a Depost**\n```ruby\nbody = { :deposit =\u003e { :customer_identifier =\u003e 'their unique and permanent identifier', :amount_cents =\u003e 1000, :memo =\u003e 'an example memo' } }\nclient.post('deposits', body)\n```\n\n#### Customers Resource\n\n**Get Customers**\n`client.get('customers')`\n\n**Get a specific customer**\n`client.get('customers/CUSTOMER_ID')`\n\n#### Accounts Resource\n\n**Get accounts**\n`client.get('accounts')`\n\n**Get a specific account**\n`client.get('accounts/ACCOUNT_ID')`\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipmark%2Fzipmark-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipmark%2Fzipmark-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipmark%2Fzipmark-ruby/lists"}