synapse_client
A ruby client for the SynapsePay.com API.
I originally wrote this in a rails app of mine and stripped this out. There's some work left to do to really make it a true ruby gem. See that in the todo section.
Notes
- This is written with the perspective of being the merchant. This gem doesn't support marketplace payments yet, although SynapsePay does support that.
- This is also written with the assumption that a customer has no knowledge of their Synapse account. This means:
- that this gem says "Customers" when Synapse says "Users"
- all orders are bank pay orders
- customers do not have passwords
Installation
Include the following in your Gemfile
gem "synapse_client"
and then run bundle install
.
You can also simply run gem install synapse_client
.
Usage
See the specs for the most up to date usage demo.
configuration
SynapseClient.client_id = "e06fa0f143a267c2ed8e"
SynapseClient.client_secret = "f578105bf9ae03d9310e0af6f4637c1bf363998b"
SynapseClient.merchant_synapse_id = 1
SynapseClient.dev = true
create a customer
SynapseClient::Customer.create({
:email => "foo@example.com",
:fullname => "Foo Bar,
:phonenumber => "5555555555",
:ip_address => "8.8.8.8",
:force_create => true
})
retrieve a customer
SynapseClient::Customer.retrieve("_customer_access_token_")
list bank accounts for a customer
@customer.bank_accounts
add a bank account to a customer with just account & routing number
@customer.add_bank_account({
:account_num => "1111111111",
:routing_num => "084000026",
:nickname => "Example bank account",
:account_type => "1",
:account_class => "1"
})
link a bank account to a customer with bank username/password
@customer.link_bank_account({
:username => "synapse_good",
:password => "test1234",
:pin => "1234",
:bank => "Bank of America"
})
get recent orders for a customer
@customer.orders
add an order for a customer
@customer.add_order({
:amount => 500, # $500 USD
:bank_id => 1
})
retrieve an order
SynapseClient::Order.retrieve(4)
TODO (in order of priority)
- Add KYC Documents
- Logger config
- MassPay
- Security Questions
- Deposits
- Withdrawals
- Callbacks?
Links
Want to show your appreciation?
If this gem has helped you and you'd like to show your appreciation, feel free to use one of the methods below to buy me coffee: