diff --git a/Sources/API/Routes/TokenRoutes.swift b/Sources/API/Routes/TokenRoutes.swift index c8321d7..a939e34 100644 --- a/Sources/API/Routes/TokenRoutes.swift +++ b/Sources/API/Routes/TokenRoutes.swift @@ -156,9 +156,15 @@ public final class TokenRoutes { - returns: A StripeRequest<> item which you can then use to convert to the corresponding node */ - public func createToken(withCustomerId customerId: String) throws -> StripeRequest { + public func createToken(withCustomerId customerId: String, onAccount account: String? = nil) throws -> StripeRequest { let body = try Node(node: ["customer": customerId]) - return try StripeRequest(client: self.client, method: .post, route: .tokens, body: Body.data(body.formURLEncoded())) + var headers: [HeaderKey : String]? + if let account = account { + headers = [ + StripeHeader.Account: account + ] + } + return try StripeRequest(client: self.client, method: .post, route: .tokens, body: Body.data(body.formURLEncoded()), headers: headers) } /**