Note: For error handling and troubleshooting, see Orders v2 errors. ** * @param array $options Array with all options for search * * @return ApiResponse Response from the API call */ public function ordersCreate(array $options): ApiResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/checkout/orders') ->auth('Oauth2') ->parameters( HeaderParam::init('Content-Type', 'application/json'), BodyParam::init($options)->extract('body'), HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'), HeaderParam::init('PayPal-Partner-Attribution-Id', $options)->extract('paypalPartnerAttributionId'), HeaderParam::init('PayPal-Client-Metadata-Id', $options)->extract('paypalClientMetadataId'), HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal') ); $_resHandler = $this->responseHandler() ->throwErrorOn( '400', ErrorType::init( 'Request is not well-formed, syntactically incorrect, or violates schema.', ErrorException::class ) ) ->throwErrorOn( '401', ErrorType::init( 'Authentication failed due to missing authorization header, or invalid auth' . 'entication credentials.', ErrorException::class ) ) ->throwErrorOn( '422', ErrorType::init( 'The requested action could not be performed, semantically incorrect, or fa' . 'iled business validation.', ErrorException::class ) ) ->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class)) ->type(Order::class) ->returnApiResponse(); return $this->execute($_reqBuilder, $_resHandler); } /** * 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 |
|---|---|---|
inte
* nt | 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 |
Note: For error handling and troubleshooting, see * Orders v2 * errors.* * @param array $options Array with all options for search * * @return ApiResponse Response from the API call */ public function ordersCapture(array $options): ApiResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/checkout/orders/{id}/capture') ->auth('Oauth2') ->parameters( TemplateParam::init('id', $options)->extract('id'), HeaderParam::init('Content-Type', 'application/json'), HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'), HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'), HeaderParam::init('PayPal-Client-Metadata-Id', $options)->extract('paypalClientMetadataId'), HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'), BodyParam::init($options)->extract('body') ); $_resHandler = $this->responseHandler() ->throwErrorOn( '400', ErrorType::init( 'Request is not well-formed, syntactically incorrect, or violates schema.', ErrorException::class ) ) ->throwErrorOn( '401', ErrorType::init( 'Authentication failed due to missing authorization header, or invalid auth' . 'entication credentials.', ErrorException::class ) ) ->throwErrorOn( '403', ErrorType::init( 'The authorized payment failed due to insufficient permissions.', ErrorException::class ) ) ->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class)) ->throwErrorOn( '422', ErrorType::init( 'The requested action could not be performed, semantically incorrect, or fa' . 'iled business validation.', ErrorException::class ) ) ->throwErrorOn('500', ErrorType::init('An internal server error has occurred.', ErrorException::class)) ->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class)) ->type(Order::class) ->returnApiResponse(); return $this->execute($_reqBuilder, $_resHandler); } /** * Shows details for an order, by ID.
Note: For error handling and * troubleshooting, see Orders v2 errors.* * @param array $options Array with all options for search * * @return ApiResponse Response from the API call */ public function ordersGet(array $options): ApiResponse { $_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v2/checkout/orders/{id}') ->auth('Oauth2') ->parameters( TemplateParam::init('id', $options)->extract('id'), QueryParam::init('fields', $options)->extract('fields') ); $_resHandler = $this->responseHandler() ->throwErrorOn( '401', ErrorType::init( 'Authentication failed due to missing authorization header, or invalid auth' . 'entication credentials.', ErrorException::class ) ) ->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class)) ->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class)) ->type(Order::class) ->returnApiResponse(); return $this->execute($_reqBuilder, $_resHandler); } /** * Payer confirms their intent to pay for the the Order with the given payment source. * * @param array $options Array with all options for search * * @return ApiResponse Response from the API call */ public function ordersConfirm(array $options): ApiResponse { $_reqBuilder = $this->requestBuilder( RequestMethod::POST, '/v2/checkout/orders/{id}/confirm-payment-source' ) ->auth('Oauth2') ->parameters( TemplateParam::init('id', $options)->extract('id'), HeaderParam::init('Content-Type', 'application/json'), HeaderParam::init('PayPal-Client-Metadata-Id', $options)->extract('paypalClientMetadataId'), HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'), BodyParam::init($options)->extract('body') ); $_resHandler = $this->responseHandler() ->throwErrorOn( '400', ErrorType::init( 'Request is not well-formed, syntactically incorrect, or violates schema.', ErrorException::class ) ) ->throwErrorOn( '403', ErrorType::init('Authorization failed due to insufficient permissions.', ErrorException::class) ) ->throwErrorOn( '422', ErrorType::init( 'The requested action could not be performed, semantically incorrect, or fa' . 'iled business validation.', ErrorException::class ) ) ->throwErrorOn('500', ErrorType::init('An internal server error has occurred.', ErrorException::class)) ->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class)) ->type(Order::class) ->returnApiResponse(); return $this->execute($_reqBuilder, $_resHandler); } /** * Updates or cancels the tracking information for a PayPal order, by ID. Updatable attributes or * objects: *
| 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. |