限制Paypal仅接受来自美国客户的付款

时间:2014-11-17 11:16:41

标签: ruby-on-rails-3 paypal paypal-adaptive-payments

我正在使用自适应付款,我希望在减少佣金后支付转售费用:

我想对国内(美国)交易与外国交易收取不同的费率。

国内:每次交易3.0%+ 0.30美元

PayPal:每次交易2.9%+ 0.30美元

净收益:+ 0.1%

外国:每笔交易4.0%+ 0.30美元

PayPal:每次交易3.9%+ 0.30美元

净收益:+ 0.1%

由于费率不同所以我计划只允许美国客户付款。但我不知道信用卡的来源或PayPal将收取的费用。

此外,以下是我们用于发送请求的代码,但未找到任何参数将其限制为国内付款。

@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

0 个答案:

没有答案