Create order
POST {{base_url}}/v2/checkout/orders
Creates an order.
Note: For error handling and troubleshooting, see Orders v2 errors .
Request Body
{"intent"=>"{{order_intent}}", "purchase_units"=>[{"amount"=>{"currency_code"=>"USD", "value"=>"100.00"}}]}
HEADERS
| Key | Datatype | Required | Description |
| Content-Type
| string | | The Content-Type header field is used to specify the nature of the data in the body of an entity. PayPal REST APIs support application/json. |
| Prefer
| string | | The preferred server response upon successful completion of the request. Value is:<ul><li><code>return=minimal</code>. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the <code>id</code>, <code>status</code> and HATEOAS links.</li><li><code>return=representation</code>. The server returns a complete resource representation, including the current state of the resource.</li></ul> |
| PayPal-Request-Id
| string | | The server stores keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager. |
| PayPal-Client-Metadata-Id
| string | | Optional. Verifies that the payment originates from a valid, user-consented device and application. Reduces fraud and decreases declines. Transactions that do not include a client metadata ID are not eligible for PayPal Seller Protection. |
| PayPal-Partner-Attribution-Id
| string | | Optional. Identifies the caller as a PayPal partner. To receive revenue attribution, specify a unique build notation (BN) code. BN codes provide tracking on all transactions that originate or are associated with a particular partner. To find your BN code, see Code and Credential Reference. |
| PayPal-Auth-Assertion
| string | | An API client-provided JSON Web Token (JWT) assertion that identifies the merchant. To use this header, you must get consent to act on behalf of a merchant.
|
RESPONSES
status: Created
{"id":"0K4795520C763571A","intent":"CAPTURE","status":"COMPLETED","payment_source":{"card":{"last_digits":"4111","brand":"VISA","type":"UNKNOWN"}},"purchase_units":[{"reference_id":"PUHF","amount":{"currency_code":"USD","value":"240.00","breakdown":{"item_total":{"currency_code":"USD","value":"200.00"},"shipping":{"currency_code":"USD","value":"20.00"},"handling":{"currency_code":"USD","value":"10.00"},"tax_total":{"currency_code":"USD","value":"20.00"},"insurance":{"currency_code":"USD","value":"0.00"},"shipping_discount":{"currency_code":"USD","value":"5.00"},"discount":{"currency_code":"USD","value":"5.0"}}},"payee":{"email_address":"sb-jgbqn12111212@business.example.com","merchant_id":"65MXV4T2ZV6KY"},"description":"Sporting Goods","custom_id":"CUST-HighFashions","invoice_id":"1642724317","soft_descriptor":"PP*HIGHFASHIONS","items":[{"name":"T-Shirt","unit_amount":{"currency_code":"USD","value":"100.00"},"tax":{"currency_code":"USD","value":"10.00"},"quantity":"1","description":"Green XL","sku":"sku01"},{"name":"Shoes","unit_amount":{"currency_code":"USD","value":"50.00"},"tax":{"currency_code":"USD","value":"5.00"},"quantity":"2","description":"Running, Size 10.5","sku":"sku02"}],"shipping":{"address":{"address_line_1":"123 Townsend St","address_line_2":"Floor 6","admin_area_2":"San Francisco","admin_area_1":"CA","postal_code":"94107","country_code":"US"},"options":[{"id":"SHIP0000001","label":"1 Day Priority","type":"SHIPPING","amount":{"currency_code":"USD","value":"20.00"},"selected":true}]},"payments":{"captures":[{"id":"26W18329M9058473L","status":"COMPLETED","amount":{"currency_code":"USD","value":"240.00"},"final_capture":true,"disbursement_mode":"INSTANT","seller_protection":{"status":"NOT_ELIGIBLE"},"seller_receivable_breakdown":{"gross_amount":{"currency_code":"USD","value":"240.00"},"paypal_fee":{"currency_code":"USD","value":"8.87"},"net_amount":{"currency_code":"USD","value":"231.13"}},"invoice_id":"1642724317","custom_id":"CUST-HighFashions","links":[{"href":"https://api.sandbox.paypal.com/v2/payments/captures/26W18329M9058473L","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/payments/captures/26W18329M9058473L/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/0K4795520C763571A","rel":"up","method":"GET"}],"create_time":"2022-01-21T00:18:41Z","update_time":"2022-01-21T00:18:41Z","processor_response":{"avs_code":"A","cvv_code":"M","response_code":"0000"}}]}}],"create_time":"2022-01-21T00:18:41Z","update_time":"2022-01-21T00:18:41Z","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/0K4795520C763571A","rel":"self","method":"GET"}]}