PAYPAL WORKING

This commit is contained in:
asus
2024-02-24 16:57:31 +01:00
parent 745f5ebf91
commit 61b3f9f2f5
10 changed files with 300 additions and 236 deletions

View File

@@ -42,9 +42,6 @@ add_action('template_redirect', 'check_paypal_request');
function paypal_shortcode_content()
{
$fipfcard_paypal = new PLGNTLS_class();
/*
<input type="hidden" name="custom" value="5678" />
*/
$pp_sdk_currency = "EUR";
$pp_sdk_debug = "true";
@@ -57,13 +54,28 @@ function paypal_shortcode_content()
// $pp_sdk_attributes="src='$pp_sdk_src'";
// $pp_sdk_html_script="<script $pp_sdk_attributes></script>";
return $fipfcard_paypal->add_to_front(
$added_to_front = $fipfcard_paypal->add_to_front(
array(
$pp_sdk_src,
"js/paypal/paypal.js",
"html/paypal/paypal.html",
),
);
return $added_to_front;
}
/**
* the js file paypal.js needs to be imported as a module to use import
* @see https://developer.wordpress.org/reference/hooks/script_loader_tag/
*/
add_filter( 'script_loader_tag', 'add_id_to_script', 10, 3 );
function add_id_to_script( $tag, $handle, $src ) {
if ( $handle === 'PLGNTLS_paypal_js' ) {
$tag = '<script type="module" src="' . esc_url( $src ) . '" ></script>';
}
return $tag;
}