$response['ACK'] = 'SUCCESS';
     // Forcing success since DoExpressCheckout wasn't called
 }
 $ack = strtoupper($response['ACK']);
 if ('SUCCESS' == $ack || 'SUCCESSWITHWARNING' == $ack) {
     // Wait to make sure the transaction is a success before creating the account
     if ($createAccount) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Creating account after successful PayPal transaction");
         $account->save();
     }
     // Create Recurring Payment Profile if a subscription has been sold
     $profileResponse = array('ACK' => 'SKIPPED');
     if ($cartItem = Cart66Session::get('Cart66Cart')->getPayPalSubscriptionItem()) {
         $planIndex = Cart66Session::get('Cart66Cart')->getPayPalSubscriptionIndex();
         $plan = new Cart66PayPalSubscription($cartItem->getPayPalSubscriptionId());
         $profileResponse = $pp->CreateRecurringPaymentsProfile($token, $cartItem, $planIndex);
         if ('FAILURE' != strtoupper($profileResponse['ACK'])) {
             $paypalPaymentProfileId = $profileResponse['PROFILEID'];
             if (Cart66Common::isLoggedIn() && $account->isPayPalAccount()) {
                 // Expire the current subscription and attach a new subscription
                 $account->cancelSubscription('Your subscription has been canceled because you changed to a new subscription.', true);
             }
             $activeUntil = $plan->getStartTimeFormula();
             $account->attachPayPalSubscription($details, $paypalPaymentProfileId, $plan, $activeUntil);
         }
     } elseif ($cartItem = Cart66Session::get('Cart66Cart')->getMembershipProductItem()) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Got membership product from the cart after a PayPal transaction.");
         $product = new Cart66Product($cartItem->getProductId());
         $account->attachMembershipProduct($product, $details['FIRSTNAME'], $details['LASTNAME']);
     }
     // Save the order