简体   繁体   中英

PayPal REST API Update Billing Agreement

我如何更新当前有效的结算协议以更改帐单日期,如果新日期是将来再次收费?

Through the update billing agreement API you can not change the plan or payment defination. For this case, you should cancel the existing billing agreement and create new agreement with new amount to meet your business requirement. This are the idea how you can achieve this:

  1. Kindly cancel the existing billing agreement (recurring payment). (Ref: https://developer.paypal.com/docs/api/payments.billing-agreements#agreement_cancel )

  2. Use Billing Plan API to create and activate a billing plan. This is compulsory if you're going to create billing agreement. a. Create a Plan (kindly define new amount for the recurring payment). Ref: https://developer.paypal.com/docs/api/payments.billing-plans#plan_create b. Activate the plan that you've created. Ref: https://developer.paypal.com/docs/api/payments.billing-plans#plan_update

  3. Create new agreement by providing plan ID that you retrieve from steps 2. Ref: https://developer.paypal.com/docs/api/payments.billing-agreements/#agreement_create

  4. Redirect your buyer to approval_url that you receive from steps 3 to get an approval for the billing agreement and then execute the billing agreement. This is compulsory for PayPal payment.

  5. After the buyer approves a PayPal payment, execute the billing agreement. You will then receive the agreement ID that you've created during this step. (Ref: https://developer.paypal.com/docs/api/payments.billing-agreements/#agreement_execute )

I have implemented this using PHP code.

I hope this will help you.

Currently, the best way to go about it would be to create a new billing agreement, and get the user approval for the new agreement with the new bill date since the plan is already active. If the agreement was not already active, you could have changed the start date without needing reapproval from the buyer by calling update agreement with op set to replace and setting the value of start date.

Re-approval is fine if it works like that. I saw that there was a reactive link in the returned object after the update, but its method was POST. How do I actually redirect the user to reactivate the agreement?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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