Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PayPal Rest API - Update Billing Plan Return URL

Tags:

I have been using the PayPal Rest API and have successfully created and activated a BillingPlan but I'm having trouble updating said plan's return_url. I think it's something to do with the JSON path I'm using although I'm not sure why!?

Anyway, I am calling the update plan method: https://developer.paypal.com/docs/api/#update-a-plan

A BillingPlan follows the format:

{   "id": "P-94458432VR012762KRWBZEUA",   "state": "ACTIVE",   "name": "T-Shirt of the Month Club Plan",   "description": "Template creation.",   "type": "FIXED",   ...   "merchant_preferences": {     "setup_fee": {       "currency": "USD",       "value": "1"     },     "max_fail_attempts": "0",     "return_url": "http://example.com",     "cancel_url": "http://example.com",     "auto_bill_amount": "YES",     "initial_fail_amount_action": "CONTINUE"   },   ... } 

I'm using the C# SDK but my request JSON should look very much like:

{     "path": "merchant_preferences",     "value": {         "return_url": "http://example.com/payment/return"     },     "op": "replace" } 

I keep getting responses along the line's of:

{"name":"BUSINESS_VALIDATION_ERROR","details":[{"field":"validation_error","issue":"Invalid Path provided."}],"message":"Validation Error.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#BUSINESS_VALIDATION_ERROR","debug_id":"2ae68f9f0aa72"}

To sum up - I want to change the billing plan return_url from http://example.com to http://example.com/payment/return.

I've changed the path to various things to no avail. Can anyone help??

like image 991
scgough Avatar asked Apr 14 '15 15:04

scgough


People also ask

Where is the billing agreement link in PayPal?

Click Profile. Click My Money. Under "My Pre-Approved Payments," click Update. Select a merchant's name to see the associated PayPal Billing Agreement Number.

Does PayPal use restful API?

The PayPal REST API is organized around transaction workflows, including: orders, payments, subscriptions, invoicing, and disputes. The API uses standard verbs and returns HTTP response codes and JSON-encoded responses.

What is PayPal sandbox API?

The PayPal sandbox is a self-contained, virtual testing environment that simulates the live PayPal production environment. The sandbox provides a shielded space where you can initiate and watch while your apps process PayPal API requests without touching any live PayPal accounts.


1 Answers

You cannot update the plan, once it is set to active. The reason for that restriction is that because there could be possible agreements based on that plan, modifying it would affect the already agreed billing agreements.

However, I agree with your problem statement, that changing the Return URL should not be an issue as this is not a part of agreement, but more of a configuration change. It would be nice to somehow allow updating similar settings in Plan, even after active. I will let the API team know about that.

however, in the mean time, there is no way you would be able to do that. Alternatively, you could possibly create a new plan, and use that instead. Not the answer you are looking for, but a probable solution.

like image 94
Jay Patel - PayPal Avatar answered Oct 19 '22 12:10

Jay Patel - PayPal