Changeset 3213675
- Timestamp:
- 12/27/2024 08:47:40 AM (15 months ago)
- Location:
- pay-with-square-in-memberpress/trunk
- Files:
-
- 1 added
- 7 edited
-
MpFreeSquare.php (modified) (2 diffs)
-
assets/js/sq-webpack.js (added)
-
includes/MeprFreeSquareApi.php (modified) (1 diff)
-
includes/MeprFreeSquareCtrl.php (modified) (9 diffs)
-
includes/MeprFreeSquareGateway.php (modified) (7 diffs)
-
includes/views/square-admin-form.php (modified) (7 diffs)
-
readme.txt (modified) (1 diff)
-
square-for-memberpress.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pay-with-square-in-memberpress/trunk/MpFreeSquare.php
r2535273 r3213675 8 8 9 9 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')); 13 13 } 14 14 … … 18 18 * @return array 19 19 */ 20 21 public function mepr_free_add_square_gateway_path($paths) { 20 public function add_square_gateway_path($paths) { 22 21 array_push($paths, MEPR_FREE_SQUARE_PATH . 'includes'); 23 22 return $paths; 24 23 } 25 24 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 28 34 } 35 36 29 37 } 30 38 -
pay-with-square-in-memberpress/trunk/includes/MeprFreeSquareApi.php
r2535273 r3213675 5 5 public static function mepr_freeget_headers($api,$mode) { 6 6 $headers = array(); 7 $headers[] = 'Square-Version: 2019-11-20'; 7 8 8 $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 ); 14 17 } 18 15 19 return $headers; 16 20 } 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 } 18 65 public static function charge($request_params, $api, $method,$domain_url) { 19 66 20 $url = 'https://connect.' . $domain_url . '.com' .$api;67 $url = 'https://connect.' . $domain_url . '.com'; 21 68 $mode=($domain_url=='squareupsandbox'?'sandbox':"live"); 69 $headers = MeprFreeSquareApi::mepr_freeget_headers($api,$mode); 22 70 $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 24 72 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 ); 35 81 } 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 ) 45 89 ); 46 90 } 91 return json_decode($response['body']); 92 } 47 93 94 95 public static function renew_square_subscription () { 48 96 49 $request = wp_remote_post( $url, $args );97 } 50 98 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 }59 99 } 60 100 -
pay-with-square-in-memberpress/trunk/includes/MeprFreeSquareCtrl.php
r2535273 r3213675 8 8 9 9 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')); 14 14 } 15 15 … … 18 18 * 19 19 */ 20 public function mepr_free_get_square_codes() {21 20 public function get_square_codes() { 21 MeprFreeSquareApi::get_location(); 22 22 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'); 33 28 } 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 43 34 } else { 35 36 37 38 44 39 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'); 46 42 exit; 47 43 } … … 49 45 if (isset($_GET['success_revoke_token_sandbox'])) { 50 46 delete_option('mepr_free_square_access_token_sandbox'); 51 delete_option('mepr_free_square_app_id_sandbox');52 47 wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration'); 53 48 exit; … … 55 50 if (isset($_GET['success_revoke_token'])) { 56 51 delete_option('mepr_free_square_access_token'); 57 delete_option('mepr_free_square_app_id');58 52 wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration'); 59 53 exit; 60 54 } 61 55 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'); 64 62 wp_redirect(admin_url('admin.php') . '?page=memberpress-options#mepr-integration'); 65 63 exit; 66 64 } 67 65 } 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 again76 $this->mepr_free_sanitize_array($value);77 }78 }79 return $values;80 }81 82 66 83 67 /** 84 68 * Add notice to admin if failed to get square tokens 85 69 */ 86 public function mepr_free_failed_to_get_tokens() {70 public function failed_to_get_tokens() { 87 71 if (isset($_GET['mepr-square-error'])) { 88 72 $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'); 90 74 printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), esc_html($message)); 91 75 } 92 76 } 77 93 78 /** 94 79 * renew square access token 95 80 */ 96 public function mepr_free_get_access_token_memsquare_renewed() {81 public function get_access_token_memsquare_renewed() { 97 82 if(get_option('mepr_free_square_access_token')){ 98 83 $meprSquare_auth_response = get_option('mepr_free_square_response_body'); 84 85 99 86 if( 100 87 !empty($meprSquare_auth_response) … … 128 115 $oauth_response = wp_remote_post( $oauth_connect_url, $args_renew ); 129 116 $decoded_oauth_response = json_decode( wp_remote_retrieve_body( $oauth_response ) ); 130 117 118 119 131 120 if(!empty($decoded_oauth_response->access_token)){ 132 121 $meprSquare_auth_response['expires_at'] = $decoded_oauth_response->expires_at; … … 135 124 update_option('mepr_free_square_response_body',$meprSquare_auth_response); 136 125 update_option('mepr_free_square_access_token',$meprSquare_auth_response['access_token']); 126 137 127 } 138 128 } 139 129 } 140 130 131 141 132 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) 145 137 and 146 (strtotime($mepr_ square_response_body_sandbox['expires_at']) - 300) <= time()138 (strtotime($mepr_free_square_response_body_sandbox['expires_at']) - 300) <= time() 147 139 ){ 148 140 $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 header141 'refresh_token' => $mepr_free_square_response_body_sandbox['refresh_token'], // Use verbose mode in cURL to determine the format you want for this header 150 142 'Content-Type' => 'application/json;' 151 143 ); 152 $oauth_connect_url = MEPR_ FREE_SQUARE_CONNECTURL;144 $oauth_connect_url = MEPR_SQUARE_CONNECTURL; 153 145 $redirect_url = add_query_arg( 154 146 array( … … 173 165 $decoded_oauth_response = json_decode( wp_remote_retrieve_body( $oauth_response ) ); 174 166 167 168 175 169 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']); 181 175 182 176 } … … 185 179 } 186 180 187 public function mepr_free_disconnect_deleted_methods($params) {181 public function disconnect_deleted_methods($params) { 188 182 $mepr_options = MeprOptions::fetch(); 189 183 // Bail early if no payment methods have been deleted … … 198 192 $integ = $mepr_options->integrations[$method_id]; 199 193 200 if ($integ['gateway'] === 'Mepr FreeSquareGateway' && get_option('mepr_free_square_access_token')) {194 if ($integ['gateway'] === 'MeprSquareGateway' && get_option('mepr_free_square_access_token')) { 201 195 delete_option('mepr_free_square_access_token'); 202 196 delete_option('mepr_free_square_refresh_token'); -
pay-with-square-in-memberpress/trunk/includes/MeprFreeSquareGateway.php
r2535273 r3213675 27 27 public function load($settings) { 28 28 $this->settings = (object) $settings; 29 $this->key = 'Square'; 29 30 $this->set_defaults(); 30 31 } … … 72 73 $this->use_desc = $this->settings->use_desc; 73 74 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'; 77 77 update_option( 'mepr_free_square_mode', 'squareupsandbox' ); 78 78 79 79 } else { 80 81 $this->settings->app_id = get_option('mepr_free_square_app_id'); 80 $this->settings->app_id = 'sq0idp-kiNKM9TUUhQctgLBJNgPKQ'; 82 81 $this->settings->domain_url = 'squareup'; 83 82 update_option( 'mepr_free_square_mode', 'squareup'); … … 91 90 */ 92 91 93 public function process_payment($txn) { 92 public function process_payment($txn) { 93 94 95 94 96 if (isset($txn) && $txn instanceof MeprTransaction) { 95 97 $usr = new MeprUser($txn->user_id); 96 98 $prd = new MeprProduct($txn->product_id); 99 // $sub->subscr_id = $_POST['subscr_id']; 97 100 } 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')); 99 102 } 100 103 $mepr_options = MeprOptions::fetch(); 101 104 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'] : ''; 105 108 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')); 107 110 } 108 111 $idempotency_key = uniqid(); 109 112 $fields = array( 110 113 "idempotency_key" => $idempotency_key, 114 //"location_id" => MEPR_SQUARE_LOCATION_ID, 111 115 "autocomplete" => true, 112 116 "amount_money" => array( 113 "amount" => ( (int) round( $txn->total *100, 2 ) ), 117 "amount" => ( (int) round( $txn->total *100, 2 ) ), //(float) $txn->total * 100, 114 118 "currency" => $mepr_options->currency_code 115 119 ), … … 120 124 ) 121 125 ); 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); 123 127 if (isset($response->payment->status) && $response->payment->status == 'COMPLETED') { 124 128 $txn->trans_num = $response->payment->id; … … 139 143 $txn->store(); 140 144 MeprUtils::send_transaction_receipt_notices($txn); 141 }145 } 142 146 143 147 public function record_payment() { … … 217 221 218 222 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 } 219 231 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( 222 235 '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'), 223 239 )); 224 240 225 241 wp_enqueue_style('mempr-free-square-payment-form-css', MEPR_FREE_SQUARE_URL . 'assets/css/sq-payment-form.css'); 242 243 226 244 } 227 245 228 246 public function display_payment_form($amount, $user, $product_id, $transaction_id) { 229 247 230 $mepr_options = MeprOptions::fetch();248 $mepr_options = MeprOptions::fetch(); 231 249 $prd = new MeprProduct($product_id); 232 250 $coupon = false; 233 251 $txn = new MeprTransaction($transaction_id); 234 $prd_mode = $txn->product();235 236 237 252 //Artifically set the price of the $prd in case a coupon was used 238 253 if ($prd->price != $amount) { … … 244 259 echo $invoice; 245 260 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 ?> 247 270 <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 267 284 } 268 285 -
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> 1 79 2 80 3 81 <div class="wrap"> 4 <div class="welcome-panel ">82 <div class="welcome-panels"> 5 83 <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 7 87 <?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, 12 92 'is_sandbox' => 'yes' , 13 93 'request' => 'request_token', … … 17 97 $production_connect_url = add_query_arg( 18 98 array( 19 'app_name' => MEPR_FREE_SQUARE_APPNAME,99 'app_name' => $this->settings->app_id, 20 100 'is_sandbox' => 'no' , 21 101 'request' => 'request_token', … … 23 103 ), MEPR_FREE_SQUARE_CONNECTURL 24 104 ); 105 25 106 $sandbox_disconnect_url = add_query_arg( 26 107 array( 27 108 'access_token' => get_option('mepr_free_square_access_token_sandbox'), 28 109 '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, 30 111 'is_sandbox' => 'yes' , 31 112 'request' => 'revoke_token', … … 43 124 ), MEPR_FREE_SQUARE_CONNECTURL 44 125 ); 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 45 149 // ?> 46 150 … … 48 152 <tbody> 49 153 <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> 53 156 </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 } ?> 55 212 <tr valign="top"> 56 213 <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> 59 216 </th> 60 217 … … 69 226 <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" /> 70 227 </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 { ?> 74 232 <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 } 78 237 79 238 ?> … … 87 246 <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" /> 88 247 </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 { ?> 92 252 <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 } ?> 96 257 </td> 97 </tr> 258 259 260 </tr> 98 261 99 262 </tbody> -
pay-with-square-in-memberpress/trunk/readme.txt
r2729327 r3213675 1 === Pay with Squarein MemberPress ===1 === MemberPress Square — Accept Square Payments in MemberPress === 2 2 Contributors: wpexpertsio 3 Tags: MemberPress, Payments, Square, Membership, subscription3 Tags: MemberPress, Square Payments, Subscription, Recurring Payments, Digital Wallets 4 4 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=pay@objects.ws&item_name=DonationForPlugin 5 5 Requires at least: 4.8 6 6 Requires PHP: 7.0 7 Tested up to: 6.08 Stable tag: 1. 07 Tested up to: 5.7.1 8 Stable tag: 1.1 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html 11 11 12 Want to integrate Square payments in Memberpress for your wordpress site? Install Memberpress Square plugin to accept Square Payments and create subscriptions. 13 12 14 == Description == 15 **MemberPress Square — Integrate Square Payments and create subscriptions in MemberPress WordPress Plugin** 13 16 14 **Collect one-time payments on your membership website using MemberPress Square.** 17 Are you looking for a reliable way to accept Square payments in MemberPress for your membership website? 18 All you need is to install the [✨MemberPress Square WordPress Plugin ✨](https://apiexperts.io/solutions/memberpress-square/) 15 19 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. 20 This 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. 17 21 18 **Why choose MemberPress?** 22 With **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. 19 23 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.24 Read on to learn how MemberPress Square can transform your payment experience. 21 25 22 **Why choose Square?** 26 == Key Features That Make MemberPress Square Unique == 27 The MemberPress Square plugin is loaded with features designed to simplify payment processing and membership management. Here's what sets it apart: 23 28 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** 30 Easily accept one-time payments for memberships. Offer a hassle-free, secure checkout experience to enhance user satisfaction and boost conversions. 25 31 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]** 33 Enable 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. 27 34 28 == MemberPress Square Features == 35 ✅ **Digital Wallets Integration [Pro]** 36 Offer 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. 29 37 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]** 39 Expand 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. 35 40 41 ✅ **Square Sandbox and Live Integration** 42 Test 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. 36 43 37 == MemberPress Square Requirements == 38 * [MemberPress Plugin](https://memberpress.com/plans/pricing/). 39 * [Square Account](https://squareup.com/). 44 ✅ **Process Refunds Effortlessly [Pro]** 45 Refund any transaction directly from the MemberPress dashboard. This feature gives you full control over refunds and eliminates the need to log into external platforms. 40 46 41 == DOCUMENTATION == 47 ✅ **Multi-Membership Connection** 48 Link multiple memberships to your Square account. Whether you’re running tiered plans or offering diverse access levels, this feature simplifies payment management. 42 49 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** 51 Get 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. 44 52 53 ✅ **Support for Square API** 54 Built 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. 45 55 46 == MemberPress Square Pro == 56 ✅ **Shortcode Integration for Membership Pages** 57 Utilize MemberPress shortcodes, such as the MemberPress account shortcode and the MemberPress upsell shortcodes, to enhance user experience and boost conversions. 47 58 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 == 60 The 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: 49 61 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. 52 68 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. 54 75 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. 67 82 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. 69 89 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. 70 96 71 == Installation == 97 == 🚨 Requirements to Install MemberPress Square == 98 To 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. 72 104 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. 74 106 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!!! == 108 Confused 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 114 1. Upload the plugin files to the `/wp-content/plugins/memberpress-square` directory or install via the WordPress Plugins screen. 115 2. Activate the plugin through the 'Plugins' screen in WordPress. 116 3. Navigate to the MemberPress settings and connect your Square account. 117 4. Configure your payment options and test using the Square Sandbox. 118 5. Start accepting payments! 80 119 81 120 == Frequently Asked Questions == 82 121 83 == Screenshots == 122 = What is the MemberPress Square plugin? = 123 It integrates Square payments with MemberPress to manage one-time and recurring payments. 84 124 85 == Upgrade Notice == 125 = Does it support recurring payments? = 126 Yes, recurring payments for memberships are supported. 127 128 = How do I process refunds? = 129 Refunds can be processed directly from the MemberPress dashboard. 130 131 = Can I use Google Pay and Apple Pay? = 132 Yes, both payment methods are supported. 133 134 = What is Square Sandbox? = 135 A testing environment for simulating transactions and verifying payment setup. 136 137 = Can I integrate multiple memberships? = 138 Yes, you can connect multiple membership plans to a single Square account. 139 140 = Does the plugin support ACH payments? = 141 Yes, ACH payments are supported. 142 143 = Are Afterpay and Cash App available? = 144 Yes, 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. 86 148 87 149 == 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 88 156 = 1.0 = 89 157 * Intial Release. 158 -
pay-with-square-in-memberpress/trunk/square-for-memberpress.php
r2542540 r3213675 3 3 Plugin Name: Square For Memberpress 4 4 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 9 11 Text Domain: square-for-memberpress 10 12 */ … … 120 122 } 121 123 add_action( 'admin_enqueue_scripts', 'mepr_free_enqueue_selectively_enqueue_admin_script'); 124 125 add_action('admin_menu', 'mepr_square_free_custom_menus'); 126 function 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.