/** * Get the API object * * @return WCS_PayPal_Express_API API instance * @since 2.0 */ public static function get_api() { if (is_object(self::$api)) { return self::$api; } if (!class_exists('WC_Gateway_Paypal_Response')) { require_once WC()->plugin_path() . '/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php'; } $classes = array('api', 'api-request', 'api-response', 'api-response-checkout', 'api-response-billing-agreement', 'api-response-payment', 'api-response-recurring-payment'); foreach ($classes as $class) { require_once "includes/class-wcs-paypal-reference-transaction-{$class}.php"; } $environment = 'yes' === self::get_option('testmode') ? 'sandbox' : 'production'; return self::$api = new WCS_PayPal_Reference_Transaction_API('paypal', $environment, self::get_option('api_username'), self::get_option('api_password'), self::get_option('api_signature')); }