Authorize payment for order
POST {{base_url}}/v2/checkout/orders/:order_id/authorize
Authorizes payment for an order. To successfully authorize payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response.
Note: For error handling and troubleshooting, see Orders v2 errors .
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":"9P375962UG756752D","status":"COMPLETED","purchase_units":[{"reference_id":"default","shipping":{"name":{"full_name":"FooBuyer Jones"},"address":{"address_line_1":"1 Main St","admin_area_2":"San Jose","admin_area_1":"CA","postal_code":"95131","country_code":"US"}},"payments":{"authorizations":[{"status":"CREATED","id":"8VF53974JG831581P","amount":{"currency_code":"USD","value":"1000.00"},"seller_protection":{"status":"ELIGIBLE","dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"]},"expiration_time":"2022-02-18T19:00:45Z","links":[{"href":"https://api.sandbox.paypal.com/v2/payments/authorizations/8VF53974JG831581P","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/payments/authorizations/8VF53974JG831581P/capture","rel":"capture","method":"POST"},{"href":"https://api.sandbox.paypal.com/v2/payments/authorizations/8VF53974JG831581P/void","rel":"void","method":"POST"},{"href":"https://api.sandbox.paypal.com/v2/payments/authorizations/8VF53974JG831581P/reauthorize","rel":"reauthorize","method":"POST"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/9P375962UG756752D","rel":"up","method":"GET"}],"create_time":"2022-01-20T19:00:45Z","update_time":"2022-01-20T19:00:45Z"}]}}],"payer":{"name":{"given_name":"FooBuyer","surname":"Jones"},"email_address":"foobuyer@gmail.com","payer_id":"QYR5Z8XDVJNXQ","address":{"country_code":"US"}},"links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/9P375962UG756752D","rel":"self","method":"GET"}]}