PayPal Rest API - 更新账单计划返回URL

时间:2015-04-14 15:36:27

标签: c# json rest paypal paypal-rest-sdk

我一直在使用PayPal Rest API并成功创建并激活了BillingPlan,但我无法更新所述计划的return_url。我认为它与我使用的JSON路径有关,虽然我不确定为什么!?

无论如何,我正在调用更新计划方法:https://developer.paypal.com/docs/api/#update-a-plan

BillingPlan遵循以下格式:

{
  "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"
  },
  ...
}

我使用的是C#SDK,但我的请求JSON应该非常像:

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

我一直在接受以下方面的回复:

  

{"名称":" BUSINESS_VALIDATION_ERROR""细节":[{"字段":" VALIDATION_ERROR" "问题":"无效   提供路径。"}],"消息":"验证   错误"" information_link":" https://developer.paypal.com/webapps/developer/docs/api/#BUSINESS_VALIDATION_ERROR"" debug_id":" 2ae68f9f0aa72"}

总结一下 - 我想将结算方案return_urlhttp://example.com更改为http://example.com/payment/return

我已将path更改为各种内容无济于事。任何人都可以帮忙??

1 个答案:

答案 0 :(得分:10)

一旦将计划设置为活动,您就无法更新计划。这种限制的原因是因为可能存在基于该计划的协议,修改它会影响已经商定的计费协议。

但是,我同意您的问题陈述,更改返回URL不应该是一个问题,因为这不是协议的一部分,而是更多的配置更改。如果允许更新计划中的类似设置,即使在激活之后,也会很高兴。我会让API团队了解这一点。

然而,与此同时,你无法做到这一点。或者,您可以创建一个新计划,然后使用它。不是你想要的答案,而是一个可能的解决方案。