   #
   cancelSubscription: (customerId) ->
     console.log 'Canceling subscription for', customerId
-    user = BillingUser.first('profile.customerId': customerId)
+    user = BillingUser.first('billing.customerId': customerId)
     unless user then new Meteor.Error 404, "User not found.  Subscription cannot be canceled."
 
     Stripe = StripeAPI(Billing.settings.secretKey)

    try
      customer = create email: user.emails[0].address, card: card.id
      Meteor.users.update _id: user._id,
        $set: 'profile.customerId': customer.id, 'profile.cardId': customer.default_card
    catch e
      console.error e
      throw new Meteor.Error 500, e.message

  #
  subscriptionDeleted: (customerId) ->
    console.log 'Subscription deleted for', customerId
    user = BillingUser.first('billing.customerId': customerId)
    unless user then new Meteor.Error 404, "User not found.  Subscription cannot be deleted."
    
    user.update('billing.subscriptionId': null)

    Stripe = StripeAPI(Billing.settings.secretKey)
    deleteCard = Async.wrap Stripe.customers, 'deleteCard'
    try
      deleteCard user.billing.customerId, user.billing.cardId
      user.update('billing.cardId': null)
    catch e
      console.error e
      throw new Meteor.Error 500, e.message
