Plugin Directory

Changeset 3213675


Ignore:
Timestamp:
12/27/2024 08:47:40 AM (15 months ago)
Author:
wpexpertsio
Message:

1.1 - Dec 26, 2024

  • New – Tested compatibility with WordPress Version 6.7.1.
  • New – Tested compatibility with PHP 8.X
  • Improvement – Updated Settings UI
Location:
pay-with-square-in-memberpress/trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • pay-with-square-in-memberpress/trunk/MpFreeSquare.php

    r2535273 r3213675  
    88
    99    public function __construct() {
    10         add_filter('mepr-gateway-paths', array($this, 'mepr_free_add_square_gateway_path'), 10, 1);
    11         add_filter('mepr-ctrls-paths', array($this, 'mepr_free_add_square_gateway_path'), 99, 1);
    12         add_action('mepr-options-admin-enqueue-script', array($this, 'mepr_free_enqueue_scripts_in_admin'));
     10        add_filter('mepr-gateway-paths', array($this, 'add_square_gateway_path'), 10, 1);
     11        add_filter('mepr-ctrls-paths', array($this, 'add_square_gateway_path'), 99, 1);
     12        add_action('mepr-options-admin-enqueue-script', array($this, 'enqueue_scripts_in_admin'));
    1313    }
    1414
     
    1818     * @return array
    1919     */
    20 
    21     public function mepr_free_add_square_gateway_path($paths) {
     20    public function add_square_gateway_path($paths) {
    2221        array_push($paths, MEPR_FREE_SQUARE_PATH . 'includes');
    2322        return $paths;
    2423    }
    2524
    26     public function mepr_free_enqueue_scripts_in_admin() {
    27         wp_enqueue_style('mempr-free-square-admin-form-css', MEPR_FREE_SQUARE_URL . 'assets/css/admin_form.css');
     25    /**
     26     * enqueue admin scripts
     27     */
     28
     29 
     30
     31
     32    public function enqueue_scripts_in_admin() {
     33       
    2834    }
     35
     36
    2937}
    3038
  • pay-with-square-in-memberpress/trunk/includes/MeprFreeSquareApi.php

    r2535273 r3213675  
    55    public static function mepr_freeget_headers($api,$mode) {
    66        $headers = array();
    7         $headers[] = 'Square-Version: 2019-11-20';
     7       
    88        $token=($mode=='sandbox'?get_option('mepr_free_square_access_token_sandbox'):get_option('mepr_free_square_access_token'));
    9         if ($api !== '/oauth2/token') {
    10             $headers[] = 'Accept: application/json';
    11             $headers[] = 'Cache-Control: no-cache';
    12             $headers[] = 'Authorization: Bearer ' .$token;
    13             $headers[] = 'Content-Type: application/json';
     9       
     10        if ($api !== '/oauth2/token') {
     11            $headers = array(
     12                'Accept' => 'application/json',
     13                'Cache-Control' => 'no-cache',
     14                'Authorization' => 'Bearer ' .$token,
     15                'Content-Type' => 'application/json'
     16            );
    1417        }
     18       
    1519        return $headers;
    1620    }
    17 
     21    public static function get_location(){
     22        $square_mode = get_option('mepr_free_square_mode');
     23        $sandbox_location = '';
     24        if($square_mode == 'squareupsandbox'){
     25            $url = 'https://connect.squareupsandbox.com/v2/locations';
     26            $access_token = get_option('mepr_free_square_access_token_sandbox');
     27            $sandbox_location = "_sandbox";
     28        }
     29        else {
     30            $url = 'https://connect.squareup.com/v2/locations';
     31            $access_token = get_option('mepr_free_square_access_token');
     32        }
     33       
     34        //remote request
     35       
     36        $headers = array(
     37            'Square-Version' => '2021-09-15',
     38            'Authorization'  => 'Bearer ' . $access_token,
     39            'Content-Type'   => 'application/json'
     40        );
     41       
     42        $response = wp_remote_get($url, array(
     43            'headers'  =>  $headers
     44            )
     45        );
     46       
     47        $response_body = json_decode(wp_remote_retrieve_body($response));
     48       
     49        if (is_wp_error($response)) {
     50                echo esc_html(__('Error: Unable to complete your request. Try again.'));
     51        }
     52       
     53        if($response['response']['code'] == 200){
     54            $locations = array();
     55            foreach($response_body->locations as $index => $obj){
     56                // if (in_array("CREDIT_CARD_PROCESSING", @$obj->capabilities)){
     57                    array_push($locations, $response_body->locations[$index]);
     58                // }
     59            }
     60       
     61       
     62            update_option('mepr_free_square_locations'.$sandbox_location, $locations);
     63        }
     64    }
    1865    public static function charge($request_params, $api, $method,$domain_url) {
    1966
    20         $url =  'https://connect.' . $domain_url . '.com'.$api;
     67        $url =  'https://connect.' . $domain_url . '.com';
    2168        $mode=($domain_url=='squareupsandbox'?'sandbox':"live");
     69        $headers = MeprFreeSquareApi::mepr_freeget_headers($api,$mode);
    2270        $token = ($mode=='sandbox'?get_option('mepr_free_square_access_token_sandbox'):get_option('mepr_free_square_access_token'));
    23         $headers = MeprFreeSquareApi::mepr_freeget_headers($api,$mode);
     71       
    2472        if ($api == '/oauth2/token') {
    25         $args = array(
    26             'method'      => 'POST',
    27             'timeout'     => 45,
    28             'sslverify'   => false,
    29             'headers'     => array(
    30                 'Authorization' => 'Bearer '.$token,
    31                 'Content-Type'  => 'application/json',
    32             ),
    33             'body'        => http_build_query($request_params),
    34         );
     73                $response = wp_remote_post($url . $api, array(
     74                'method' => 'POST',
     75                'headers' => $headers,
     76                'httpversion' => '1.0',
     77                'sslverify' => false,
     78                'body' => http_build_query($request_params)
     79                )
     80            );
    3581        } else {
    36             $args = array(
    37                 'method'      => 'POST',
    38                 'timeout'     => 45,
    39                 'sslverify'   => false,
    40                 'headers'     => array(
    41                     'Authorization' => 'Bearer '.$token,
    42                     'Content-Type'  => 'application/json',
    43                 ),
    44                 'body'        => json_encode($request_params),
     82                $response = wp_remote_post($url . $api, array(
     83                'method' => 'POST',
     84                'headers' => $headers,
     85                'httpversion' => '1.0',
     86                'sslverify' => false,
     87                'body' => json_encode($request_params)
     88                )
    4589            );
    4690        }
     91        return json_decode($response['body']);
     92    }
    4793
     94
     95    public static function renew_square_subscription () {
    4896       
    49         $request = wp_remote_post( $url, $args );
     97    }
    5098
    51         if ( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) != 200 ) {
    52             MeprUtils::error_log('memberpress square request ' . $api . 'failed');
    53         }
    54    
    55         $response = wp_remote_retrieve_body( $request );
    56 
    57         return json_decode($response);
    58     }
    5999}
    60100
  • pay-with-square-in-memberpress/trunk/includes/MeprFreeSquareCtrl.php

    r2535273 r3213675  
    88
    99    public function load_hooks() {
    10         add_action('admin_init', array($this, 'mepr_free_get_square_codes'));
    11         add_action( 'init', array($this, 'mepr_free_get_access_token_memsquare_renewed') );
    12         add_action('admin_notices', array($this, 'mepr_free_failed_to_get_tokens'));
    13         add_action('mepr_process_options', array($this, 'mepr_free_disconnect_deleted_methods'));
     10        add_action('admin_init', array($this, 'get_square_codes'));
     11        add_action( 'init', array($this, 'get_access_token_memsquare_renewed') );
     12        add_action('admin_notices', array($this, 'failed_to_get_tokens'));
     13        add_action('mepr_process_options', array($this, 'disconnect_deleted_methods'));
    1414    }
    1515
     
    1818     *
    1919     */
    20     public function mepr_free_get_square_codes() {
    21 
     20    public function get_square_codes() {
     21        MeprFreeSquareApi::get_location();
    2222        if (isset($_GET['refresh_token_sandbox']) && isset($_GET['access_token_sandbox'])) {
    23        
    24        
    25             $response_body_array = $this->mepr_free_sanitize_array($_GET['response_body']);
    26                        
    27             update_option('mepr_free_square_refresh_token_sandbox', sanitize_text_field($_GET['refresh_token_sandbox']));
    28             update_option('mepr_free_square_access_token_sandbox', sanitize_text_field($_GET['access_token_sandbox']));
    29             update_option('mepr_free_square_response_body_sandbox', $response_body_array);
    30             update_option('mepr_free_square_app_id_sandbox', sanitize_text_field($_GET['app_id_sandbox']));
    31             wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration');
    32 
     23            update_option('mepr_free_square_refresh_token_sandbox', $_GET['refresh_token_sandbox']);
     24            update_option('mepr_free_square_access_token_sandbox', $_GET['access_token_sandbox']);
     25            update_option('mepr_free_square_response_body_sandbox', $_GET['response_body']);
     26
     27            wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration');
    3328        } else if (isset($_GET['refresh_token']) && isset($_GET['access_token'])) {
    34            
    35             $response_body_array = $this->mepr_free_sanitize_array($_GET['response_body']);
    36            
    37             update_option('mepr_free_square_refresh_token', sanitize_text_field($_GET['refresh_token']));
    38             update_option('mepr_free_square_access_token', sanitize_text_field($_GET['access_token']));
    39             update_option('mepr_free_square_response_body', $response_body_array);
    40             update_option('mepr_free_square_app_id', sanitize_text_field($_GET['app_id']));
    41             wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration');
    42            
     29            update_option('mepr_free_square_refresh_token', $_GET['refresh_token']);
     30            update_option('mepr_free_square_access_token', $_GET['access_token']);
     31            update_option('mepr_free_square_response_body', $_GET['response_body']);
     32             wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration');
     33
    4334        } else {
     35           
     36           
     37           
     38           
    4439            if (isset($_GET['error'])) {
    45                 wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration&&mepr-square-error=true');
     40           
     41                wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration&&mepr-square-error=true');
    4642                exit;
    4743            }
     
    4945        if (isset($_GET['success_revoke_token_sandbox'])) {
    5046            delete_option('mepr_free_square_access_token_sandbox');
    51             delete_option('mepr_free_square_app_id_sandbox');
    5247            wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration');
    5348            exit;
     
    5550        if (isset($_GET['success_revoke_token'])) {
    5651            delete_option('mepr_free_square_access_token');
    57             delete_option('mepr_free_square_app_id');
    5852            wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration');
    5953            exit;
    6054        }
    6155        if (isset($_GET['failed_revoke_token'])) {
    62             delete_option('mepr_free_square_access_token');
    63             delete_option('mepr_free_square_app_id');
     56            if(get_option('mepr_free_square_mode') == 'squareup') {
     57                delete_option('mepr_free_square_access_token');
     58            } elseif(get_option('mepr_free_square_mode') == 'squareupsandbox') {
     59                delete_option('mepr_free_square_access_token_sandbox');
     60            }
     61           // wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration&&mepr-square-error=true');
    6462            wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration');
    6563            exit;
    6664        }
    6765    }
    68    
    69     public function mepr_free_sanitize_array( &$array ) {
    70 
    71         foreach ($array as $key => &$value) {   
    72             if( !is_array($value) ){
    73                 $values[$key] = sanitize_text_field( $value );
    74             }else{
    75                 // go inside this function again
    76                 $this->mepr_free_sanitize_array($value);
    77             }
    78         }
    79         return $values;
    80     }
    81 
    8266
    8367    /**
    8468     * Add notice to admin if failed to get square tokens
    8569     */
    86     public function mepr_free_failed_to_get_tokens() {
     70    public function failed_to_get_tokens() {
    8771        if (isset($_GET['mepr-square-error'])) {
    8872            $class = 'notice notice-error is-dismissible square-first-notice';
    89             $message = __('failed to get / revoke square tokens', 'square-for-memberpress');
     73            $message = __('failed to get / revoke square tokens');
    9074            printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), esc_html($message));
    9175        }
    9276    }
     77
    9378    /**
    9479     * renew square access token
    9580     */
    96     public function mepr_free_get_access_token_memsquare_renewed() {
     81    public function get_access_token_memsquare_renewed() {
    9782            if(get_option('mepr_free_square_access_token')){
    9883                $meprSquare_auth_response = get_option('mepr_free_square_response_body');
     84               
     85               
    9986                if(
    10087                !empty($meprSquare_auth_response)
     
    128115                    $oauth_response = wp_remote_post( $oauth_connect_url, $args_renew );
    129116                    $decoded_oauth_response = json_decode( wp_remote_retrieve_body( $oauth_response ) );
    130 
     117                   
     118                   
     119                   
    131120                    if(!empty($decoded_oauth_response->access_token)){
    132121                        $meprSquare_auth_response['expires_at'] = $decoded_oauth_response->expires_at;
     
    135124                        update_option('mepr_free_square_response_body',$meprSquare_auth_response);
    136125                        update_option('mepr_free_square_access_token',$meprSquare_auth_response['access_token']);
     126                       
    137127                    }
    138128                }
    139129            }
    140130           
     131           
    141132            if(get_option('mepr_free_square_access_token_sandbox')){
    142                 $mepr_square_response_body_sandbox = get_option('mepr_free_square_response_body_sandbox');
    143                
    144                 if( !empty($mepr_square_response_body_sandbox)
     133                $mepr_free_square_response_body_sandbox = get_option('mepr_free_square_response_body_sandbox');
     134               
     135               
     136                if( !empty($mepr_free_square_response_body_sandbox)
    145137                    and
    146                 (strtotime($mepr_square_response_body_sandbox['expires_at']) - 300) <= time()
     138                (strtotime($mepr_free_square_response_body_sandbox['expires_at']) - 300) <= time()
    147139                 ){
    148140                    $headers = array(
    149                         'refresh_token' => $mepr_square_response_body_sandbox['refresh_token'], // Use verbose mode in cURL to determine the format you want for this header
     141                        'refresh_token' => $mepr_free_square_response_body_sandbox['refresh_token'], // Use verbose mode in cURL to determine the format you want for this header
    150142                        'Content-Type'  => 'application/json;'
    151143                    );
    152                     $oauth_connect_url = MEPR_FREE_SQUARE_CONNECTURL;
     144                    $oauth_connect_url = MEPR_SQUARE_CONNECTURL;
    153145                    $redirect_url = add_query_arg(
    154146                        array(
     
    173165                    $decoded_oauth_response = json_decode( wp_remote_retrieve_body( $oauth_response ) );
    174166                   
     167                   
     168                   
    175169                    if(!empty($decoded_oauth_response->access_token)){
    176                         $mepr_square_response_body_sandbox['expires_at'] = $decoded_oauth_response->expires_at;
    177                         $mepr_square_response_body_sandbox['refresh_token'] = $decoded_oauth_response->refresh_token;
    178                         $mepr_square_response_body_sandbox['access_token'] = $decoded_oauth_response->access_token;
    179                         update_option('mepr_free_square_response_body_sandbox',$mepr_square_response_body_sandbox);
    180                         update_option('mepr_free_square_access_token_sandbox',$mepr_square_response_body_sandbox['access_token']);
     170                        $mepr_free_square_response_body_sandbox['expires_at'] = $decoded_oauth_response->expires_at;
     171                        $mepr_free_square_response_body_sandbox['refresh_token'] = $decoded_oauth_response->refresh_token;
     172                        $mepr_free_square_response_body_sandbox['access_token'] = $decoded_oauth_response->access_token;
     173                        update_option('mepr_free_square_response_body_sandbox',$mepr_free_square_response_body_sandbox);
     174                        update_option('mepr_free_square_access_token_sandbox',$mepr_free_square_response_body_sandbox['access_token']);
    181175                       
    182176                    }
     
    185179    }
    186180
    187     public function mepr_free_disconnect_deleted_methods($params) {
     181    public function disconnect_deleted_methods($params) {
    188182        $mepr_options = MeprOptions::fetch();
    189183        // Bail early if no payment methods have been deleted
     
    198192            $integ = $mepr_options->integrations[$method_id];
    199193
    200             if ($integ['gateway'] === 'MeprFreeSquareGateway' && get_option('mepr_free_square_access_token')) {
     194            if ($integ['gateway'] === 'MeprSquareGateway' && get_option('mepr_free_square_access_token')) {
    201195                delete_option('mepr_free_square_access_token');
    202196                delete_option('mepr_free_square_refresh_token');
  • pay-with-square-in-memberpress/trunk/includes/MeprFreeSquareGateway.php

    r2535273 r3213675  
    2727    public function load($settings) {
    2828        $this->settings = (object) $settings;
     29        $this->key = 'Square';
    2930        $this->set_defaults();
    3031    }
     
    7273        $this->use_desc = $this->settings->use_desc;
    7374        if ($this->is_test_mode()) {
    74        
    75             $this->settings->app_id_sandbox = get_option('mepr_free_square_app_id_sandbox');
    76             $this->settings->domain_url = 'squareupsandbox';
     75            $this->settings->app_id_sandbox = 'sandbox-sq0idb-YEk828X9LSIlMBnT5EGx8A';
     76             $this->settings->domain_url = 'squareupsandbox';
    7777            update_option( 'mepr_free_square_mode', 'squareupsandbox' );
    7878         
    7979        } else {
    80            
    81             $this->settings->app_id = get_option('mepr_free_square_app_id');
     80            $this->settings->app_id = 'sq0idp-kiNKM9TUUhQctgLBJNgPKQ';
    8281            $this->settings->domain_url = 'squareup';
    8382            update_option( 'mepr_free_square_mode', 'squareup');
     
    9190     */
    9291 
    93     public function process_payment($txn) {
     92   public function process_payment($txn) {
     93       
     94     
     95
    9496        if (isset($txn) && $txn instanceof MeprTransaction) {
    9597            $usr = new MeprUser($txn->user_id);
    9698            $prd = new MeprProduct($txn->product_id);
     99            // $sub->subscr_id = $_POST['subscr_id'];
    97100        } else {
    98             throw new MeprGatewayException(__('Payment was unsuccessful, please check your payment details and try again.', 'square-for-memberpress'));
     101            throw new MeprGatewayException(__('Payment was unsuccessful, please check your payment details and try again.', 'memberpress'));
    99102        }
    100103        $mepr_options = MeprOptions::fetch();
    101104        if (!isset($txn->total)) {
    102             throw new MeprGatewayException(__('No Amount!!', 'square-for-memberpress'));
    103         }
    104         $nonce = isset($_POST['card_nonce']) ? sanitize_text_field( $_POST['card_nonce'] ) : '';
     105            throw new MeprGatewayException(__('No Amount!!', 'memberpress'));
     106        }
     107        $nonce = isset($_POST['card_nonce']) ? $_POST['card_nonce'] : '';
    105108        if (empty($nonce)) {
    106             throw new MeprGatewayException(__('Payment could not be processed at this time', 'square-for-memberpress'));
     109            throw new MeprGatewayException(__('Payment could not be processed at this time', 'memberpress'));
    107110        }
    108111        $idempotency_key = uniqid();
    109112        $fields = array(
    110113            "idempotency_key" => $idempotency_key,
     114            //"location_id" => MEPR_SQUARE_LOCATION_ID,
    111115            "autocomplete" => true,
    112116            "amount_money" => array(
    113                 "amount" => ( (int) round( $txn->total *100, 2 ) ),
     117                "amount" => ( (int) round( $txn->total *100, 2 ) ), //(float) $txn->total * 100,
    114118                "currency" => $mepr_options->currency_code
    115119            ),
     
    120124            )
    121125        );
    122         $response = MeprFreeSquareApi::charge($fields, $api = '/v2/payments', $method = 'POST', $this->settings->domain_url);
     126         $response = MeprFreeSquareApi::charge($fields, $api = '/v2/payments', $method = 'POST', $this->settings->domain_url);
    123127        if (isset($response->payment->status) && $response->payment->status == 'COMPLETED') {
    124128            $txn->trans_num = $response->payment->id;
     
    139143        $txn->store();
    140144        MeprUtils::send_transaction_receipt_notices($txn);
    141     }
     145     }
    142146
    143147    public function record_payment() {
     
    217221
    218222    public function enqueue_payment_form_scripts() {
     223        $square_mode = get_option('mepr_free_square_mode');
     224           
     225        if($square_mode == 'squareupsandbox'){
     226            wp_enqueue_script('mempr-square-webpack-js', 'https://sandbox.web.squarecdn.com/v1/square.js', array(), MEPR_VERSION);
     227        }
     228        else {
     229            wp_enqueue_script('mempr-square-webpack-js', 'https://web.squarecdn.com/v1/square.js', array(), MEPR_VERSION);
     230        }
    219231        wp_enqueue_script('mempr-free-square-payment-form-js', 'https://js.' . $this->settings->domain_url . '.com/v2/paymentform', array(), MEPR_VERSION);
    220         wp_enqueue_script('mepr-free-square-payment-form-scripts', MEPR_FREE_SQUARE_URL . 'assets/js/sq-paymet-form.js', array(), MEPR_VERSION);
    221         wp_localize_script('mepr-free-square-payment-form-scripts', 'MeprFreeSquareGateway', array(
     232        // wp_enqueue_script('mepr-free-square-payment-form-scripts', MEPR_FREE_SQUARE_URL . 'assets/js/sq-paymet-form.js', array(), MEPR_VERSION);
     233         wp_enqueue_script('mepr-square-webpack-script', MEPR_FREE_SQUARE_URL . 'assets/js/sq-webpack.js?rand='.rand(), array(),true);
     234        wp_localize_script('mepr-square-webpack-script', 'MeprFreeSquareGateway', array(
    222235            'applicationId' => ($this->is_test_mode() ? $this->settings->app_id_sandbox : $this->settings->app_id),
     236            'product_price' => get_post_meta(get_the_ID(), '_mepr_product_price', true),
     237            'mepr_currency_code'  => get_option('mepr_options')['currency_code'],
     238            'locationId'  => get_option('mepr-square-locationId'),
    223239         ));
    224240           
    225241        wp_enqueue_style('mempr-free-square-payment-form-css', MEPR_FREE_SQUARE_URL . 'assets/css/sq-payment-form.css');
     242       
     243
    226244    }
    227245
    228246    public function display_payment_form($amount, $user, $product_id, $transaction_id) {
    229247       
    230         $mepr_options = MeprOptions::fetch();
     248        $mepr_options = MeprOptions::fetch();
    231249        $prd = new MeprProduct($product_id);
    232250        $coupon = false;
    233251        $txn = new MeprTransaction($transaction_id);
    234         $prd_mode = $txn->product();
    235    
    236 
    237252        //Artifically set the price of the $prd in case a coupon was used
    238253        if ($prd->price != $amount) {
     
    244259        echo $invoice;
    245260
    246     if((get_option('mepr_free_square_access_token') || get_option('mepr_free_square_access_token_sandbox')) && !empty($prd_mode->is_one_time_payment())){  ?>
     261//        /** @TODO  what if there was error !!!! it will submit the form */
     262
     263        if(
     264            get_option('mepr_free_square_access_token')
     265            ||
     266            get_option('mepr_free_square_access_token_sandbox')
     267        ){
     268       
     269        ?>
    247270        <div  id="square-errors"></div>
    248         <form method="post" id="mepr_square_payment_form" class=" mepr-square mepr-checkout-form mepr-form mepr-card-form" novalidate>
    249             <input type="hidden" name="mepr_process_payment_form" value="Y" />
    250             <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr($transaction_id); ?>" />
    251             <label><?php _e('Payment Details', 'square-for-memberpress') ?></label>
    252             <div id="form-container">
    253                 <div id="sq-card-number"></div>
    254                 <div class="third" id="sq-expiration-date"></div>
    255                 <div class="third" id="sq-cvv"></div>
    256                 <div class="third" id="sq-postal-code"></div>
    257                 <input type="hidden" id="card-nonce" name="card_nonce" />
    258                 <button id="sq-creditcard" class="button-credit-card" onclick="requestCardNonce(event)"><?php _e('Pay with Square', 'square-for-memberpress'); ?> </button>
    259             </div> <!-- end #form-container -->
    260         </form>
    261        
    262         <?php
    263          wp_enqueue_script('mepr-free-square-admin-form-scripts-custom', MEPR_FREE_SQUARE_URL . 'assets/js/sq-paymet.js', array(), MEPR_VERSION);
    264         } else { ?>
    265             <div id="square-errors"><?php echo _e('Sorry, it seems that subscription payment is not available in memberpress square.', 'square-for-memberpress'); ?></div>         
    266         <?php }
     271            <form method="post" id="mepr_square_payment_form" class=" mepr-square mepr-checkout-form mepr-form mepr-card-form" novalidate>
     272                <input type="hidden" name="mepr_process_payment_form" value="Y" />
     273                <input type="hidden" name="mepr_transaction_id" value="<?php echo $transaction_id; ?>" />
     274                <div id="card-container"></div>
     275                <input type="hidden" id="card-nonce" name="card_nonce" />
     276                <button id="card-button" type="button">Pay $<?php echo $amount;?></button>
     277              </form>
     278              <div id="payment-status-container"></div>
     279              <div id="error-div" style="display: none;border: 3px solid red;padding-left:5px;"></div>
     280        <?php } else {
     281            echo ' <div  id="square-errors">Sorry, it seems that square is not available at the moment. Please contact us if you require assistance.</div>';           
     282        }
     283   
    267284    }
    268285
  • pay-with-square-in-memberpress/trunk/includes/views/square-admin-form.php

    r2535273 r3213675  
     1<style>
     2
     3    a.wc-square-connect-button {
     4        text-decoration: none;
     5        display: inline-block;
     6        border-radius: 3px;
     7        background-color: #2996cc;
     8        padding: 7px 10px;
     9        /* padding: 10px 40px; */
     10        height: 30px;
     11        color: #ffffff;
     12        box-shadow: 3px 4px 15px 2px #999999;
     13        font-weight: 700;
     14        font-family: "Square Market",Helvetica,Arial,"Hiragino Kaku Gothic Pro","ヒラギノ角ゴ Pro W3","メイリオ",Meiryo,"MS Pゴシック",sans-serif;
     15        text-rendering: optimizeLegibility;
     16        text-transform: uppercase;
     17        letter-spacing: 1px;
     18    }
     19    a.wc-square-connect-button span {
     20        vertical-align: top;
     21        display: inline-block;
     22        padding-top: 7px;
     23        padding-left: 10px;
     24    }
     25</style>
     26<script>
     27    jQuery(document).ready(function () {
     28         if (jQuery('.mepr-square-testmode').is(":checked")) {
     29                console.log('yess');
     30                jQuery('.mepr-square-sandbox-mode').show();
     31                jQuery('.mepr-square-live-mode').hide();
     32                jQuery('.live_locations').hide();
     33                jQuery('.Sandbox_locations').show();
     34            } else {
     35                jQuery('.mepr-square-live-mode').show();
     36                jQuery('.mepr-square-sandbox-mode').hide();
     37                jQuery('.live_locations').show();
     38                jQuery('.Sandbox_locations').hide();
     39                console.log('no');
     40            }
     41        jQuery('.mepr-square-testmode').on('change', function () {
     42//           console.log(jQuery('.mepr-square-testmode').val());
     43            if (jQuery('.mepr-square-testmode').is(":checked")) {
     44                console.log('yess');
     45                jQuery('.mepr-square-sandbox-mode').show();
     46                jQuery('.live_locations').hide();
     47                jQuery('.Sandbox_locations').show();
     48                jQuery('.mepr-square-live-mode').hide();
     49            } else {
     50                jQuery('.mepr-square-live-mode').show();
     51                jQuery('.live_locations').show();
     52                jQuery('.Sandbox_locations').hide();
     53                jQuery('.mepr-square-sandbox-mode').hide();
     54                console.log('no');
     55            }
     56        });
     57        jQuery('.mepr-square-gpay').on('change', function () {
     58            console.log(jQuery('.mepr-square-gpay').attr("checked"));
     59            if (jQuery('.mepr-square-gpay').attr("checked") == 'checked') {
     60                console.log('han');
     61                jQuery('.mepr-square-gpay').removeAttr('checked');
     62            } else {
     63                console.log('nhi');
     64                jQuery('.mepr-square-gpay').attr('checked');
     65            }
     66        });
     67        jQuery('.mepr-square-applepay').on('change', function () {
     68            console.log(jQuery('.mepr-square-applepay').attr("checked"));
     69            if (jQuery('.mepr-square-applepay').attr("checked") == 'checked') {
     70                console.log('han');
     71                jQuery('.mepr-square-applepay').removeAttr('checked');
     72            } else {
     73                console.log('nhi');
     74                jQuery('.mepr-square-applepay').attr('checked');
     75            }
     76        })
     77    });
     78</script>
    179
    280
    381<div class="wrap">
    4     <div class="welcome-panel">
     82    <div class="welcome-panels">
    583        <div id="mepr-square-connect-migrate-prompt" class="mepr-payment-option-prompt">
    6             <p><?php _e('You need a Square account to connect your memberpress. If you do not have an account, go to <a target="_blank" href="https://squareup.com/signup">https://squareup.com/signup</a> to create one.', 'square-for-memberpress'); ?></p>
     84
     85            <p><?php _e('You need a Square account to connect your memberpress. If you do not have an account, go to <a target="_blank" href="https://squareup.com/signup">https://squareup.com/signup</a> to create one.'); ?></p>
     86
    787            <?php
    8              
    9             $sandbox_connect_url = add_query_arg(
    10                     array(
    11                 'app_name' => MEPR_FREE_SQUARE_APPNAME,
     88           
     89           $sandbox_connect_url = add_query_arg(
     90                    array(
     91                'app_name' => $this->settings->app_id_sandbox,
    1292                'is_sandbox' =>  'yes' ,
    1393                'request' => 'request_token',
     
    1797            $production_connect_url = add_query_arg(
    1898                    array(
    19                 'app_name' => MEPR_FREE_SQUARE_APPNAME,
     99                'app_name' => $this->settings->app_id,
    20100                'is_sandbox' =>  'no' ,
    21101                'request' => 'request_token',
     
    23103                    ), MEPR_FREE_SQUARE_CONNECTURL
    24104            );
     105           
    25106             $sandbox_disconnect_url = add_query_arg(
    26107                    array(
    27108                'access_token' => get_option('mepr_free_square_access_token_sandbox'),
    28109                'app_name' => MEPR_FREE_SQUARE_APPNAME,
    29                 'client_id' => get_option('mepr_free_square_app_id_sandbox'),
     110                'client_id' => $this->settings->app_id_sandbox,
    30111                'is_sandbox' =>  'yes' ,
    31112                'request' => 'revoke_token',
     
    43124                    ), MEPR_FREE_SQUARE_CONNECTURL
    44125            );
     126           
     127            if(isset($_POST) && isset($_POST['Submit'])){
     128           
     129
     130                if(isset($_POST['mepr-square-location']) && !empty($_POST['mepr-square-location'])){
     131                    update_option('mepr-square-locationId', $_POST['mepr-square-location']);
     132               
     133                }
     134                else {
     135                    update_option('mepr-square-locationId', get_option('mepr_free_square_locations_sandbox')[0]->id);
     136                }
     137               
     138               
     139                $mepr_integration_options = $_POST['mepr-integrations'][$this->id];
     140               
     141                if(isset($mepr_integration_options['test_mode'])){
     142                    update_option('mepr_integrations_' . $this->id, $mepr_integration_options['test_mode']);
     143                }
     144                else {
     145                    update_option('mepr_integrations_' . $this->id, '');
     146                }
     147            }
     148           
    45149//        ?>
    46150
     
    48152                <tbody>
    49153                    <tr valign="top">
    50                         <th scope="row"><label for="<?php echo esc_attr($test_mode_str); ?>"><?php _e('Test Mode', 'square-for-memberpress'); ?></label></th>
    51                         <td>
    52                             <input class="mepr-square-testmode" type="checkbox" name="<?php echo esc_attr($test_mode_str); ?>" data-integration="<?php echo esc_attr($this->id); ?>"<?php echo checked($test_mode); ?> />
     154                        <th scope="row"><label for="<?php echo $test_mode_str; ?>"><?php _e('Test Mode', 'memberpress'); ?></label></th>
     155                        <td><input class="mepr-square-testmode" type="checkbox" name="<?php echo $test_mode_str; ?>" data-integration="<?php echo $this->id; ?>" <?php echo (get_option('mepr_integrations_' . $this->id) == 'on') ? 'checked' :''?> /></td>
    53156                        </td>
    54                     </tr>
     157                    </tr>
     158                   
     159                    <?php if ( !empty(get_option('mepr_free_square_access_token')) ) { ?>
     160                    <tr valign="top" class="live_locations" >
     161                    <th scope="row"><label for="mepr-square-location"><?php _e('Locations:', 'memberpress') ?></label></th>
     162                   
     163                    <td>
     164                                <?php
     165                                    $locations = get_option('mepr_free_square_locations');
     166                                    $locationsid = get_option('mepr-square-locationId');
     167                                ?>
     168                                <select class="mepr-square-location" type="checkbox" name="mepr-square-location" >
     169                                <option value="0">Select your Location</option>
     170                                    <?php 
     171                                        foreach($locations as $key => $value){
     172                                               
     173                                                    if (in_array("CREDIT_CARD_PROCESSING", @$value->capabilities)){?>
     174                                                        <option value="<?php echo $value->id ?>" <?php if($value->id == $locationsid){ echo 'selected="selected"'; } ?> ><?php echo $value->name ?></option>
     175                                        <?php
     176                                                    }else{ ?>
     177                                                        <option disabled title="CREDIT CARD PROCESSING not allowed in your square account." value="<?php echo $value->id ?>"><?php echo $value->name ?></option>
     178                                            <?php   }
     179                                        }
     180                                    ?>
     181                                </select>
     182                               
     183                            </td>
     184                        </tr>
     185                       
     186                        <?php } ?>
     187                        <?php if ( !empty(get_option('mepr_free_square_access_token_sandbox')) ) { ?>
     188                       
     189                           
     190                            <?php
     191                        $locations = get_option('mepr_free_square_locations_sandbox'); ?>
     192                        <tr valign="top" class="Sandbox_locations">
     193                        <th scope="row"><label for="mepr-square-location"><?php _e('Locations:', 'memberpress') ?></label></th>                     
     194                        <td >
     195                                <select class="mepr-square-location" type="checkbox" name="mepr-square-location-sandbox" >
     196                                <option value="0">Select your Location</option>
     197                                    <?php 
     198                                    if (is_array($locations) || is_object($locations)) {
     199                                        foreach ($locations as $key => $value) {
     200                                            ?>
     201                                            <option value="<?php echo $value->id ?>" selected><?php echo $value->name ?></option>
     202                                            <?php
     203                                        }
     204                                    } else {
     205                                        echo "No locations available."; // You can provide a more appropriate message
     206                                    }?>
     207                                </select>
     208                               
     209                            </td>
     210                            </tr>
     211                        <?php } ?>
    55212                    <tr valign="top">
    56213                        <th scope="row">
    57                             <?php esc_html_e('Connect/Disconnect', 'square-for-memberpress'); ?>
    58                             <p><?php echo _e('Connect through auth square to make system more smooth.', 'square-for-memberpress'); ?></p>
     214                            <?php esc_html_e('Connect/Disconnect', 'woocommerce-square'); ?>
     215                            <p>Connect through auth square to make system more smooth.</p>
    59216                        </th>
    60217
     
    69226                                            <path fill="#FFFFFF" d="M17.333 28.003c-.736 0-1.332-.6-1.332-1.339v-9.324c0-.739.596-1.339 1.332-1.339h9.338c.738 0 1.332.6 1.332 1.339v9.324c0 .739-.594 1.339-1.332 1.339h-9.338z" />
    70227                                        </svg>
    71                                         <span><?php esc_html_e('Connect with Square Sandbox', 'square-for-memberpress'); ?></span>
    72                                     </a>
    73                                     <?php } else { ?>
     228                                        <span><?php esc_html_e('Connect with Square Sandbox', 'woocommerce-square'); ?></span>
     229                                    </a>
     230                                    <?php
     231                                        } else { ?>
    74232                                    <a href="<?php echo esc_attr($sandbox_disconnect_url); ?>" class='button-primary'>
    75                                     <?php echo esc_html__('Disconnect from Square Sandbox', 'square-for-memberpress'); ?>
    76                                     </a>
    77                                 <?php }
     233                                    <?php echo esc_html__('Disconnect from Square Sandbox', 'memberpress-square'); ?>
     234                                    </a>
     235                                <?php
     236                                        }
    78237                           
    79238                            ?>
     
    87246                                            <path fill="#FFFFFF" d="M17.333 28.003c-.736 0-1.332-.6-1.332-1.339v-9.324c0-.739.596-1.339 1.332-1.339h9.338c.738 0 1.332.6 1.332 1.339v9.324c0 .739-.594 1.339-1.332 1.339h-9.338z" />
    88247                                        </svg>
    89                                         <span><?php esc_html_e('Connect with Square Live', 'square-for-memberpress'); ?></span>
    90                                     </a>
    91                                     <?php } else { ?>
     248                                        <span><?php esc_html_e('Connect with Square Live', 'woocommerce-square'); ?></span>
     249                                    </a>
     250                                    <?php
     251                                    } else { ?>
    92252                                    <a href="<?php echo esc_attr($production_disconnect_url); ?>" class='button-primary'>
    93                                     <?php echo esc_html__('Disconnect from Square Live', 'square-for-memberpress'); ?>
    94                                     </a>
    95                             <?php } ?>
     253                                    <?php echo esc_html__('Disconnect from Square Live', 'memberpress-square'); ?>
     254                                    </a>
     255                            <?php
     256                                        } ?>
    96257                            </td>
    97                      </tr>
     258                       
     259
     260                    </tr>
    98261
    99262                </tbody>
  • pay-with-square-in-memberpress/trunk/readme.txt

    r2729327 r3213675  
    1 === Pay with Square in MemberPress ===
     1=== MemberPress Square — Accept Square Payments in MemberPress ===
    22Contributors: wpexpertsio
    3 Tags: MemberPress, Payments, Square, Membership, subscription
     3Tags: MemberPress, Square Payments, Subscription, Recurring Payments, Digital Wallets
    44Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=pay@objects.ws&item_name=DonationForPlugin
    55Requires at least: 4.8
    66Requires PHP: 7.0
    7 Tested up to: 6.0
    8 Stable tag: 1.0
     7Tested up to: 5.7.1
     8Stable tag: 1.1
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
    1111
     12Want to integrate Square payments in Memberpress for your wordpress site? Install Memberpress Square plugin to accept Square Payments and create subscriptions.
     13
    1214== Description ==
     15**MemberPress Square — Integrate Square Payments and create subscriptions in MemberPress WordPress Plugin** 
    1316
    14 **Collect one-time payments on your membership website using MemberPress Square.**
     17Are you looking for a reliable way to accept Square payments in MemberPress for your membership website? 
     18All you need is to install the [✨MemberPress Square WordPress Plugin ✨](https://apiexperts.io/solutions/memberpress-square/)
    1519
    16 MemberPress-Square plugin (Free) enables you to accept MemberPress membership payments through Square. Admins with MemberPress installed on their WordPress site can manage and track membership subscriptions and easily accept Square payments (one-time) from their customers.
     20This plugin integrates the Square payment gateway into your MemberPress-powered membership site and makes it easy to collect one-time and recurring payments, manage subscriptions, and track transactions effectively. 
    1721
    18 **Why choose MemberPress?**
     22With **MemberPress Square**, you can enable Google Pay and Apple Pay, After Pay, Cash App, Square Gift Card, process refunds, and even manage ACH payments. Whether you're running a small business, offering subscription-based services, or building a membership community, this plugin empowers you to streamline payment handling. 
    1923
    20 MemberPress plugin helps you build excellent WordPress membership sites, accept credit cards securely, sell online courses, control who sees your content, and sell downloadable digital products.
     24Read on to learn how MemberPress Square can transform your payment experience.
    2125
    22 **Why choose Square?**
     26== Key Features That Make MemberPress Square Unique ==
     27The MemberPress Square plugin is loaded with features designed to simplify payment processing and membership management. Here's what sets it apart: 
    2328
    24 Square is the only payment gateway with a free online store feature that automatically connects to Square payments. It is helping more than two million businesses to accept fast, reliable, and secure payments anywhere, anytime.
     29✅ **One-Time Payments** 
     30Easily accept one-time payments for memberships. Offer a hassle-free, secure checkout experience to enhance user satisfaction and boost conversions. 
    2531
    26 For the MemberPress-Square plugin to work on your WordPress-powered site, you should have a MemberPress plugin & Square account.
     32✅ **Recurring Payments [Pro]** 
     33Enable automated recurring payments for your memberships. Simplify subscription management while ensuring consistent revenue. This premium feature supports multiple payment methods for a flexible payment experience. 
    2734
    28 == MemberPress Square Features ==
     35✅ **Digital Wallets Integration [Pro]** 
     36Offer more payment options to your users by enabling Apple Pay, Google Pay, After Pay, and Cash App. These digital wallets enhance the checkout experience and let users pay quickly and securely with their preferred method. 
    2937
    30 * Automatically accept Square payment (one-time) for membership subscriptions.
    31 * It has support for Square Sandbox API (for testing purposes) to make the development phase easy.
    32 * MemberPress-Square free plugin has a Live Square Connect option to collect payments from customers.
    33 * Using MemberPress Square free plugin, the admin can refund payments via Square to customers.
    34 * View a log of all Square payment transactions.
     38✅ **ACH Payments and Gift Cards [Pro]** 
     39Expand your payment options with ACH transactions and Square gift cards. This makes it convenient for customers to pay directly from their bank accounts or use gift cards for purchases. 
    3540
     41✅ **Square Sandbox and Live Integration** 
     42Test and fine-tune your payment setup using the Square Sandbox environment before switching to live mode. Seamlessly toggle between Sandbox and Live settings directly from the MemberPress dashboard. 
    3643
    37 == MemberPress Square Requirements ==
    38 * [MemberPress Plugin](https://memberpress.com/plans/pricing/).
    39 * [Square Account](https://squareup.com/).
     44✅ **Process Refunds Effortlessly [Pro]** 
     45Refund any transaction directly from the MemberPress dashboard. This feature gives you full control over refunds and eliminates the need to log into external platforms. 
    4046
    41 == DOCUMENTATION ==
     47✅ **Multi-Membership Connection** 
     48Link multiple memberships to your Square account. Whether you’re running tiered plans or offering diverse access levels, this feature simplifies payment management. 
    4249
    43 [Click Here](https://apiexperts.io/documentation/pay-with-square-in-memberpress/) to read complete documentation of the product. The documentation includes a step-by-step installation and configuration guide, system specifications, troubleshooting, and support.
     50✅ **View and Track Transactions** 
     51Get a comprehensive log of all payments and refunds in one place. Track Square memberships, manage recurring payments, and keep your financial records up to date. 
    4452
     53✅ **Support for Square API** 
     54Built with the latest Square API for WordPress, this plugin ensures compatibility with Square’s robust payment infrastructure and gives you a reliable and secure solution for your membership site. 
    4555
    46 == MemberPress Square Pro ==
     56✅ **Shortcode Integration for Membership Pages** 
     57Utilize MemberPress shortcodes, such as the MemberPress account shortcode and the MemberPress upsell shortcodes, to enhance user experience and boost conversions. 
    4758
    48 MemberPress Square helps users accept payments on their membership website using the Square Payment Gateway. Users with MemberPress installed on their website can manage and track membership subscriptions and easily accept Square payments from their customers.
     59== Why Should You Install MemberPress Square Plugin? — 05 Key Reasons ==
     60The MemberPress Square plugin is a game-changer for membership site owners. It simplifies payment management, enhances member satisfaction, and provides advanced tools to grow your business. Here are five compelling reasons to install it today: 
    4961
    50 **Accept recurring payments**
    51 With MemberPress Square Pro, you can accept recurring subscription payments from your customers and keep track of their transaction from your plugin’s dashboard. You can also limit the subscription cycle of any membership by selecting intervals for payments.
     62**Reason #1: Simplify Payment Collection** 
     63✔️ Accept both one-time and recurring payments with ease. 
     64✔️ Integrate Square payments directly into MemberPress memberships. 
     65✔️ Offer a variety of payment methods, including mobile wallets. 
     66✔️ Reduce abandoned checkouts with user-friendly payment options. 
     67✔️ Use Square Sandbox to perfect your setup before launching. 
    5268
    53 You also have the choice to start the membership subscription on a trial period.
     69**Reason #2: Automate Processes and Save Time** 
     70✔️ Automate recurring billing for effortless subscription management. 
     71✔️ Process refunds directly within the MemberPress interface. 
     72✔️ Track transactions in real-time without switching platforms. 
     73✔️ Optimize payment workflows for efficiency. 
     74✔️ Eliminate manual errors with built-in automation tools. 
    5475
    55 * Track and manage membership subscriptions;
    56 * Accept recurring payments;
    57 * Limit recurring subscription payment cycle;
    58 * Allow trial period on any membership subscription;
    59 * Accept payments through Google Pay
    60 * Accept payments through Apple Pay
    61 * Process refund for any transaction.
    62 * Log to view Square payment transactions;
    63 * Accept Square payments for membership subscriptions;
    64 * Display payment label, icon, and description;
    65 * Square Sandbox API support to make the development phase easy;
    66 * Connect multiple memberships with your Square account.
     76**Reason #3: Enhance Member Satisfaction** 
     77✔️ Offer trusted payment options like Apple Pay and Google Pay. 
     78✔️ Respond quickly to refund requests with built-in tools. 
     79✔️ Provide a seamless checkout experience with clear instructions. 
     80✔️ Ensure secure transactions through Square’s robust system. 
     81✔️ Build credibility with modern payment solutions. 
    6782
    68 Read the MemberPress Square Pro [Technical Documentation here](https://apiexperts.io/documentation/memberpress-with-square/). You can [buy the Pro Version here](https://apiexperts.io/solutions/memberpress-square/).
     83**Reason #4: Expand Your Payment Options** 
     84✔️ Accept ACH payments, Afterpay, and Cash App. 
     85✔️ Allow members to pay using gift cards. 
     86✔️ Cater to diverse user preferences with multiple payment methods. 
     87✔️ Scale your business with flexible billing options. 
     88✔️ Increase conversion rates with mobile-friendly solutions. 
    6989
     90**Reason #5: Leverage Advanced Features** 
     91✔️ Use Square Sandbox to test and debug before going live. 
     92✔️ Monitor all transactions through detailed logs. 
     93✔️ Connect multiple memberships to a single Square account. 
     94✔️ Customize payment labels and icons for a professional touch. 
     95✔️ Stay updated with regular feature enhancements. 
    7096
    71 == Installation ==
     97== 🚨 Requirements to Install MemberPress Square ==
     98To get started with the MemberPress Square plugin, you’ll need the following: 
     99- An active MemberPress plugin installed on your WordPress site. 
     100- A valid Square account (or a Square Sandbox account for testing). 
     101- WordPress version 5.0 or higher. 
     102- PHP version 7.4 or higher. 
     103- SSL certification on your website to secure transactions. 
    72104
    73 = Minimum Requirements =
     105**NOTE:** Remember that Square is only available for businesses located in the U.S., Canada, U.K., Australia, Japan, Ireland, France, and Spain. 
    74106
    75 * PHP version 5.5 or greater (PHP 5.6 or greater is recommended)
    76 * MySQL version 5.4 or greater (MySQL 5.6 or greater is recommended)
    77 * Memberpress Plugin.
    78 * Square Account.
    79 * WordPress 4.4+
     107== Need Help? Get Expert Support on Demand!!! ==
     108Confused about setting up the MemberPress Square plugin or encountering issues? Our dedicated support team is here to assist you. From installation guidance to troubleshooting, we provide expert help to get you up and running quickly. 
     109
     110[Contact us today](https://objectsws.atlassian.net/servicedesk/customer/portal/22/group/48) and experience a hassle-free way to manage payments on your membership site. Let’s make your payment process simple and efficient. 
     111
     112== 🚀 Installation ==
     113
     1141. Upload the plugin files to the `/wp-content/plugins/memberpress-square` directory or install via the WordPress Plugins screen.
     1152. Activate the plugin through the 'Plugins' screen in WordPress.
     1163. Navigate to the MemberPress settings and connect your Square account.
     1174. Configure your payment options and test using the Square Sandbox.
     1185. Start accepting payments!
    80119
    81120== Frequently Asked Questions ==
    82121
    83 == Screenshots ==
     122 = What is the MemberPress Square plugin? = 
     123It integrates Square payments with MemberPress to manage one-time and recurring payments.
    84124
    85 == Upgrade Notice ==
     125 = Does it support recurring payments? = 
     126Yes, recurring payments for memberships are supported.
     127
     128 = How do I process refunds? = 
     129Refunds can be processed directly from the MemberPress dashboard.
     130
     131 = Can I use Google Pay and Apple Pay? =   
     132Yes, both payment methods are supported.
     133
     134 = What is Square Sandbox? = 
     135A testing environment for simulating transactions and verifying payment setup.
     136
     137 = Can I integrate multiple memberships? = 
     138Yes, you can connect multiple membership plans to a single Square account.
     139
     140 = Does the plugin support ACH payments? = 
     141Yes, ACH payments are supported.
     142
     143 = Are Afterpay and Cash App available? =   
     144Yes, both payment methods are supported.
     145
     146 = How do I get support for setup issues? =   
     147[Click here](https://objectsws.atlassian.net/servicedesk/customer/portal/22/group/48) to contact our support team for expert assistance.
    86148
    87149== Changelog ==
     150
     151= 1.1 - Dec 27, 2024 =
     152* New – Tested compatibility with WordPress Version 6.7.1.
     153* New – Tested compatibility with PHP 8.X
     154* Improvement – Updated Settings UI
     155
    88156= 1.0  =
    89157* Intial Release.
     158
  • pay-with-square-in-memberpress/trunk/square-for-memberpress.php

    r2542540 r3213675  
    33  Plugin Name: Square For Memberpress
    44  Plugin URI: https://apiexperts.io/solutions/memberpress-square/
    5   Description: Memberpress integration with square Payment gateway
    6   Version: 1.0
    7   Author: wpexpertsio
    8   Author URI: https://apiexperts.io/solutions/memberpress-square/
     5  Description: Lite version of Memberpress Square integration for simple payments. For more advanced features like subscription and refund management <a href="https://apiexperts.io/solutions/memberpress-square/?utm_source=plugin&utm_medium=side_menu">Get Pro</a>
     6  Version: 1.1
     7  Author: wpexperts.io
     8  Author URI: http://wpexperts.io/ 
     9  Requires Plugins: memberpress
     10  Requires PHP: 7.2
    911  Text Domain: square-for-memberpress
    1012 */
     
    120122}
    121123add_action( 'admin_enqueue_scripts', 'mepr_free_enqueue_selectively_enqueue_admin_script');
     124
     125add_action('admin_menu', 'mepr_square_free_custom_menus');
     126function mepr_square_free_custom_menus()
     127{
     128    add_menu_page('Square For Memberpress', 'Square For Memberpress', 'manage_options', get_admin_url() . 'admin.php?page=memberpress-options#mepr-integration');
     129    /* Connect */
     130    add_submenu_page(get_admin_url() . 'admin.php?page=memberpress-options#mepr-integration', 'Memberpress Square Free', 'Add Payment Method', 'manage_options', get_admin_url() . 'admin.php?page=memberpress-options#mepr-integration');
     131    /* Support */
     132    add_submenu_page(get_admin_url() . 'admin.php?page=memberpress-options#mepr-integration', __('Support', 'memberpress-square-free'), __('Support', 'memberpress-square-free'), 'manage_options', 'https://objectsws.atlassian.net/servicedesk/customer/portal/22/group/48/create/208');
     133    /* Technical Documentation */
     134    add_submenu_page(get_admin_url() . 'admin.php?page=memberpress-options#mepr-integration', __('Technical Documentation', 'memberpress-square-free'), __('Technical Documentation', 'memberpress-square'), 'manage_options', 'https://apiexperts.io/documentation/memberpress-with-square/');
     135    /* Contact Us */
     136    add_submenu_page(get_admin_url() . 'admin.php?page=memberpress-options#mepr-integration', __('Get Pro', 'memberpress-square-free'), '<span style="color: yellow; font-weight: bold;">' . __('Get Pro', 'memberpress-square-free') . '</span>', 'manage_options', 'https://apiexperts.io/solutions/memberpress-square/?utm_source=plugin&utm_medium=side_menu');
     137
     138}
Note: See TracChangeset for help on using the changeset viewer.