public static function checkout($customer, $cart_info, $stripeToken)
 {
     $ufstore = UFStore::instance();
     $shipping_info = array();
     //Calculate new costs, all should be in pennies
     $cart_subtotal = UFStoreCart::getCartCost();
     $cart_shipping = $cart_info['shipping_cost'];
     $cart_total = $cart_subtotal + $cart_shipping;
     //!!!Doublecheck our new calculations match the AJAX response
     //Run the amount on stripe
     if (UFStoreCartCheckout::stripePayment($cart_total, $stripeToken)) {
         $cart = UFStoreCart::getCart();
         //Send email confirmation
         ob_start();
         // start output buffer
         include dirname(__FILE__) . '/../templates/email.php';
         $template = ob_get_contents();
         // get contents of buffer
         ob_end_clean();
         UFStoreCartCheckout::sendReceipt($customer['email'], $template);
         UFStoreCartCheckout::saveOrder($customer, $cart_info, $cart, $cart_subtotal, $cart_shipping, $cart_total);
         UFStoreCart::clearCart();
         return array('cart' => $cart, 'customer' => $customer);
     } else {
         return false;
     }
 }
function ufstoresuccess($atts)
{
    $ufstore = UFStore::instance();
    global $content;
    ob_start();
    $cart = UFStoreCart::getCart();
    $cart_total = UFStoreCart::getCartCost();
    if (file_exists(get_template_directory() . '/ufstore/success.php')) {
        include get_template_directory() . '/ufstore/success.php';
    } else {
        include dirname(__FILE__) . '/../templates/success.php';
    }
    //Empty the shopping cart
    $wp_session['cart'] = array();
    $output = ob_get_clean();
    return $output;
}
function cart_info()
{
    header('Content-Type: application/json');
    $ufstore = UFStore::instance();
    $info = array('cart_count' => UFStoreCart::getCartCount(), 'total_cost' => UFStoreCart::getCartCost());
    echo json_encode(array('cart_info' => $info));
    die;
}