function wpestate_ajax_listing_pay()
 {
     global $current_user;
     $is_featured = intval($_POST['is_featured']);
     $prop_id = intval($_POST['propid']);
     $is_upgrade = intval($_POST['is_upgrade']);
     get_currentuserinfo();
     $userID = $current_user->ID;
     $post = get_post($prop_id);
     if ($post->post_author != $userID) {
         exit('get out of my cloud');
     }
     $paypal_status = esc_html(get_option('wp_estate_paypal_api', ''));
     $host = 'https://api.sandbox.paypal.com';
     $price_submission = floatval(get_option('wp_estate_price_submission', ''));
     $price_featured_submission = floatval(get_option('wp_estate_price_featured_submission', ''));
     $submission_curency_status = esc_html(get_option('wp_estate_submission_curency', ''));
     $pay_description = esc_html__('Listing payment on ', 'wpestate') . esc_html(home_url());
     if ($is_featured == 0) {
         $total_price = number_format($price_submission, 2, '.', '');
     } else {
         $total_price = $price_submission + $price_featured_submission;
         $total_price = number_format($total_price, 2, '.', '');
     }
     if ($is_upgrade == 1) {
         $total_price = number_format($price_featured_submission, 2, '.', '');
         $pay_description = esc_html__('Upgrade to featured listing on ', 'wpestate') . esc_html(home_url());
     }
     if ($paypal_status == 'live') {
         $host = 'https://api.paypal.com';
     }
     $url = $host . '/v1/oauth2/token';
     $postArgs = 'grant_type=client_credentials';
     $token = wpestate_get_access_token($url, $postArgs);
     $url = $host . '/v1/payments/payment';
     $dash_link = wpestate_get_dashboard_link();
     $processor_link = wpestate_get_procesor_link();
     $payment = array('intent' => 'sale', "redirect_urls" => array("return_url" => $processor_link, "cancel_url" => $dash_link), 'payer' => array("payment_method" => "paypal"));
     $payment['transactions'][0] = array('amount' => array('total' => $total_price, 'currency' => $submission_curency_status, 'details' => array('subtotal' => $total_price, 'tax' => '0.00', 'shipping' => '0.00')), 'description' => $pay_description);
     // prepare individual items
     if ($is_upgrade == 1) {
         $payment['transactions'][0]['item_list']['items'][] = array('quantity' => '1', 'name' => esc_html__('Upgrade to Featured Listing', 'wpestate'), 'price' => $total_price, 'currency' => $submission_curency_status, 'sku' => 'Upgrade Featured Listing');
     } else {
         if ($is_featured == 0) {
             $payment['transactions'][0]['item_list']['items'][] = array('quantity' => '1', 'name' => esc_html__('Listing Payment', 'wpestate'), 'price' => $total_price, 'currency' => $submission_curency_status, 'sku' => 'Paid Listing');
         } else {
             $payment['transactions'][0]['item_list']['items'][] = array('quantity' => '1', 'name' => esc_html__('Listing Payment with Featured option', 'wpestate'), 'price' => $total_price, 'currency' => $submission_curency_status, 'sku' => 'Featured Paid Listing');
         }
         // end is featured
     }
     // end is upgrade
     $json = json_encode($payment);
     $json_resp = wpestate_make_post_call($url, $json, $token);
     foreach ($json_resp['links'] as $link) {
         if ($link['rel'] == 'execute') {
             $payment_execute_url = $link['href'];
             $payment_execute_method = $link['method'];
         } else {
             if ($link['rel'] == 'approval_url') {
                 $payment_approval_url = $link['href'];
                 $payment_approval_method = $link['method'];
             }
         }
     }
     $executor['paypal_execute'] = $payment_execute_url;
     $executor['paypal_token'] = $token;
     $executor['listing_id'] = $prop_id;
     $executor['is_featured'] = $is_featured;
     $executor['is_upgrade'] = $is_upgrade;
     $save_data[$current_user->ID] = $executor;
     update_option('paypal_transfer', $save_data);
     print $payment_approval_url;
     die;
 }
if (!is_user_logged_in()) {
    wp_redirect(esc_html(home_url()));
}
global $current_user;
global $user_login;
get_currentuserinfo();
$userID = $current_user->ID;
$user_login = $current_user->user_login;
$user_pack = get_the_author_meta('package_id', $userID);
$user_registered = get_the_author_meta('user_registered', $userID);
$user_package_activation = get_the_author_meta('package_activation', $userID);
$paid_submission_status = esc_html(get_option('wp_estate_paid_submission', ''));
$price_submission = floatval(get_option('wp_estate_price_submission', ''));
$submission_curency_status = esc_html(get_option('wp_estate_submission_curency', ''));
$edit_link = wpestate_get_dasboard_edit_listing();
$processor_link = wpestate_get_procesor_link();
get_header();
$options = wpestate_page_details($post->ID);
?>
 
  
<div class="row is_dashboard">
    <?php 
if (wpestate_check_if_admin_page($post->ID)) {
    if (is_user_logged_in()) {
        get_template_part('templates/user_menu');
    }
}
?>
 
    <div class=" dashboard-margin">