$tax = 0;
 $isTaxed = $taxRate->loadByState('All Sales');
 if ($isTaxed) {
     $taxable = Cart66Session::get('Cart66Cart')->getTaxableAmount($taxRate->tax_shipping);
     $tax = number_format($taxable * ($taxRate->rate / 100), 2, '.', '');
     if ($tax == 0) {
         $tax = Cart66Session::get('Cart66Cart')->getTax('All Sales');
     }
     if ($tax > 0) {
         $total = $total + $tax;
     }
 }
 // Set payment information
 $payment = array('AMT' => $total, 'TAXAMT' => $tax, 'CURRENCYCODE' => CURRENCY_CODE, 'ITEMAMT' => $itemTotal, 'SHIPPINGAMT' => $shipping, 'NOTIFYURL' => $ipnUrl);
 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Setting Payment Details:\n" . print_r($payment, true));
 $pp->setPaymentDetails($payment);
 // Add cart items to PayPal
 $pp->populatePayPalCartItems();
 // Set Express Checkout URLs
 $returnPage = get_page_by_path('store/express');
 $returnUrl = get_permalink($returnPage->ID);
 $cancelPage = get_page_by_path('store/checkout');
 $cancelUrl = get_permalink($cancelPage->ID);
 $localeCode = Cart66Common::getLocaleCode();
 $ecUrls = array('RETURNURL' => $returnUrl, 'CANCELURL' => $cancelUrl, 'LOCALECODE' => $localeCode);
 $pp->setEcUrls($ecUrls);
 $response = $pp->SetExpressCheckout();
 $ack = strtoupper($response['ACK']);
 if ('SUCCESS' == $ack || 'SUCCESSWITHWARNING' == $ack) {
     Cart66Session::set('PayPalProToken', $response['TOKEN']);
     $expressCheckoutUrl = $pp->getExpressCheckoutUrl($response['TOKEN']);