Note: For error handling and troubleshooting, see Orders v2 errors.
username:password
Authorization: Basic *****************
return=minimal
. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id
, status
and HATEOAS links.return=representation
. The server returns a complete resource representation, including the current state of the resource.{
"intent": "CAPTURE",
"purchase_units": [
{
"items": [
{
"name": "T-Shirt",
"description": "Green XL",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "100.00"
}
}
],
"amount": {
"currency_code": "USD",
"value": "100.00",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "100.00"
}
}
}
}
],
"application_context": {
"return_url": "https://example.com/return",
"cancel_url": "https://example.com/cancel"
}
}
curl --location --request POST 'https://api-m.sandbox.paypal.com/v2/checkout/orders' \
--header 'Prefer: ' \
--header 'PayPal-Request-Id: ' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Og==' \
--data-raw '{
"intent": "CAPTURE",
"purchase_units": [
{
"items": [
{
"name": "T-Shirt",
"description": "Green XL",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "100.00"
}
}
],
"amount": {
"currency_code": "USD",
"value": "100.00",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "100.00"
}
}
}
}
],
"application_context": {
"return_url": "https://example.com/return",
"cancel_url": "https://example.com/cancel"
}
}'
{
"id": "09H88704RC448263N",
"intent": "CAPTURE",
"status": "CREATED",
"purchase_units": [
{
"reference_id": "default",
"amount": {
"currency_code": "USD",
"value": "100.00"
},
"payee": {
"email_address": "etondoze-facilitator@gmail.com",
"merchant_id": "ER87FV8ER63HJ"
}
}
],
"create_time": "2022-02-04T02:22:17Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/09H88704RC448263N",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/checkoutnow?token=09H88704RC448263N",
"rel": "approve",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/09H88704RC448263N",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/09H88704RC448263N/capture",
"rel": "capture",
"method": "POST"
}
]
}