style="display: none;">
@@ -695,11 +692,7 @@ public static function pmpro_payment_option_fields( $values, $gateway ) {
* AJAX callback to create webhooks.
*/
public static function wp_ajax_pmpro_stripe_create_webhook( $silent = false ) {
- $secretkey = sanitize_text_field( $_REQUEST['secretkey'] );
-
$stripe = new PMProGateway_stripe();
- Stripe\Stripe::setApiKey( $secretkey );
-
$update_webhook_response = $stripe->update_webhook_events();
if ( empty( $update_webhook_response ) || is_wp_error( $update_webhook_response ) ) {
@@ -731,11 +724,7 @@ public static function wp_ajax_pmpro_stripe_create_webhook( $silent = false ) {
* AJAX callback to disable webhooks.
*/
public static function wp_ajax_pmpro_stripe_delete_webhook( $silent = false ) {
- $secretkey = sanitize_text_field( $_REQUEST['secretkey'] );
-
$stripe = new PMProGateway_stripe();
- Stripe\Stripe::setApiKey( $secretkey );
-
$webhook = $stripe->does_webhook_exist();
$r = array(
@@ -1196,8 +1185,9 @@ public static function stripe_connect_save_options() {
unset( $_GET['pmpro_stripe_access_token'] );
unset( $_GET['pmpro_stripe_publishable_key'] );
- // Set a transient to show a banner to set up webhooks on the next page load.
- set_transient( 'pmpro_stripe_connect_show_webhook_set_up_banner', true, 60 );
+ // Set up a webhook if needed.
+ $stripe = new PMProGateway_stripe();
+ $stripe->update_webhook_events();
wp_redirect( admin_url( sprintf( 'admin.php?%s', http_build_query( $_GET ) ) ) );
exit;
@@ -1280,10 +1270,12 @@ public static function stripe_connect_deauthorize() {
* If the checkout flow has changed to Stripe Checkout, remember to show a banner to set up webhooks.
*
* @since 2.12
+ * @deprecated TBD
*
* @param string $old_value The old value of the option.
*/
public static function update_option_pmpro_stripe_payment_flow( $old_value ) {
+ _deprecated_function( __FUNCTION__, 'TBD' );
global $pmpro_stripe_old_payment_flow;
$pmpro_stripe_old_payment_flow = empty( $old_value ) ? 'onsite' : $old_value;
}
@@ -1292,8 +1284,11 @@ public static function update_option_pmpro_stripe_payment_flow( $old_value ) {
* Show a modal to the user after connecting to Stripe or switching to Stripe Checkout.
*
* @since 2.12
+ * @deprecated TBD
*/
public static function show_set_up_webhooks_popup() {
+ _deprecated_function( __FUNCTION__, 'TBD' );
+
global $pmpro_stripe_old_payment_flow;
// Figure out if we need to show a popup.