2013-06-30 2 views
0

클라이언트 결제 시스템을 구현하려고하는데로드 블록을 치고 있습니다. PayPal API를 사용하여 'MALFORMED_REQUEST'오류가 발생했습니다.

나는 페이팔 샌드 박스 컬을 시도

, 나는 여기에 문서를 다음 해요 : 여기

https://developer.paypal.com/webapps/developer/docs/integration/direct/accept-credit-cards/ 내가 사용하고 정확한 명령입니다 : 분명히

curl -v -k https://api.sandbox.paypal.com/v1/payments/payment -H "Content-Type:application/json" -H "Authorization:Bearer DdtHNNeMmv9Jb5K9fXLC50vxUkIrF6MihT.IJUefGlo" --connect-timeout 30 -d {"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"number":"4417119669820331","type":"visa","expire_month":11,"expire_year":2018,"cvv2":"874","first_name":"Joe","last_name":"Shopper","billing_address":{"line1":"52 N Main ST","city":"Johnstown","country_code":"US","postal_code":"","state":"OH"}}}]},"transactions":[{"amount":{"total":"7.47","currency":"USD","details":{"subtotal":"7.41","tax":"0.03","shipping":"0.03"}},"description":"This is the payment transaction description."}]} 

(내가 변화하고있어 내가 이전에 얻었던 것을 토대로 한 액세스 토큰, 페이팔을 컬 할 수 있음을 나에게 입증)

이렇게하면 MALFORMED_REQUEST 오류가 발생합니다. "요청 JSON이 좋지 않습니다. 형성했다. "

c:\>curl -v -k https://api.sandbox.paypal.com/v1/payments/payment -H "Content-Type:application/json" -H "Authorization:Bearer DdtHNNeMmv9Jb5K9fXLC50vxUkIrF6MihT.IJUefGlo" --connect-timeout 30 -d {"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"number":"4417119669820331","type":"visa","expire_month":11,"expire_year":2018,"cvv2":"874","first_name":"Joe","last_name":"Shopper","billing_address":{"line1":"52 N Main ST","city":"Johnstown","country_code":"US","postal_code":"","state":"OH"}}}]},"transactions":[{"amount":{"total":"7.47","currency":"USD","details":{"subtotal":"7.41","tax":"0.03","shipping":"0.03"}},"description":"This is the payment transaction description."}]} 
    * Adding handle: send: 0 
    * Adding handle: recv: 0 
    * Curl_addHandleToPipeline: length: 1 
    * - Conn 0 (0x1d6d2f0) send_pipe: 1, recv_pipe: 0 
    * About to connect() to api.sandbox.paypal.com port 443 (#0) 
    * Trying 173.0.82.78... 
    * Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0) 
    * SSLv3, TLS handshake, Client hello (1): 
    * SSLv3, TLS handshake, Server hello (2): 
    * SSLv3, TLS handshake, CERT (11): 
    * SSLv3, TLS handshake, Request CERT (13): 
    * SSLv3, TLS handshake, Server finished (14): 
    * SSLv3, TLS handshake, CERT (11): 
    * SSLv3, TLS handshake, Client key exchange (16): 
    * SSLv3, TLS change cipher, Client hello (1): 
    * SSLv3, TLS handshake, Finished (20): 
    * SSLv3, TLS change cipher, Client hello (1): 
    * SSLv3, TLS handshake, Finished (20): 
    * SSL connection using 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 
    * 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 result: self signed certificate in certificate chain (19), continuing anyway. 
> POST /v1/payments/payment HTTP/1.1 
> User-Agent: curl/7.31.0 
> Host: api.sandbox.paypal.com 
> Accept: */* 
> Content-Type:application/json 
> Authorization:Bearer DdtHNNeMmv9Jb5K9fXLC50vxUkIrF6MihT.IJUefGlo 
> Content-Length: 444 
> 
* upload completely sent off: 444 out of 444 bytes 
< HTTP/1.1 400 Bad Request 
* Server Apache-Coyote/1.1 is not blacklisted 
< Server: Apache-Coyote/1.1 
< Date: Sun, 23 Jun 2013 18:07:54 GMT 
< Connection: close 
< PayPal-Debug-Id: 2f3f584e8050e 
< Content-Type: application/json 
< Content-Length: 200 
< Connection: close 
< 
{"name":"MALFORMED_REQUEST","message":"The request JSON is not well formed.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST","debug_id":"2f3f584e8050e"}* Closing connection 0* SSLv3, TLS alert, Client hello (1): 

나는 심지어 JSON 린트 (http://jsonlint.com/)를 통해 실행되는 JSON이 올바르게 형성되는 것이 반복적으로 확인했습니다 여기 내 자세한 디버그 정보입니다. 그리고 물론 Paypal의 JSON 응답에 제공된 링크는 어디에도 없습니다. 나는 지난 주 Paypal을 통해 누군가에게이 사실을 설명하려고했습니다.

모든 입력 사항을 가장 높이 평가합니다.

답변

0

당신이에 전달하는 JSON 개체 주위에 따옴표가없는 것 같은데 대체 자신의 액세스 토큰이을 시도해보십시오.

curl -v -k https://api.sandbox.paypal.com/v1/payments/payment -H "Content-Type:application/json" -H "Authorization:Bearer 5osWcO-OBwV2Vbdvdu2H8P50EHwx8pNqTQxpVnJlc38" --connect-timeout 30 -d '{"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"number":"4417119669820331","type":"visa","expire_month":11,"expire_year":2018,"cvv2":"874","first_name":"Joe","last_name":"Shopper","billing_address":{"line1":"52 N Main ST","city":"Johnstown","country_code":"US","postal_code":"","state":"OH"}}}]},"transactions":[{"amount":{"total":"7.47","currency":"USD","details":{"subtotal":"7.41","tax":"0.03","shipping":"0.03"}},"description":"This is the payment transaction description."}]}'

관련 문제