-
Notifications
You must be signed in to change notification settings - Fork 21
Sending payments to multiple receivers
Irio edited this page Nov 30, 2012
·
4 revisions
Moip allows you to define multiple receivers. You can set one receiver with a percentage value (15%), a second with a fixed value (R$ 2,90) and a third one with a fixed value (R$ 1,00). Percentage values are always based on the sum of paid values.
The fee payer is, by default the primary receiver, which can be changed in the MyMoip::Instruction.
commissions = []
# Fixed value
commissions << MyMoip::Commission.new(
reason: 'System maintenance',
receiver_login: 'commissioned_moip_login',
fixed_value: 15.0
)
# Percentage value
commissions << MyMoip::Commission.new(
reason: 'Shipping',
receiver_login: 'commissioned_moip_login',
percentage_value: 0.1
)
instruction = MyMoip::Instruction.new(
id: "instruction_id_defined_by_you",
payment_reason: "Order in Buy Everything Store",
values: [100.0],
payer: payer,
commissions: commissions
)
# Instructions have non-mandatory attributes related
instruction.fee_payer_login = 'fee_payer_moip_login'
instruction.payment_receiver_login = 'payment_receiver_moip_login'
instruction.payment_receiver_name = 'payment_receiver_nickname'
Official documentation (in Portuguese)