WC_Gateway_Paypal_Request::create_paypal_orderpublicWC 1.0

Deprecated since 0.5.0. It is no longer supported and may be removed in future releases. Use Automattic\WooCommerce\Gateways\PayPal\Request::create_paypal_order(). This method will be removed in 11.0.0 instead.

Create a PayPal order using the Orders v2 API.

Method of the class: WC_Gateway_Paypal_Request{}

No Hooks.

Returns

Array|null.

Usage

$WC_Gateway_Paypal_Request = new WC_Gateway_Paypal_Request();
$WC_Gateway_Paypal_Request->create_paypal_order( $order, $payment_source, $js_sdk_params );
$order(WC_Order) (required)
Order object.
$payment_source(string)
The payment source.
Default: PayPalConstants::PAYMENT_SOURCE_PAYPAL
$js_sdk_params(array)
Extra parameters for a PayPal JS SDK (Buttons) request.
Default: array()

Changelog

Deprecated since 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Request::create_paypal_order() instead. This method will be removed in 11.0.0.

WC_Gateway_Paypal_Request::create_paypal_order() code WC 10.5.0

public function create_paypal_order(
	$order,
	$payment_source = PayPalConstants::PAYMENT_SOURCE_PAYPAL,
	$js_sdk_params = array()
) {
	wc_deprecated_function( __METHOD__, '10.5.0', 'Automattic\WooCommerce\Gateways\PayPal\Request::create_paypal_order()' );
	if ( ! $this->request ) {
		$this->request = new PayPalRequest( $this->gateway );
	}
	return $this->request->create_paypal_order( $order, $payment_source, $js_sdk_params );
}