 
         let node = try request.json().node.add(name: "customer_id", node: customer.id)
         var sub = try Subscription(node: node)
+        try sub.save()
 
         guard let address = try sub.address().get(), try address.customer_id == request.customer().id else {
             throw Abort.custom(status: .forbidden, message: "Logged in user does not own shipping address.")

import HTTP
import Stripe
import Fluent

final class SubscriptionController: ResourceRepresentable {
    

            throw Abort.custom(status: .badRequest, message: "User must have stripe id to subscribe to box.")
        }

        guard let vendor = try box.vendor().first() else {
            throw Abort.custom(status: .internalServerError, message: "Could not find box's vendor.")
        }

        let subscription = try Stripe.shared.subscribe(user: stripe_id, to: plan_id, oneTime: false, metadata: createMetadataArray(fromModels: [address, customer, vendor, sub]))
        sub.sub_id = subscription.id
        
        try sub.save()
