{"id":18728684,"url":"https://github.com/rubyonworld/promisepay-ruby","last_synced_at":"2025-08-18T08:07:01.804Z","repository":{"id":174008044,"uuid":"542159366","full_name":"RubyOnWorld/promisepay-ruby","owner":"RubyOnWorld","description":"To see a completed integration in a Ruby on Rails app, visit this repository.","archived":false,"fork":false,"pushed_at":"2022-09-27T23:43:56.000Z","size":288,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T06:10:57.185Z","etag":null,"topics":["ap","promisepay","ruby"],"latest_commit_sha":null,"homepage":"","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/RubyOnWorld.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-27T15:32:04.000Z","updated_at":"2022-09-28T01:28:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"a711321f-a560-4001-b7c3-838a9d511895","html_url":"https://github.com/RubyOnWorld/promisepay-ruby","commit_stats":null,"previous_names":["rubyonworld/promisepay-ruby"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RubyOnWorld/promisepay-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fpromisepay-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fpromisepay-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fpromisepay-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fpromisepay-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RubyOnWorld","download_url":"https://codeload.github.com/RubyOnWorld/promisepay-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fpromisepay-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270962391,"owners_count":24675965,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"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":["ap","promisepay","ruby"],"created_at":"2024-11-07T14:23:46.164Z","updated_at":"2025-08-18T08:07:01.795Z","avatar_url":"https://github.com/RubyOnWorld.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruby SDK - PromisePay API\n\n[![Join the chat at https://gitter.im/PromisePay/promisepay-ruby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PromisePay/promisepay-ruby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![Gem Version](https://badge.fury.io/rb/promisepay.svg)](http://badge.fury.io/rb/promisepay)\n[![Build Status](https://travis-ci.org/PromisePay/promisepay-ruby.svg?branch=master)](https://travis-ci.org/PromisePay/promisepay-ruby)\n[![Coverage Status](https://coveralls.io/repos/PromisePay/promisepay-ruby/badge.svg?branch=master)](https://coveralls.io/r/PromisePay/promisepay-ruby?branch=develop)\n[![Code Climate](https://codeclimate.com/github/PromisePay/promisepay-ruby/badges/gpa.svg)](https://codeclimate.com/github/PromisePay/promisepay-ruby)\n\nTo see a completed integration in a Ruby on Rails app, visit this [repository](https://github.com/dannyshafer/PromisePay_api_integration).\n\n# 1. Installation\n\nAdd these lines to your application's Gemfile:\n\n```ruby\ngem 'promisepay'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install promisepay\n\n# 2. Configuration\n\nBefore interacting with Promispay API you need to generate an access token.\n\nSee [PromisePay documentation](https://docs.assemblypayments.com/feature-guides/integration/generating-api-keys/) for more information.\n\n**Create a PromisePay client**\n\nThe client can be configured through environment variables.\n\n```ruby\n# In your environment file\nPROMISEPAY_USERNAME ||= youremailaddress\nPROMISEPAY_TOKEN ||= y0urt0k3n12345678910123456789101\n```\n\nThe following parameters are configurable through the client:\n\n  * `:username` / `ENV['PROMISEPAY_USERNAME']`: username for [basic authentication](https://docs.assemblypayments.com/feature-guides/integration/generating-api-keys/)\n  * `:token` / `ENV['PROMISEPAY_TOKEN']`: token for [basic authentication](https://docs.assemblypayments.com/feature-guides/integration/generating-api-keys/)\n  * `:environment` / `ENV['PROMISEPAY_ENVIRONMENT']`: API [environment](http://docs.assemblypayments.com/feature-guides/fundamentals/environments/) to use (default: 'test')\n  * `:api_domain` / `ENV['PROMISEPAY_API_DOMAIN']`: API domain name to use (default: 'api.promisepay.com')\n\n Instantiate the PromisePay client.\n\n```ruby\nclient = Promisepay::Client.new(username: ENV['PROMISEPAY_USERNAME'], token: ENV['PROMISEPAY_TOKEN'])\n```\n\n# 3. Examples\n\n## Tokens\n##### Example 1 - Request session token\nThe below example shows the controller request for a marketplace configured to have the Item and User IDs generated automatically for them. Note: by default, the ability to have PromisePay auto generate IDs is turned off. However, it can easily be requested by contacting PromisePay support.\n\n```ruby\ntoken_request = client.tokens.create(:session, {\n  current_user: 'seller',\n  item_name: 'Test Item',\n  amount: '2500',\n  seller_lastname: 'Seller',\n  seller_firstname: 'Sally',\n  buyer_lastname: 'Buyer',\n  buyer_firstname: 'Bobby',\n  buyer_country: 'AUS',\n  seller_country: 'USA',\n  seller_email: 'sally.seller@promisepay.com',\n  buyer_email: 'bobby.buyer@promisepay.com',\n  fee_ids: [],\n  payment_type_id: 2\n})\ntoken = token_request['token']\nitem_id = token_request['item']\nbuyer_id = token_request['buyer']\nseller_id = token_request['seller']\n```\n##### Example 2 - Request session token\nThe below example shows the request for a marketplace that passes the Item and User IDs.\n\n```ruby\ntoken = client.tokens.create(:session, {\n  current_user_id: 'seller1234',\n  item_name: 'Test Item',\n  amount: '2500',\n  seller_lastname: 'Seller',\n  seller_firstname: 'Sally',\n  buyer_lastname: 'Buyer',\n  buyer_firstname: 'Bobby',\n  buyer_country: 'AUS',\n  seller_country: 'USA',\n  seller_email: 'sally.seller@promisepay.com',\n  buyer_email: 'bobby.buyer@promisepay.com',\n  external_item_id: 'TestItemId1234',\n  external_seller_id: 'seller1234',\n  external_buyer_id: 'buyer1234',\n  fee_ids: [],\n  payment_type_id: 2\n})['token']\n```\n## Items\n\n##### Create an item\n```ruby\nitem = client.items.create(\n  id: '12345',\n  name: 'test item for 5AUD',\n  amount: '500',\n  payment_type: '1',\n  buyer_id: buyer.id,\n  seller_id: seller.id,\n  fee_ids: fee.id,\n  description: '5AUD transfer'\n)\n```\n##### Get an item\n```ruby\nitem = client.items.find('1')\n```\n##### Get a list of items\n```ruby\nitems = client.items.find_all\n```\n##### Update an item\n```ruby\nitem.update(name: 'new name')\n```\n##### Cancel an item\n```ruby\nitem.cancel\n```\n##### Get an item status\n```ruby\nitem.status\n```\n##### Get an item's buyer\n```ruby\nitem.buyer\n```\n##### Get an item's seller\n```ruby\nitem.seller\n```\n##### Get an item's fees\n```ruby\nitem.fees\n```\n##### Get an item's transactions\n```ruby\nitem.transactions\n```\n##### Get an item's batch transactions\n```ruby\nitem.batch_transactions\n```\n##### Get an item's wire details\n```ruby\nitem.wire_details\n```\n##### Get an item's BPAY details\n```ruby\nitem.bpay_details\n```\n\n## Users\n\n##### Create a user\n```ruby\nuser = client.users.create(\n  id: '123456',\n  first_name: 'test',\n  last_name: 'buyer',\n  email: 'buyer@test.com',\n  address_line1: '48 collingwood',\n  state: 'vic',\n  city: 'Mel',\n  zip: '3000',\n  country: 'AUS',\n  dob:'12/06/1980'\n)\n```\n##### Update a user\n```ruby\nuser = client.users.update(\n  id: '123456',\n  first_name: 'test',\n  last_name: 'buyer',\n  email: 'buyer@test.com',\n  address_line1: '48 collingwood',\n  state: 'vic',\n  city: 'Mel',\n  zip: '3000',\n  country: 'AUS',\n  dob:'12/06/1980'\n)\n```\n##### Get a user\n```ruby\nuser = client.users.find('1')\n```\n##### Get a list of users\n```ruby\nusers = client.users.find_all\n```\n##### Get a user's card account\n```ruby\nuser.card_account\n```\n##### Get a user's PayPal account\n```ruby\nuser.paypal_account\n```\n##### Get a user's bank account\n```ruby\nuser.bank_account\n```\n##### Get a user's wallet account\n```ruby\nuser.wallet_account\n```\n##### Get a user's items\n```ruby\nuser.items\n```\n##### Get a user's address\n```ruby\nuser.address\n```\n##### Set a user's disbursement account\n```ruby\nuser.disbursement_account(bank_account.id)\n```\n## Item Actions\n##### Make payment\n```ruby\nitem.make_payment(\n  account_id: buyer_card_account.id\n)\n```\n##### Request payment\n```ruby\nitem.request_payment\n```\n##### Release payment\n```ruby\nitem.release_payment\n```\n##### Request release\n```ruby\nitem.request_release\n```\n##### Cancel\n```ruby\nitem.cancel\n```\n##### Acknowledge wire\n```ruby\nitem.acknowledge_wire\n```\n##### Acknowledge PayPal\n```ruby\nitem.acknowledge_paypal\n```\n##### Revert wire\n```ruby\nitem.revert_wire\n```\n##### Request refund\n```ruby\nitem.request_refund(\n  refund_amount: '1000',\n  refund_message: 'because'\n)\n```\n##### Decline refund\n```ruby\nitem.decline_refund\n```\n##### Refund\n```ruby\nitem.refund(\n  refund_amount: '1000',\n  refund_message: 'because'\n)\n```\n##### Raise dispute\n```ruby\nitem.raise_dispute(user_id: '5830def0-ffe8-11e5-86aa-5e5517507c66')\n```\n##### Request resolve dispute\n```ruby\nitem.request_resolve_dispute\n```\n##### Resolve dispute\n```ruby\nitem.resolve_dispute\n```\n##### Escalate dispute\n```ruby\nitem.escalate_dispute\n```\n##### Send tax invoice\n```ruby\nitem.send_tax_invoice\n```\n##### Request tax invoice\n```ruby\nitem.request_tax_invoice\n```\n## Card Accounts\n##### Create a card account\n```ruby\ncard_account = client.card_accounts.create(\n  user_id: buyer.id,\n  full_name: 'test Buyer',\n  number: '4111 1111 1111 1111',\n  expiry_month: Time.now.month,\n  expiry_year: Time.now.year + 1,\n  cvv: '123'\n)\n```\n##### Get a card account\n```ruby\ncard_account = client.card_accounts.find('1')\n```\n##### Deactivate a card account\n```ruby\ncard_account.deactivate\n```\n##### Get a card account's users\n```ruby\ncard_account.user\n```\n\n## Bank Accounts\n##### Create a bank account\n```ruby\nbank_account = client.bank_accounts.create(\n  user_id: seller.id,\n  bank_name: 'Nab',\n  account_name: 'test seller',\n  routing_number: '22222222',\n  account_number: '1234567890',\n  account_type: 'savings',\n  holder_type: 'personal',\n  country: 'AUS'\n)\n```\n##### Get a bank account\n```ruby\nbank_account = client.bank_accounts.find('1')\n```\n##### Deactivate a bank account\n```ruby\nbank_account.deactivate\n```\n##### Get a bank account's users\n```ruby\nbank_account.user\n```\n##### Validate Routing Number\n```ruby\nclient.bank_accounts.validate('122235821')\n```\n\n## PayPal Accounts\n##### Create a PayPal account\n```ruby\npaypal_account = client.paypal_accounts.create(\n  user_id: seller.id,\n  paypal_email: 'seller@promisepay.com'\n)\n```\n##### Get a PayPal account\n```ruby\npaypal_account = client.paypal_accounts.find('1')\n```\n##### Deactivate a PayPal account\n```ruby\npaypal_account.deactivate\n```\n##### Get a PayPal account's users\n```ruby\npaypal_account.user\n```\n\n## Wallet Accounts\n##### Get a Wallet account\n```ruby\nwallet_account = client.wallet_accounts.find('1')\n```\n##### Deposit funds\n```ruby\nwallet_account.deposit(\n  account_id: '123',\n  amount: 500\n)\n```\n##### Withdraw funds\n```ruby\nwallet_account.withdraw(\n  account_id: '123',\n  amount: 200\n)\n```\n##### Get a Wallet account's users\n```ruby\nwallet_account.user\n```\n\n## Companies\n\n##### Create a company\n```ruby\nclient.companies.create(\n  user_id: \"1\",\n  name: \"Acme Co\",\n  legal_name: \"Acme Co Pty Ltd\",\n  tax_number: \"1231231\",\n  charge_tax: true,\n  address_line1: \"123 Test St\",\n  address_line2: \"\",\n  city: \"Melbourne\",\n  state: \"VIC\",\n  zip: \"3000\",\n  country: \"AUS\"\n)\n```\n\n##### Get a company\n```ruby\nclient.companies.find('compamy_id')\n```\n\n##### Get a list of companies\n```ruby\nclient.companies.find_all\n```\n\n##### Get a company's address\n```ruby\ncompany.address\n```\n\n##### Update a company\n```ruby\nclient.companies.update(\n  id: \"8d578b9c-5b79-11e5-885d-feff819cdc9f\",\n  name: \"Acme Co\",\n  legal_name: \"Acme Co Pty Ltd\",\n  tax_number: \"1231231\",\n  charge_tax: true,\n  address_line1: \"123 Test St\",\n  address_line2: \"\",\n  city: \"Melbourne\",\n  state: \"VIC\",\n  zip: \"3000\",\n  country: \"AUS\"\n)\n```\n\n## Fees\n##### Get a list of fees\n```ruby\nfees = client.fees.find_all\n```\n##### Get a fee\n```ruby\nfees = client.fees.find('1')\n```\n##### Create a fee\n```ruby\nfee = client.fees.create(\n  name: 'test fee for 5 AUD',\n  fee_type_id: '1',\n  amount: '75',\n  to: 'seller'\n)\n```\n\n## Transactions\n##### Get a list of transactions\n```ruby\ntransactions = client.transactions.find_all\n```\n##### Get a transaction\n```ruby\ntransaction = client.transactions.find('1')\n```\n##### Get a transaction's users\n```ruby\ntransaction.users\n```\n##### Get a transaction's fees\n```ruby\ntransaction.fees\n```\n\n## Batch Transactions\n##### Get a list of batch transactions\n```ruby\nbatch_transactions = client.batch_transactions.find_all\n```\n##### Get a transaction\n```ruby\nbatch_transaction = client.batch_transactions.find('1')\n```\n\n## Charges\n##### Get a list of charges\n```ruby\ncharges = client.charges.find_all\n```\n##### Get a charge\n```ruby\ncharge = client.charges.find('1')\n```\n##### Create a charge\n```ruby\ncharge = client.charges.create(\n  account_id: '123',\n  user_id: '456',\n  name: 'Charge for Delivery',\n  email: 'anonymous+buyer+1@promisepay.com',\n  amount: 4_500,\n  zip: '3000',\n  curency: 'AUD',\n  country: 'AUS',\n  retain_account: true,\n  device_id: '0900JapG4txqVP4Nf...',\n  ip_address: '172.16.81.100'\n)\n```\n##### Get a charge's buyer\n```ruby\ncharge.buyer\n```\n##### Get a charge's status\n```ruby\ncharge.status\n```\n\n## Direct Debit Authority\n##### Get a list of direct debit authorities for a given account\n```ruby\nbank_account = client.bank_accounts.find('9fda18e7-b1d3-4a83-830d-0cef0f62cd25')\nddas = client.charges.find_all(bank_account.id)\n```\n##### Get a direct debit authority\n```ruby\ndda = client.direct_debit_authorities.find('8f233e04-ffaa-4c9d-adf9-244853848e21')\n```\n##### Create a direct debit authority\n```ruby\ncharge = client.direct_debit_authorities.create(\n  account_id: '9fda18e7-b1d3-4a83-830d-0cef0f62cd25',\n  amount: '10000'\n)\n```\n##### Delete a direct debit authority\n```ruby\ndda = client.direct_debit_authorities.find('8f233e04-ffaa-4c9d-adf9-244853848e21')\ndda.delete\n```\n\n## Tools\n##### Health check\n```ruby\nclient.tools.health_check\n```\n## Marketplace\n```ruby\nclient.marketplace\n```\n\n## Token\n##### Generate\n```ruby\nclient.generate_token(token_type: 'card', user_id: '5830def0-ffe8-11e5-86aa-5e5517507c66')\n```\n\n_Check out the [online documentation](http://promisepay.github.io/promisepay-ruby/) to get a full list of available resources and methods._\n\n# 4. Contributing\n\n  1. Fork it ( https://github.com/PromisePay/promisepay-ruby/fork )\n  2. Create your feature branch (`git checkout -b my-new-feature`)\n  3. Commit your changes (`git commit -am 'Add some feature'`)\n  4. Push to the branch (`git push origin my-new-feature`)\n  5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fpromisepay-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyonworld%2Fpromisepay-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fpromisepay-ruby/lists"}