Installation
Add this line to your application's Gemfile
:
gem 'wayforpay'
And then execute:
$ bundle install
To manually install wayforpay
via Rubygems just run:
$ gem install wayforpay
Documentation
Usage
require 'wayforpay'
Create new file config/initializers/wayforpay.rb
and put your own credentials here (required):
Wayforpay.configure do |config|
config.merchant_account = 'test_merch_n1' # Seller identifier. This value is assigned to You from the side of WayForPay
config.merchant_domain_name = 'example.com'
config.encrypt_secret_key = 'flk3409refn54t54t*FNJRET'
end
Click here for more information.
Payments
### Blocking money on the payment card (Hold)
Wayforpay::Payments.hold(parameters)
Required parameters:
| Parameter | Description | | ----------------- | ------------------------------------------------------ | | orderReference | Unique number of the order in merchant’s system | | orderDate | Date of order placing | | amount | Amount of refund | | currency | Currency of order: UAH (USD, EUR) | | productName[] | Array with the names of ordered products | | productPrice[] | Array with the prices per product unit | | productCount[] | Array with the quantity of ordered goods by each item | | card | Card number 16 characters | | expMonth | Card Expiry Date (mounth) - MM | | expYear | Card Expiry Date (year) - YY | | cardCvv | Card Security Code CVV / CVV2 | | cardHolder | Cardholder Name, as indicated on the card | | recToken | Card token for recarring withdrawals, without client (without reference to card details) |
Note: fields (card+expMonth+expYear+cardCvv+cardHolder) or recToken should be required.
An example of request:
{
"orderReference": "myOrder1",
"orderDate": 1421412898,
"amount": 0.13,
"currency": "UAH",
"card": "4111111111111111",
"expMonth": "11",
"expYear": "2020",
"cardCvv": "111",
"cardHolder": "TARAS BULBA",
"productName": ["Samsung WB1100F","Samsung Galaxy Tab 4 7.0 8GB 3G Black"],
"productPrice": [21.1,30.99],
"productCount": [1,2]
}
### Refund/Cancellation of payment (Refund)
Wayforpay::Payments.refund(parameters)
Required parameters:
| Parameter | Description | | ----------------- | ----------------------------------------------- | | orderReference | Unique number of the order in merchant’s system | | amount | Amount of refund | | currency | Currency of order: UAH | | comment | Merchant Comment, Description reversal reason |
An example of request:
{
"orderReference": "DH783023",
"amount": 100,
"currency": "UAH",
"comment": "Not in stock"
}
### Withdrawal of blocked amount (Settle)
Wayforpay::Payments.settle(parameters)
Required parameters:
| Parameter | Description | | ----------------- | ----------------------------------------------- | | orderReference | Unique number of the order in merchant’s system | | amount | The amount of write-offs confirmation | | currency | Write-off currency |
An example of request:
{
"orderReference": "DH783023",
"amount": 100 ,
"currency": "UAH"
}
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright
Copyright (c) 2018 Active Bridge, LLC. See LICENSE for details.