简体   繁体   English

具有预先批准的自适应付款的定期贝宝

[英]recurring paypal with preapproval adaptive payment

I have create rails application and implemented preapproval payment using adaptivepayments-sdk-ruby gem. 我已经创建了Rails应用程序,并使用adaptivepayments-sdk-ruby gem实现了预批准付款。 I plan to use this as recurring payment. 我打算将其用作定期付款。

this is my code for create preapproval: 这是我用于创建预批准的代码:

ADAPTIVE_PAYMENT.build_preapproval({
  :cancelUrl => my_cancel_url,
  :currencyCode => "USD",
  :paymentPeriod => "DAILY",
  :returnUrl => my_return_url,
  :startingDate => DateTime.now.in_time_zone
})

and then I use this code to charge: 然后我使用此代码进行收费:

ADAPTIVE_PAYMENT.build_pay({
  :actionType => "PAY",
  :cancelUrl => my_cancel_url,
  :currencyCode => "USD",
  :feesPayer => "PRIMARYRECEIVER",
  :preapprovalKey => Preapproval_key,
  :receiverList => {
    :receiver => [{
      :amount => 100,
      :email => example@example.com,
      :primary => true},
      {
      :amount => $100,
      :email => example@example.com,
      :primary => false }
    ]
  },
  :returnUrl => my_return_url
})

How to make it automatically charged every day without execute the pay code again? 如何使它每天自动收费而无需再次执行支付代码?

Im pretty sure there is no automatic pay feature from paypals side. 我很确定从PayPal方面没有自动付款功能。 I know that you can setup how many monthly / weekly payments they are signing up for but I think thats just for the pre-approval agreement. 我知道您可以设置要注册的每月/每周付款次数,但是我认为那只是为了预先批准协议。

However, why dont you just setup a CRON job and let it take care of it for you? 但是,为什么不设置CRON作业并让它为您处理呢? I was super nervous about doing this with paypal adaptive payments the first time but its actually saved me SO much time and its a lot more reliable than any human could be with its ability to send job reports after its done. 第一次使用Paypal适应性付款使我感到非常紧张,但是它实际上为我节省了很多时间,并且在完成任务后能够发送工作报告,这比任何人都可靠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM