Attention! This repository is not currently maintained
This is a ruby lib that allows to use the PayStand API
To install using bundler:
gem 'paystand', github: 'hinthealth/paystand-ruby'
And add the next initializer:
PayStand.configure do |config|
config.client_id = ''
config.client_secret = ''
config.publishable_key = ''
config.platform_customer_id = ''
config.log_enabled = false
config.env = :production # it could be sandbox/dev
end
This lib doesn't cover everything on the PayStand API, you can use payments, customers, accounts, refunds, cards, banks and withdrawals. We documented some of them in the next paragraphs.
card = {
name_on_card: "Jane Doe",
card_number: "4000000000000077",
security_code: "123",
expiration_month: "11",
expiration_year: "2018",
billing_address: {
name: "Jane Doe",
street1: "123 test st",
city: "santa cruz",
state: "CA",
postal_code: "95060",
country: "USA"
}
}
params = {
card: card,
amount: 20.00,
currency: 'USD',
}
payment = PayStand::Payment.create(params)
params[:transfer_type] = 'advanced'
params[:transfers] = {
'merchant_key_1' => {
'account_key_1' => {
final: 1.00,
},
'account_key_2' => {
final: 2.00,
}
},
'owner' => {
default: {
final: 6.00
}
}
}
response = PayStand::Payment.create(child_customer_id, params)
address = {
street1: "123 account st",
city: "Los Angeles",
state: "CA",
postal_code: "12345",
country: "USA"
}
bank = {
name_on_account: "Martha Flowers",
account_holder_type: "company",
account_number: "000123456789",
routing_number: "110000000",
account_type: "checking",
country: "USA",
currency: "USD"
}
customer = {
name: "John Doe",
email: "[email protected]",
address: address,
plan_key: 'my_plan_key',
merchant_key: 'child_customer_sub',
legal_entity: {
entity_type: "LLC",
years_in_business: "5",
business_name: "Martha's Flowers",
business_tax_id: "000000000",
business_sales_volume: "2000",
business_accepted_cards: true,
personal_tax_id: "000000000",
stake_percent: "100"
},
contact: {
first_name: "Martha",
last_name: "Flowers",
email: "[email protected]",
phone: "8312223333",
date_of_birth: "08-30-1984"
},
merchant: {
business_name: "Martha's FLowers",
business_url: "http://www.example.com",
business_logo: "http://www.example.com/images/flowers.jpg",
support_email: "[email protected]",
support_phone: "8317778888",
support_url: "http://www.example.com"
},
default_bank: bank
}
customer_created = PayStand::Customer.create(customer)
new_customer_id = customer_created.account.id
customer_created = PayStand::Customer.retrieve(new_customer_id)
customer_created = PayStand::Customer.update(new_customer_id, {merchant_key: 'child_customer_sub' })
child_customer_id = '8467x11b5qwfn4fv4byauf6g'
balance = PayStand::Balance.summary(child_customer_id)
account = {
name: "My Account",
key: "my_account",
}
response = PayStand::BalanceAccount.create(account)
Add require 'pay_stand/testing'
to your spec helper and you can activate it with PayStand::Testing.enable
, an example of rspec is:
require 'pay_stand/testing'
RSpec.configure do |config|
config.before(:each) do |example|=
PayStand::Testing.enable if example.metadata[:mock_paystand]=
end
config.after(:each) do |example|
PayStand::Testing.disable if example.metadata[:mock_paystand]
end
end
- Support maintaining a session with refreshing the token.