Skip to content

Commit

Permalink
tokens: Add token creation for connect accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonycastelli committed Jun 7, 2017
1 parent 3990261 commit fac46dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/API/Routes/TokenRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Token> {
public func createToken(withCustomerId customerId: String, onAccount account: String? = nil) throws -> StripeRequest<Token> {
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)
}

/**
Expand Down

0 comments on commit fac46dd

Please sign in to comment.