Skip to content

Instantly share code, notes, and snippets.

@LucasBadico
Last active April 13, 2017 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucasBadico/f102d09e7406f693569d18add8be5804 to your computer and use it in GitHub Desktop.
Save LucasBadico/f102d09e7406f693569d18add8be5804 to your computer and use it in GitHub Desktop.
curl -v https://api.sandbox.paypal.com/v1/payments/payment \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer A21AAG_sHaCrvQURWObVETp38N6Hres90O6oo8lbrMQBe9YhlODYYni_gx1H8LCF_m97NcmoUmOJ2DB0c2E7HATqyDkDNMagQ' \
-d '{
"intent":"sale",
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"currency":"BRL",
"total":95,
"details":{
"shipping":11,
"subtotal":75.00,
"shipping_discount":1,
"insurance":1,
"handling_fee":1,
"tax":6
}
},
"description":"This is the payment transaction description",
"payment_options":{
"allowed_payment_method":"IMMEDIATE_PAY"
},
"item_list":{
"shipping_address": {
"recipient_name" : "PP Plus Recipient",
"line1": "Gregório Rolim de Oliveira, 42",
"line2": "JD Serrano II",
"city": "Votorantim",
"country_code": "BR",
"postal_code": "18117-134",
"state": "São Paulo",
"phone": "0800-761-0880"
},
"items":[
{
"name":"handbag",
"description":"red diamond",
"quantity":"1",
"price":"75",
"tax":"6",
"sku":"product34",
"currency":"BRL"
}
]
}
}
],
"redirect_urls":{
"return_url":"http://www.paypal.com",
"cancel_url":"http://www.paypal.com"
}
}
'
* Trying 173.0.82.78...
* TCP_NODELAY set
* Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0)
* TLS 1.2 connection using TLS_RSA_WITH_AES_256_CBC_SHA256
* Server certificate: api.sandbox.paypal.com
* Server certificate: Symantec Class 3 Secure Server CA - G4
* Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
> POST /v1/payments/payment HTTP/1.1
> Host: api.sandbox.paypal.com
> User-Agent: curl/7.51.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer A21AAG_sHaCrvQURWObVETp38N6Hres90O6oo8lbrMQBe9YhlODYYni_gx1H8LCF_m97NcmoUmOJ2DB0c2E7HATqyDkDNMagQ
> Content-Length: 1468
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 400 Bad Request
< Date: Thu, 13 Apr 2017 10:43:42 GMT
< Server: Apache
< paypal-debug-id: 8e503a12a396e
< Content-Language: *
< Connection: close
< Paypal-Debug-Id: 8e503a12a396e
< Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D1880%26app%3Dplatformapiserv%26TIME%3D1582755672%26HTTP_X_PP_AZ_LOCATOR%3D; Expires=Thu, 13 Apr 2017 11:13:42 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: 320
< Content-Type: application/json
<
* Curl_http_done: called premature == 0
* Closing connection 0
{
"name":"VALIDATION_ERROR",
"details":[
{"field":"transactions[0].amount",
"issue":"Transaction amount details (subtotal, tax, shipping) must add up to specified amount total"}],
"message":"Invalid request - see details",
"information_link":"https://developer.paypal.com/docs/api/payments/#errors",
"debug_id":"8e503a12a396e"
}%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment