Create order

POST {{base_url}}/v2/checkout/orders

Creates an order.

Note: For error handling and troubleshooting, see Orders v2 errors.

Request Body

{"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"}}

HEADERS

KeyDatatypeRequiredDescription
Content-TypestringThe 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.
PreferstringThe 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-IdstringThe 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-IdstringOptional. 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-IdstringOptional. 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-AssertionstringAn 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

{&quot;id&quot;:&quot;0K4795520C763571A&quot;,&quot;intent&quot;:&quot;CAPTURE&quot;,&quot;status&quot;:&quot;COMPLETED&quot;,&quot;payment_source&quot;:{&quot;card&quot;:{&quot;last_digits&quot;:&quot;4242&quot;,&quot;brand&quot;:&quot;VISA&quot;,&quot;type&quot;:&quot;UNKNOWN&quot;}},&quot;purchase_units&quot;:[{&quot;reference_id&quot;:&quot;PUHF&quot;,&quot;amount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;240.00&quot;,&quot;breakdown&quot;:{&quot;item_total&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;200.00&quot;},&quot;shipping&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;20.00&quot;},&quot;handling&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;10.00&quot;},&quot;tax_total&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;20.00&quot;},&quot;insurance&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;0.00&quot;},&quot;shipping_discount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;5.00&quot;},&quot;discount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;5.0&quot;}}},&quot;payee&quot;:{&quot;email_address&quot;:&quot;sb-jgbqn12111212@business.example.com&quot;,&quot;merchant_id&quot;:&quot;65MXV4T2ZV6KY&quot;},&quot;description&quot;:&quot;Sporting Goods&quot;,&quot;custom_id&quot;:&quot;CUST-HighFashions&quot;,&quot;invoice_id&quot;:&quot;1642724317&quot;,&quot;soft_descriptor&quot;:&quot;PP*HIGHFASHIONS&quot;,&quot;items&quot;:[{&quot;name&quot;:&quot;T-Shirt&quot;,&quot;unit_amount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;100.00&quot;},&quot;tax&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;10.00&quot;},&quot;quantity&quot;:&quot;1&quot;,&quot;description&quot;:&quot;Green XL&quot;,&quot;sku&quot;:&quot;sku01&quot;},{&quot;name&quot;:&quot;Shoes&quot;,&quot;unit_amount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;50.00&quot;},&quot;tax&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;5.00&quot;},&quot;quantity&quot;:&quot;2&quot;,&quot;description&quot;:&quot;Running, Size 10.5&quot;,&quot;sku&quot;:&quot;sku02&quot;}],&quot;shipping&quot;:{&quot;address&quot;:{&quot;address_line_1&quot;:&quot;123 Townsend St&quot;,&quot;address_line_2&quot;:&quot;Floor 6&quot;,&quot;admin_area_2&quot;:&quot;San Francisco&quot;,&quot;admin_area_1&quot;:&quot;CA&quot;,&quot;postal_code&quot;:&quot;94107&quot;,&quot;country_code&quot;:&quot;US&quot;}},&quot;supplementary_data&quot;:{&quot;airline&quot;:[{&quot;ticket&quot;:{&quot;number&quot;:&quot;045-2135145561&quot;,&quot;issue_date&quot;:&quot;2018-01-19&quot;,&quot;issuing_carrier_code&quot;:&quot;AI&quot;,&quot;travel_agency_name&quot;:&quot;World Tours&quot;,&quot;travel_agency_code&quot;:&quot;01&quot;},&quot;passenger&quot;:{&quot;name&quot;:{&quot;full_name&quot;:&quot;Trini George&quot;},&quot;date_of_birth&quot;:&quot;1981-05-31&quot;,&quot;country_code&quot;:&quot;US&quot;},&quot;flight_leg_details&quot;:[{&quot;flight_number&quot;:101,&quot;carrier_code&quot;:&quot;AI&quot;,&quot;service_class&quot;:&quot;J&quot;,&quot;departure_date&quot;:&quot;2018-02-15&quot;,&quot;departure_time&quot;:&quot;15:30&quot;,&quot;departure_airport&quot;:&quot;SFO&quot;,&quot;arrival_airport&quot;:&quot;DBX&quot;,&quot;stopover_code&quot;:&quot;X&quot;,&quot;fare_basis_code&quot;:&quot;SPRSVR&quot;},{&quot;flight_number&quot;:102,&quot;carrier_code&quot;:&quot;AI&quot;,&quot;service_class&quot;:&quot;J&quot;,&quot;departure_date&quot;:&quot;2018-02-15&quot;,&quot;departure_time&quot;:&quot;19:05&quot;,&quot;departure_airport&quot;:&quot;DBX&quot;,&quot;arrival_airport&quot;:&quot;MAA&quot;,&quot;stopover_code&quot;:&quot;O&quot;,&quot;fare_basis_code&quot;:&quot;SPRSVR&quot;}]}]},&quot;payments&quot;:{&quot;captures&quot;:[{&quot;id&quot;:&quot;26W18329M9058473L&quot;,&quot;status&quot;:&quot;COMPLETED&quot;,&quot;amount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;240.00&quot;},&quot;final_capture&quot;:true,&quot;disbursement_mode&quot;:&quot;INSTANT&quot;,&quot;seller_protection&quot;:{&quot;status&quot;:&quot;NOT_ELIGIBLE&quot;},&quot;seller_receivable_breakdown&quot;:{&quot;gross_amount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;240.00&quot;},&quot;paypal_fee&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;8.87&quot;},&quot;net_amount&quot;:{&quot;currency_code&quot;:&quot;USD&quot;,&quot;value&quot;:&quot;231.13&quot;}},&quot;invoice_id&quot;:&quot;1642724317&quot;,&quot;custom_id&quot;:&quot;CUST-HighFashions&quot;,&quot;links&quot;:[{&quot;href&quot;:&quot;https://api.sandbox.paypal.com/v2/payments/captures/26W18329M9058473L&quot;,&quot;rel&quot;:&quot;self&quot;,&quot;method&quot;:&quot;GET&quot;},{&quot;href&quot;:&quot;https://api.sandbox.paypal.com/v2/payments/captures/26W18329M9058473L/refund&quot;,&quot;rel&quot;:&quot;refund&quot;,&quot;method&quot;:&quot;POST&quot;},{&quot;href&quot;:&quot;https://api.sandbox.paypal.com/v2/checkout/orders/0K4795520C763571A&quot;,&quot;rel&quot;:&quot;up&quot;,&quot;method&quot;:&quot;GET&quot;}],&quot;create_time&quot;:&quot;2022-01-21T00:18:41Z&quot;,&quot;update_time&quot;:&quot;2022-01-21T00:18:41Z&quot;,&quot;processor_response&quot;:{&quot;avs_code&quot;:&quot;A&quot;,&quot;cvv_code&quot;:&quot;M&quot;,&quot;response_code&quot;:&quot;0000&quot;},&quot;supplementary_data&quot;:{&quot;airline&quot;:[{&quot;ticket&quot;:{&quot;number&quot;:&quot;045-2135145561&quot;,&quot;issue_date&quot;:&quot;2018-01-19&quot;,&quot;issuing_carrier_code&quot;:&quot;AI&quot;,&quot;travel_agency_name&quot;:&quot;World Tours&quot;,&quot;travel_agency_code&quot;:&quot;01&quot;},&quot;passenger&quot;:{&quot;name&quot;:{&quot;full_name&quot;:&quot;Trini George&quot;},&quot;date_of_birth&quot;:&quot;1981-05-31&quot;,&quot;country_code&quot;:&quot;US&quot;},&quot;flight_leg_details&quot;:[{&quot;flight_number&quot;:101,&quot;carrier_code&quot;:&quot;AI&quot;,&quot;service_class&quot;:&quot;J&quot;,&quot;departure_date&quot;:&quot;2018-02-15&quot;,&quot;departure_time&quot;:&quot;15:30&quot;,&quot;departure_airport&quot;:&quot;SFO&quot;,&quot;arrival_airport&quot;:&quot;DBX&quot;,&quot;stopover_code&quot;:&quot;X&quot;,&quot;fare_basis_code&quot;:&quot;SPRSVR&quot;},{&quot;flight_number&quot;:102,&quot;carrier_code&quot;:&quot;AI&quot;,&quot;service_class&quot;:&quot;J&quot;,&quot;departure_date&quot;:&quot;2018-02-15&quot;,&quot;departure_time&quot;:&quot;19:05&quot;,&quot;departure_airport&quot;:&quot;DBX&quot;,&quot;arrival_airport&quot;:&quot;MAA&quot;,&quot;stopover_code&quot;:&quot;O&quot;,&quot;fare_basis_code&quot;:&quot;SPRSVR&quot;}]}]}}]}}],&quot;create_time&quot;:&quot;2022-01-21T00:18:41Z&quot;,&quot;update_time&quot;:&quot;2022-01-21T00:18:41Z&quot;,&quot;links&quot;:[{&quot;href&quot;:&quot;https://api.sandbox.paypal.com/v2/checkout/orders/0K4795520C763571A&quot;,&quot;rel&quot;:&quot;self&quot;,&quot;method&quot;:&quot;GET&quot;}]}