add_to_front( array( $pp_sdk_url, array("js/paypal/paypal.js", 'type'=>'module'), "html/paypal/paypal.html", ), compact ( 'paypal_redirection_success', 'paypal_redirection_failure', 'paypal_message_success', 'paypal_message_failure', ), ); return $added_to_front; } add_shortcode('fipf_paypal_shortcode', 'paypal_shortcode_content_FIPF'); /** * 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/ function add_id_to_script_FIPF( $tag, $handle, $src ) { if ( $handle === 'PLGNTLS_paypal_js' ) { $tag = ''; } return $tag; } add_filter( 'script_loader_tag', 'add_id_to_script_FIPF', 10, 3 ); */ // handling routes and endpoints // diff routes and endpoints : https://stackoverflow.com/q/56075017/9497573 function routes_endpoints_FIPF() { $base_rest_route = "fipf_plugin/api/v1"; register_rest_route($base_rest_route, '/orders', array( 'methods' => 'POST', 'callback' => 'handle_orders_request_FIPF', )); // https://local_fipfcard_plugin.com/wp-json/fipf_plugin/api/v1/orders/21T129305J264761D/capture register_rest_route($base_rest_route, '/orders/(?P[a-zA-Z0-9]+)/capture', array( 'methods' => 'POST', 'callback' => 'handle_orders_capture_request_FIPF', )); }; add_action('rest_api_init', 'routes_endpoints_FIPF'); ?>