Build Status Coverage Status

Payoneer SDK for Ruby:

Install:

gem install payoneer-client

Usage:

client = Payoneer::Client.new(
  Payoneer::Configuration.new(
    username: 'fake-username',
    api_password: 'fake-api-password',
    partner_id: 'fake-partner-id'
  )
)
=> <Payoneer::Client @configuration=<Payoneer::Configuration @partner_id="fake-partner-id", @username="fake-username", @api_password="fake-api-password", @host="api.sandbox.payoneer.com", @auto_approve_sandbox_accounts=true>>

response = client.status
response.ok?
=> true

response.body
=> {
         "Status" => "000",
    "Description" => "Echo Ok - All systems are up."
}

client.version.body
=> {
    "Version" => "4.15"
}

client.payee_signup_url('test').body
=> "https://payouts.sandbox.payoneer.com/partners/lp.aspx?token=fake-token"

client.payee_details('fake-payee-id').body
=> {"FirstName"=>"Foo",
  "LastName"=>"Bar",
  "Email"=>"[email protected]",
  "Address1"=>"123 Main Street",
  "Address2"=>nil,
  "City"=>"Palo Alto",
  "State"=>"CA",
  "Zip"=>"94306",
  "Country"=>"US",
  "Phone"=>"555-867-5309",
  "Mobile"=>nil,
  "PayeeStatus"=>"InActive",
  "PayOutMethod"=>"Direct Deposit",
  "RegDate"=>"12/21/2015 8:03:19 PM",
  "PayoutMethodDetails"=>
   {"Currency"=>"USD",
    "Country"=>"US",
    "BankAccountType"=>"Individual",
    "BankName"=>"Wells Fargo",
    "AccountName"=>"Foo Bar",
    "AccountNumber"=>"123456789",
    "RoutingNumber"=>"121042882",
    "AccountType"=>"S"}}

Advanced Options

If you need to interact with an API host other than the default Payoneer production/sandbox API URLs, you can pass a host option to the configuration:

client = Payoneer::Client.new(
  Payoneer::Configuration.new(
    username: 'fake-username',
    api_password: 'fake-api-password',
    partner_id: 'fake-partner-id',
    host: 'myspecial.api.payoneer.com'
  )
)

If you need to do additional configuration on the underlying HTTP client (RestClient), you can pass additional config under an http_client_options key and this will be passed through directly to the HTTP client.

client = Payoneer::Client.new(
  Payoneer::Configuration.new(
    username: 'fake-username',
    api_password: 'fake-api-password',
    partner_id: 'fake-partner-id',
    http_client_options: {
      verify_ssl: true
    }
  )
)
Performing a normal payout:
response = client.payout(
  program_id: 'fake-partner-id',
  payment_id: 43,
  amount: 100.0,
  payee_id: 42,
  description: "Foo Bar's order"
)

response.body
=> {
    "Description" => "",
      "PaymentID" => "1234",
         "Status" => "000",
     "PayoneerID" => "42"
}
Performing a payout with expanded params:

If the orders type is "url", credentials must be a dictionary containing one of the following:

  • type: "AUTHORIZATION" with a required token field
  • type: "PASSWORD" with required user_name and password fields ```ruby response = client.expanded_payout( payee_id: 42, client_reference_id: 43, amount: 100.0, currency: 'USD', description: "Foo Bar's order", seller_id: 44, seller_name: "Foo Bar", seller_url: "[email protected]", seller_type: 'ECOMMERCE', path: '[email protected]', credentials: { type: 'AUTHORIZATION', token: 'fake_token'} )

response.body => { "audit_id" => 123456789, "code" => 0, "description" => "Success", "payout_id" => "1234", "amount" => 100.0, "currency" => "USD", "PaymentID" => "1234" }


#### Console:

After checking out the repo, run `bin/payoneer-console` for an interactive console that will allow you to experiment.