1. Home
  2. Docs
  3. Payment Withdrawal API
  4. Save Withdraw Settings in Admin Payment Gateways

Save Withdraw Settings in Admin Payment Gateways

/**
 * Save the gateway settings in admin
 *
 * @since 1.0.0
 */
public function save_gateway() {
	if ( isset( $_POST['prefive_save_' . $this->unique_slug] ) ) {
		
		// Enable Withdraw, Withdrawal save settings start
		
		$enable = trim( $_POST['prefive_sample_withdrawal_enable'] );
		if ( $enable == 'both' ) {
			update_option( 'prefive_enable_sample_withdraw_automatic', 'yes' );
			update_option( 'prefive_enable_sample_withdraw', 'yes' );
		} elseif ( $enable == 'automatic' ) {
			update_option( 'prefive_enable_sample_withdraw_automatic', 'yes' );
			update_option( 'prefive_enable_sample_withdraw', 'no' );
		} elseif ( $enable == 'manual' ) {
			update_option( 'prefive_enable_sample_withdraw_automatic', 'no' );
			update_option( 'prefive_enable_sample_withdraw', 'yes' );
		} else {
			update_option( 'prefive_enable_sample_withdraw_automatic', 'no' );
			update_option( 'prefive_enable_sample_withdraw', 'no' );
		}
		update_option( 'prefive_sample_withdrawal_enable', trim( $_POST['prefive_sample_withdrawal_enable'] ) );
		update_option( 'prefive_sample_withdraw_enablesandbox', trim( $_POST['prefive_sample_withdraw_enablesandbox'] ) );
		update_option( 'prefive_sample_client_id', trim( $_POST['prefive_sample_client_id'] ) );
		update_option( 'prefive_sample_secret_key', trim( $_POST['prefive_sample_secret_key'] ) );
		
		//Withdrawal save settings end
	}
}
Was this article helpful to you? Yes No

How can we help?