24

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??

scgough
  • 5,099
  • 3
  • 30
  • 48
  • I'm not entirely sure what your question is, can you be more specific? – Pseudonym Apr 14 '15 at 15:40
  • Try prefixing the `"path"` with a `"/"`, i.e. `"path": "/merchant_preferences"`. – dbc Apr 17 '15 at 15:07
  • 1
    Also, apparently you can't update this once the plan is active, see https://github.com/paypal/PayPal-Python-SDK/issues/73 – dbc Apr 17 '15 at 15:15
  • 4
    @dbc tried `"/"` prefix to no avail but you're point about the plan being active could be a very good point. I will investigate over the next few days. Maybe I can deactivate, update and re-activate. – scgough Apr 17 '15 at 15:17

1 Answers1

12

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.

Jay Patel - PayPal
  • 1,489
  • 1
  • 11
  • 20
  • Thanks Jay. Understood and thanks for passing this onto the API team. It'd be great to get some more flexibility where possible. Cheers. – scgough Apr 23 '15 at 20:31
  • I agree. API Team has to balance between the delivery time / features set, and have to make some technical decisions that are not perfect/ideal. Great feedback like this helps them evaluate what should be prioritized accordingly. Thanks. – Jay Patel - PayPal Apr 23 '15 at 20:34
  • What would be good (and hopefully easier to implement in the short term) would be some more descriptive error messages in circumstances like this. E.g. "validation error - an active billing plan cannot be altered" ;-) really appreciate you taking the time to confirm our suspicions on this though Jay. Thanks again. – scgough Apr 23 '15 at 20:37
  • I completely agree. We are adding more meaning to error message, either by directly passing it, or providing a link back in exception message, that points to a page providing specific information. – Jay Patel - PayPal Apr 24 '15 at 03:58
  • @JayPatel-PayPal Please kindly have a look, I need you help brother https://stackoverflow.com/questions/34262762/using-api-calling-account-as-receiver-account – Bibek Sharma Dec 15 '15 at 03:55
  • It looks like this is still not possible to update :( – Dallas Clark Apr 18 '18 at 19:38