I am using Adaptive Payment and I want to pay re-seller after cut down my commission:
I want to charge different rates for domestic (USA) transactions versus foreign transactions.
Domestic: 3.0% + $0.30 per transaction
PayPal: 2.9% + $0.30 per transaction
Net gain: +0.1%
Foreign: 4.0% + $0.30 per transaction
PayPal: 3.9% + $0.30 per transaction
Net gain: +0.1%
Since rates are different so I have planned to allow only USA customer to pay. but I do not know where the credit card is from or what rate PayPal is going to charge.
Moreover, here is the code that we are using to sent request and do not find any parameter to restrict it to domestic payments.
@api = PayPal::SDK::AdaptivePayments::API.new
@pay = @api.build_pay({
:item_name => 'Invoiced #'+invoice.id.to_s+invoice.reason,
:invoice_amount => amount['total_amount'],
:actionType => "PAY",
:cancelUrl => pay_finish_members_invoices_url(:id=>token,:ttn_id=>ttn_token,:status=>"Cancel"),
:currencyCode => "USD",
:feesPayer => "PRIMARYRECEIVER",
:ipnNotificationUrl => pay_finish_members_invoices_url(:id=>token,:ttn_id=>ttn_token,:status=>"Completed"),
:trackingId => tmp_transaction.id.to_s,
:memo => "Single invoice paid by member directly.",
:receiverList => {
:receiver => [
{ :amount => amount['total_amount'],
:email => Trunk::PAYPAL_EMAIL,
:primary => true,
:paymentType => "SERVICE"
},
{ :amount => amount['coach_amount'],
:email => @site_settings.paypal_email,
:primary => false,
:paymentType => "SERVICE"
}
]
},
:returnUrl => pay_finish_members_invoices_url(:id=>token,:ttn_id=>ttn_token,:status=>"Completed"),
=begin
:fundingConstraint => {
:allowedFundingType => {
:fundingTypeInfo => [{
:fundingType => "BALANCE" }] }
},
=end
:sender => {
:useCredentials => false
}
})
@pay_response = @api.pay(@pay)
#abort(@pay_response.inspect)
if @pay_response.success?
@pay_response.payKey
@pay_response.paymentExecStatus
@pay_response.payErrorList
@pay_response.paymentInfoList
@pay_response.sender
@pay_response.defaultFundingPlan
@pay_response.warningDataList
params = {
:cmd => "_ap-payment",
:paykey => @pay_response.payKey
}
paypal_url = "#{Trunk::PAYPAL_URL}?#{params.to_query}"
tmp_transaction = TempTransaction.where(:id => tmp_transaction.id).first
tmp_transaction.txn_id = @pay_response.payKey
tmp_transaction.status = 1
tmp_transaction.save
redirect_to paypal_url and return
else
flash[:alert] = @pay_response.error.to_s
end