Adyen API Library for ruby
Payouts are authenticated via webservice username and password.
adyen.ws_user = "ws@Company.TestCompany"
adyen.ws_passord = "super_secure_password123"
Merchants can send funds to a third-party's eligible credit card, bank account or digital wallet for payments such as insurance claims, rebates, affiliate and contractor payouts, expense reimbursements, or gaming winnings.
Each payout requires a 4-eye policy check, where one user submits a payout, before it is confirmed and executed by another user.
To set up third-party payouts, you need to:
To store details to payout to, use the store_details method:
response = adyen.payouts.store_detail('{
"recurring" : {
"contract" : "PAYOUT"
},
"bank": {
"bankName": "AbnAmro",
"bic": "ABNANL2A",
"countryCode": "NL",
"iban": "NL32ABNA0515071439",
"ownerName": "Adyen",
"bankCity": "Amsterdam",
"taxId":"bankTaxId"
},
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT",
"shopperEmail" : "shopper@email.com",
"shopperReference" : "<ShopperReference>",
"dateOfBirth" : "1990-01-01",
"entityType" : "Company",
"nationality" : "NL"
}')
After you've stored the payout details, call the submit_third_party method to request a payout:
response = adyen.payouts.submit_third_party('{
"amount": {
"currency": "EUR",
"value": "1000"
},
"recurring": {
"contract": "PAYOUT"
},
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"reference": "YOUR_REFERENCE",
"shopperEmail": "shopper@email.com",
"shopperReference": "TheShopperReference",
"selectedRecurringDetailReference": "LATEST"
}')
Note that you can combine these steps with the store_detail_and_submit_third_party method, by including the amount object in the original store_detail call.
Once you've stored the payout account details and submitted a payout request, you must confirm the payout to initialize the transfer of funds:
response = adyen.payouts.confirm_third_party('{
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT",
"originalReference" : "<PSP reference in response from submit_third_party>"
}')
If you decide to decline the payout, you can make the same call to the decline_third_party method to cancel it.