【发布时间】:2014-10-07 05:25:49
【问题描述】:
我在 PayPal 的指导下关注文档 https://developer.paypal.com/webapps/developer/docs/integration/direct/make-your-first-call/
Step2>获取访问令牌
我可以得到如下结果;
"scope":"https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks openid https://uri.paypal.com/services/invoicing https://api.paypal.com/v1/vault/credit-card/.*","access_token":"A015ztUtcRfI8HOkkpwAFdAnhpZcbC7YSothwMzgiavKeZ0","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}
Step3>当我尝试发送如下交易时没有确认交易
-H 'Content-Type: application/json'
-H 'Authorization: Bearer A015ztUtcRfI8HOkkpwAFdAnhpZcbC7YSothwMzgiavKeZ0'
-d '{
"intent":"sale",
"redirect_urls":{
"return_url":"http://example.com/your_redirect_url.html",
"cancel_url":"http://example.com/your_cancel_url.html"
},
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"total":"7.47",
"currency":"USD"
}
}
]
}'
我保存为错误输出的是
Warning: data2.txt:1: warning: '-H' uses unquoted white space in the line that
Warning: may cause side-effects!
Warning: data2.txt:2: warning: '-H' uses unquoted white space in the line that
Warning: may cause side-effects!
Warning: data2.txt:4: warning: '"intent"' is unknown
Warning: data2.txt:5: warning: '"redirect_urls"' is unknown
Warning: data2.txt:6: warning: '"return_url"' is unknown
Warning: data2.txt:7: warning: '"cancel_url"' is unknown
Warning: data2.txt:8: warning: '},' is unknown
Warning: data2.txt:9: warning: '"payer"' is unknown
Warning: data2.txt:10: warning: '"payment_method"' is unknown
Warning: data2.txt:11: warning: '},' is unknown
Warning: data2.txt:12: warning: '"transactions"' is unknown
Warning: data2.txt:13: warning: '{' is unknown
Warning: data2.txt:14: warning: '"amount"' is unknown
Warning: data2.txt:15: warning: '"total"' is unknown
Warning: data2.txt:16: warning: '"currency"' is unknown
Warning: data2.txt:17: warning: '}' is unknown
Warning: data2.txt:18: warning: '}' is unknown
Warning: data2.txt:19: warning: ']' is unknown
Warning: data2.txt:20: warning: '}'' is unknown
* Hostname was NOT found in DNS cache
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 173.0.82.78...
* Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: C:\Jnj\Web\PayPal\curl_X64_ssl\curl-ca-bundle.crt
CApath: none
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Request CERT (13):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
} [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using TLSv1.0 / DES-CBC3-SHA
* Server certificate:
* subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api.sandbox.paypal.com
* start date: 2012-12-06 00:00:00 GMT
* expire date: 2016-12-06 23:59:59 GMT
* subjectAltName: api.sandbox.paypal.com matched
* issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA - G3
* SSL certificate verify ok.
> POST /v1/payments/payment HTTP/1.1
> User-Agent: curl/7.38.0
> Host: api.sandbox.paypal.com
> Accept: */*
> Content-Length: 2
> Content-Type: application/x-www-form-urlencoded
>
} [data not shown]
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 401 Unauthorized
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=174
< Paypal-Debug-Id: fe365dce81d22
< Content-Type: application/json
< Content-Length: 0
< Date: Tue, 07 Oct 2014 04:59:33 GMT
<
100 2 0 0 100 2 0 1 0:00:02 0:00:01 0:00:01 1
* Connection #0 to host api.sandbox.paypal.com left intact
我的问题是
这正常吗?
为什么警告信息在顶部?
我正在测试 Windows 64 版本 7.38 的 cURL。 (在http://curl.haxx.se/download.html下载)
【问题讨论】: