Paypal Preapproval无效请求

时间:2014-08-05 08:55:45

标签: paypal paypal-sandbox paypal-adaptive-payments

我正在尝试使用自适应付款的PreApproval。具体来说,要完成the documentation on Preapproval的四个步骤。

我用curl命令卡住了Step 1: Set Up the Preapproval

$ curl -s --insecure \
  -H "X-PAYPAL-SECURITY-USERID: myuserid.gmail.com" \
  -H "X-PAYPAL-SECURITY-PASSWORD: mypass" \
  -H "X-PAYPAL-SECURITY-SIGNATURE: mysignaturestring" \
  -H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
  -H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
  -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" \
https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval  -d \
  "cancelUrl=http://www.yourdomain.com/cancel.html
  &currencyCode=USD
  &endingDate=2014-09-10T22:00:00Z
  &maxAmountPerPayment=200.00
  &maxNumberOfPayments=30
  &maxTotalAmountOfAllPayments=1500.00
  &pinType=NOT_REQUIRED
  &requestEnvelope.errorLanguage=en_US
  &returnUrl=http://www.yourdomain.com/success.html
  &startingDate=2014-08-10T22:00:00Z"

我收到错误,而不是preapprovalKey。我知道我发送的数据有问题,但我无法弄清楚:

esponseEnvelope.timestamp=2014-08-05T01:24:55.289-07:00
&responseEnvelope.ack=Failure
&responseEnvelope.correlationId=7c6db7beda57a
&responseEnvelope.build=11853342
&error(0).errorId=580001
&error(0).domain=PLATFORM
&error(0).subdomain=Application
&error(0).severity=Error
&error(0).category=Application
&error(0).message=Invalid request: Data validation warning(line -1, col 0): 2014-09-10T22:00:00Z
&error(0).parameter(0)=Data validation warning(line -1, col 0): 2014-09-10T22:00:00Z

请注意:

  • 我的API凭据没问题,我已在Express CheckoutstartingDate成功测试了它们
  • 某些字段符合the documentation,而其他字段与文档复制粘贴完全相同:
    • endingDate - startingDate将来,文档说不是今天的日期(帖子的日期)或结束日期之后。
    • {{1}}是一个月,不到一年,正如他们在文档中所说的那样。
    • 我也尝试使用documentation以防我使用curl
    • 做错了

1 个答案:

答案 0 :(得分:1)

该死的,我认为这是因为我在SO上的缩进让你看起来很漂亮。这是因为空格在\n中输入了{-d \ "cancelUrl=... &currencyCode=USD & ..."' s。

谢谢,所以正确的参考资料是:

$ curl -s --insecure \
  -H "X-PAYPAL-SECURITY-USERID: myuserid.gmail.com" \
  -H "X-PAYPAL-SECURITY-PASSWORD: mypass" \
  -H "X-PAYPAL-SECURITY-SIGNATURE: mysignaturestring" \
  -H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
  -H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
  -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" \
https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval  -d \
  "cancelUrl=http://www.yourdomain.com/cancel.html&currencyCode=USD&endingDate=2014-09-10T22:00:00Z&maxAmountPerPayment=200.00&maxNumberOfPayments=30&maxTotalAmountOfAllPayments=1500.00&pinType=NOT_REQUIRED&requestEnvelope.errorLanguage=en_US&returnUrl=http://www.yourdomain.com/success.html&startingDate=2014-08-10T22:00:00Z"
相关问题