"; $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 = ''; } return $tag; } // handling routes and endpoints // diff routes and endpoints : https://stackoverflow.com/q/56075017/9497573 function fipf_routes_endpoints() { $base_rest_route = "fipf_plugin/api/v1"; register_rest_route($base_rest_route, '/orders', array( 'methods' => 'POST', 'callback' => 'handle_orders_request', )); // 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', )); }; add_action('rest_api_init', 'fipf_routes_endpoints'); ?>