The syntax is sort of like JSON would be. []
is an array, you would add more members to that MassPayItem
array:
:MassPayItem => [{
:ReceiverEmail => "enduser_biz@gmail.com",
:Amount => {
:currencyID => "EUR",
:value => "3.00"
}
},
{
:ReceiverEmail => "enduser_biz2@gmail.com",
:Amount => {
:currencyID => "EUR",
:value => "1.00"
}
}]
ending up with:
require 'paypal-sdk-merchant'
@api = PayPal::SDK::Merchant::API.new
# Build request object
@mass_pay = @api.build_mass_pay({
:ReceiverType => "EmailAddress",
:MassPayItem => [{
:ReceiverEmail => "enduser_biz@gmail.com",
:Amount => {
:currencyID => "EUR",
:value => "3.00"
}
},
{
:ReceiverEmail => "enduser_biz2@gmail.com",
:Amount => {
:currencyID => "EUR",
:value => "1.00"
}
}]
})
# Make API call & get response
@mass_pay_response = @api.mass_pay(@mass_pay)
# Access Response
if @mass_pay_response.success?
else
@mass_pay_response.Errors
end