# Orders Use the `/orders` resource to create, update, retrieve, authorize, capture and track orders. ```php $ordersController = $client->getOrdersController(); ``` ## Class Name `OrdersController` ## Methods * [Orders Create](../../doc/controllers/orders.md#orders-create) * [Orders Get](../../doc/controllers/orders.md#orders-get) * [Orders Patch](../../doc/controllers/orders.md#orders-patch) * [Orders Confirm](../../doc/controllers/orders.md#orders-confirm) * [Orders Authorize](../../doc/controllers/orders.md#orders-authorize) * [Orders Capture](../../doc/controllers/orders.md#orders-capture) * [Orders Track Create](../../doc/controllers/orders.md#orders-track-create) * [Orders Trackers Patch](../../doc/controllers/orders.md#orders-trackers-patch) # Orders Create Creates an order. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and payment processing costs. For more information about processing payments, see checkout or multiparty checkout.
Note: For error handling and troubleshooting, see Orders v2 errors.```php function ordersCreate(array $options): ApiResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `body` | [`OrderRequest`](../../doc/models/order-request.md) | Body, Required | - | | `payPalRequestId` | `?string` | Header, Optional | 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. | | `payPalPartnerAttributionId` | `?string` | Header, Optional | - | | `payPalClientMetadataId` | `?string` | Header, Optional | - | | `prefer` | `?string` | Header, Optional | The preferred server response upon successful completion of the request. Value is:
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.Note: For error handling and troubleshooting, see Orders v2 errors.```php function ordersGet(array $options): ApiResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `id` | `string` | Template, Required | The ID of the order for which to show details. | | `fields` | `?string` | Query, Optional | A comma-separated list of fields that should be returned for the order. Valid filter field is `payment_source`. | ## Response Type This method returns a `PayPalRESTAPIsLib\Utils\ApiResponse` instance. The `getResult()` method on this instance returns the response data which is of type [`Order`](../../doc/models/order.md). ## Example Usage ```php $collect = [ 'id' => 'id0' ]; $apiResponse = $ordersController->ordersGet($collect); ``` ## Errors | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | | 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | [`ErrorException`](../../doc/models/error-exception.md) | | 404 | The specified resource does not exist. | [`ErrorException`](../../doc/models/error-exception.md) | | Default | The error response. | [`ErrorException`](../../doc/models/error-exception.md) | # Orders Patch Updates an order with a `CREATED` or `APPROVED` status. You cannot update an order with the `COMPLETED` status.
\"/purchase_units/@reference_id=='default'/{attribute-or-object}\". Merchants and partners can add Level 2 and 3 data to payments to reduce risk and payment processing costs. For more information about processing payments, see checkout or multiparty checkout.Note: For error handling and troubleshooting, see Orders v2 errors.Patchable attributes or objects:
| Attribute | Op | Notes |
|---|---|---|
intent | replace | |
payer | replace, add | Using replace op for payer will replace the whole payer object with the value sent in request. |
purchase_units | replace, add | |
purchase_units[].custom_id | replace, add, remove | |
purchase_units[].description | replace, add, remove | |
purchase_units[].payee.email | replace | |
purchase_units[].shipping.name | replace, add | |
purchase_units[].shipping.email_address | replace, add | |
purchase_units[].shipping.phone_number | replace, add | |
purchase_units[].shipping.options | replace, add | |
purchase_units[].shipping.address | replace, add | |
purchase_units[].shipping.type | replace, add | |
purchase_units[].soft_descriptor | replace, remove | |
purchase_units[].amount | replace | |
purchase_units[].items | replace, add, remove | |
purchase_units[].invoice_id | replace, add, remove | |
purchase_units[].payment_instruction | replace | |
purchase_units[].payment_instruction.disbursement_mode | replace | By default, disbursement_mode is INSTANT. |
purchase_units[].payment_instruction.payee_receivable_fx_rate_id | replace, add, remove | |
purchase_units[].payment_instruction.platform_fees | replace, add, remove | |
purchase_units[].supplementary_data.airline | replace, add, remove | |
purchase_units[].supplementary_data.card | replace, add, remove | |
application_context.client_configuration | replace, add |
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.Note: For error handling and troubleshooting, see Orders v2 errors.```php function ordersAuthorize(array $options): ApiResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `id` | `string` | Template, Required | The ID of the order for which to authorize. | | `payPalRequestId` | `?string` | Header, Optional | 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. | | `prefer` | `?string` | Header, Optional | The preferred server response upon successful completion of the request. Value is:
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.Note: For error handling and troubleshooting, see Orders v2 errors.```php function ordersCapture(array $options): ApiResponse ``` ## Parameters | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `id` | `string` | Template, Required | The ID of the order for which to capture a payment. | | `payPalRequestId` | `?string` | Header, Optional | 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. | | `prefer` | `?string` | Header, Optional | The preferred server response upon successful completion of the request. Value is:
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.| Attribute | Op | Notes |
|---|---|---|
items | replace | Using replace op for items will replace the entire items object with the value sent in request. |
notify_payer | replace, add | |
status | replace | Only patching status to CANCELLED is currently supported. |