my $results = `curl https://$config->{$config->{mode}}->{transaction_endpoint}/v1/payments/payment/$_[0] -H "Content-Type: application/json; charset=utf-8" -H "Authorization: Bearer $token"`;
#my $json_vals = decode_json($results); # also tried just this
my $json_vals = JSON->new->utf8->decode($results);
####
curl -v https://api.sandbox.paypal.com/v1/payments/payment/PAY-6KY19646FF321593HLCVRQSY -H "Content-Type: application/json; charset=utf-8" -H "Authorization: Bearer MY_AUTH_TOKEN"
* Hostname was NOT found in DNS cache
* Trying 173.0.82.78...
* Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS Unknown, Unknown (22):
* SSLv3, TLS handshake, Client hello (1):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, Server hello (2):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, CERT (11):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, Request CERT (13):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, Server finished (14):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, CERT (11):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv2, Unknown (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, Finished (20):
* SSLv2, Unknown (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv2, Unknown (22):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES256-SHA256
* Server certificate:
* subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api.sandbox.paypal.com
* start date: 2016-01-13 00:00:00 GMT
* expire date: 2018-01-13 23:59:59 GMT
* subjectAltName: api.sandbox.paypal.com matched
* issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
* SSL certificate verify ok.
* SSLv2, Unknown (23):
> GET /v1/payments/payment/PAY-6KY19646FF321593HLCVRQSY HTTP/1.1
> User-Agent: curl/7.38.0
> Host: api.sandbox.paypal.com
> Accept: */*
> Content-Type: application/json; charset=utf-8
> Authorization: Bearer MY_AUTH_TOKEN
>
* SSLv2, Unknown (23):
< HTTP/1.1 200 OK
< Date: Mon, 20 Feb 2017 17:32:59 GMT
* Server Apache is not blacklisted
< Server: Apache
< paypal-debug-id: a347a7a059ab9
< Content-Language: *
< Paypal-Debug-Id: a347a7a059ab9
< Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D1880%26app%3Dplatformapiserv%26TIME%3D1260956504%26HTTP_X_PP_AZ_LOCATOR%3D; Expires=Mon, 20 Feb 2017 18:02:59 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
< Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
< Vary: Authorization
< Content-Length: 1853
< Connection: close
< Content-Type: application/json
< óé ","line1":"19 gaskyns close","city":"Rudgwick","state":"West Sussex","postal_code":"rh123he","country_code":"GB"},"phone":"07769201576","óé ","line1":"19 gaskyns close","city":"Rudgwick","state":"West Sussex","postal_code":"rh123he","country_code":"GB"}},"related_resources":[{"sale":{"id":"5EH65998225152523","state":"pending","amount":{"total":"160.75","currency":"EUR","details":{"subtotal":"160.75"}},"payment_mode":"INSTANT_TRANSFER* Closing connection 0
* SSLv2, Unknown (21):
* SSLv3, TLS alert, Client hello (1):
","reason_code":"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION","protection_eligibility":"INELIGIBLE","parent_payment":"PAY-6KY19646FF321593HLCVRQSY","create_time":"2017-02-20T16:25:19Z","update_time":"2017-02-20T16:25:36Z","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/sale/5EH65998225152523","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/payments/sale/5EH65998225152523/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-6KY19646FF321593HLCVRQSY","rel":"parent_payment","method":"GET"}],"soft_descriptor":"PAYPAL *TESTFACILIT"}}]}],"create_time":"2017-02-20T16:25:19Z","update_time":"2017-02-20T16:25:36Z","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-6KY19646FF321593HLCVRQSY","rel":"self","method":"GET"}]
##
##
SV = PV(0x1143890) at 0x11e5758
REFCNT = 1
FLAGS = (POK,pPOK,UTF8)
PV = 0x11a47c0 "Andy\303\255\303\255\303\255\303\255\303\251\303\251\303\251 \303\215\303\263\303\251 "\0 [UTF8 "Andy\x{ed}\x{ed}\x{ed}\x{ed}\x{e9}\x{e9}\x{e9} \x{cd}\x{f3}\x{e9} "]
CUR = 26
LEN = 28