Skip to content

Opencart 3.0.4 PHP 8.0 Paypal Checkout Integration Issues - no buttons #37

@Andrey5583125

Description

@Andrey5583125

@dmitriyzhuk @rsenmakh
I'm using OpenCart 3.0.4 PHP 8.0. website link
I have installed the PayPal Checkout Integration module VERSION 3.1.14. Theme custom link
The PayPal and Card buttons are not being displayed in the checkout page.
In console i got error

a3a3ad0……s?20250302153350:64 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'includes') at loadPayPalSDK (a3a3ad0……250302153350:64:375) at Object.init (a3a3ad0……50302153350:106:171)

var loadPayPalSDK = function() { var html = ''; if (paypal_data['components'].includes('buttons')) { if (!$('#paypal_button').length) { if ($(paypal_data['button_insert_tag']).length) { html = '<div id="paypal_button" class="paypal-button clearfix"><div id="paypal_button_container" class="paypal-button-container paypal-spinner"></div></div>'; eval("$('" + paypal_data['button_insert_tag'] + "')." + paypal_data['button_insert_type'] + "(html)");

}; var init = async function(callback='') { await updatePayPalData(); paypal_callback = callback; loadPayPalSDK(); }; return { init: init };

Image
Image
Image

My OpenCart and PHP error logs

2025-03-03 17:04:38 - PHP Unknown: version_compare(): Passing null to parameter #1 ($version1) of type string is deprecated in /homepages/00/999999999/htdocs/000/admin/model/extension/payment/paypal.php on line 375

public function update() { if (version_compare($this->config->get('paypal_version'), '3.1.14', '<')) { $this->db->query("DROP TABLE IF EXISTS " . DB_PREFIX . "paypal_checkout_integration_customer_token"); $this->db->query("DROP TABLE IF EXISTS " . DB_PREFIX . "paypal_checkout_integration_order"); $this->db->query("DROP TABLE IF EXISTS " . DB_PREFIX . "paypal_checkout_integration_order_recurring`");

		$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "paypal_checkout_integration_customer_token` (`customer_id` INT(11) NOT NULL, `payment_method` VARCHAR(20) NOT NULL, `vault_id` VARCHAR(50) NOT NULL, `vault_customer_id` VARCHAR(50) NOT NULL, `card_type` VARCHAR(40) NOT NULL, `card_nice_type` VARCHAR(40) NOT NULL, `card_last_digits` VARCHAR(4) NOT NULL, `card_expiry` VARCHAR(20) NOT NULL, `main_token_status` TINYINT(1) NOT NULL, PRIMARY KEY (`customer_id`, `payment_method`, `vault_id`), KEY `vault_customer_id` (`vault_customer_id`), KEY `main_token_status` (`main_token_status`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci");
		$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "paypal_checkout_integration_order` (`order_id` INT(11) NOT NULL, `paypal_order_id` VARCHAR(20) NOT NULL, `transaction_id` VARCHAR(20) NOT NULL, `transaction_status` VARCHAR(20) NOT NULL, `payment_method` VARCHAR(20) NOT NULL, `vault_id` VARCHAR(50) NOT NULL, `vault_customer_id` VARCHAR(50) NOT NULL, `card_type` VARCHAR(40) NOT NULL, `card_nice_type` VARCHAR(40) NOT NULL, `card_last_digits` VARCHAR(4) NOT NULL, `card_expiry` VARCHAR(20) NOT NULL, `total` DECIMAL(15,2) NOT NULL, `currency_code` VARCHAR(3) NOT NULL, `environment` VARCHAR(20) NOT NULL, `tracking_number` VARCHAR(64) NOT NULL, `carrier_name` VARCHAR(64) NOT NULL, PRIMARY KEY (`order_id`), KEY `paypal_order_id` (`paypal_order_id`), KEY `transaction_id` (`transaction_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci");
		$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "paypal_checkout_integration_order_recurring` (`paypal_order_recurring_id` INT(11) NOT NULL AUTO_INCREMENT, `order_id` INT(11) NOT NULL, `order_recurring_id` INT(11) NOT NULL, `date_added` DATETIME NOT NULL, `date_modified` DATETIME NOT NULL, `next_payment` DATETIME NOT NULL, `trial_end` DATETIME DEFAULT NULL, `subscription_end` DATETIME DEFAULT NULL, `currency_code` CHAR(3) NOT NULL, `total` DECIMAL(10, 2) NOT NULL, PRIMARY KEY (`paypal_order_recurring_id`), KEY (`order_id`), KEY (`order_recurring_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci");
	}
}

}
}`

2025-03-03 17:04:38 - PHP Unknown: version_compare(): Passing null to parameter #1 ($version1) of type string is deprecated in /homepages/00/999999999/htdocs/000/admin/controller/extension/payment/paypal.php on line 2087

`if (version_compare($this->config->get('paypal_version'), '3.1.14', '<')) {
$this->load->model('setting/setting');

		$setting = $this->model_setting_setting->getSetting('payment_paypal');
	
		$setting['payment_paypal_setting']['general']['order_history_token'] = sha1(uniqid(mt_rand(), 1));
					
		$this->model_setting_setting->editSetting('payment_paypal', $setting);
	}
	
	$_config = new Config();
	$_config->load('paypal');
		
	$config_setting = $_config->get('paypal_setting');
			
	$setting['paypal_version'] = $config_setting['version'];
	
	$this->load->model('setting/setting');
	
	$this->model_setting_setting->editSetting('paypal_version', $setting);
}`

You can use this product to test product After go in cart and start checkout process. In a first steps you can see error in console.
You can go through up to final step to able to see a pay button doesn’t work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions