I’m using it in the WC Lovers Marketplace Frontend Manager. Being able to filter the Stripe Client Headers would be great too. I can send you the filters I’ve already added for my personal use.
/**
* Generate request headers.
*
* @param string $processed_method The uppercase HTTP method.
* @param Config $config Request configuration.
* @return array Associative array of headers.
*/
private function generate_request_headers( $processed_method, $config ) {
$headers = [];
if ( $config->api_version ) {
$headers['Stripe-Version'] = $config->api_version;
}
if ( $config->secret_key ) {
$headers['Authorization'] = "Bearer $config->secret_key";
}
if ( $processed_method === 'POST' ) {
$headers['Idempotency-Key'] = $config->idempotency_key ?: bin2hex( random_bytes( 16 ) );
}
$headers = $config->headers + $headers;
return apply_filters( 'woo_mp_stripe_request_headers', $headers ) ;
}
/**
* Output a template.
*
* @param string $name The name of the template.
* @return void
*/
private function template( $name ) {
$directories = array_merge(
$this->gateway_template_directories,
[ WOO_MP_PATH . '/templates' ],
Woo_MP::is_pro() ? [ WOO_MP_PRO_PATH . '/templates' ] : []
);
foreach ( $directories as $directory ) {
$path = apply_filters( 'woo_mp_payment_meta_box_template', "$directory/$name.php", $name ) ;
if ( is_readable( $path ) ) {
require $path;
break;
}
}
}
//main plugin file
if ( ( ! is_admin() && ( ! defined( ‘DOING_CRON’ ) || ! DOING_CRON ) ) || is_network_admin() || ! apply_filters( ‘woo_mp_force_load’, false ) ) {
return;
}