diff --git a/charges.go b/charges.go index 544fa1d291..a0b12bad21 100644 --- a/charges.go +++ b/charges.go @@ -233,7 +233,11 @@ func (c *ChargeClient) Create(params *ChargeParams) (*Charge, error) { } else if len(params.Token) > 0 { body.Add("card", params.Token) } else if params.Card != nil { - params.Card.appendTo(body, true) + if len(params.Card.Token) > 0 { + body.Add("card", params.Card.Token) + } else { + params.Card.appendTo(body, true) + } } else { err := errors.New("Invalid charge params: either customer, card token or card need to be set") return nil, err diff --git a/customers.go b/customers.go index 65f855ff86..6b7fa3d3ef 100644 --- a/customers.go +++ b/customers.go @@ -134,7 +134,11 @@ func (c *CustomerClient) Update(id string, params *CustomerParams) (*Customer, e if len(params.Token) > 0 { body.Add("card", params.Token) } else if params.Card != nil { - params.Card.appendTo(body, true) + if len(params.Card.Token) > 0 { + body.Add("card", params.Card.Token) + } else { + params.Card.appendTo(body, true) + } } if len(params.Desc) > 0 { diff --git a/subscriptions.go b/subscriptions.go index e0e2919fb8..511383fcd1 100644 --- a/subscriptions.go +++ b/subscriptions.go @@ -143,7 +143,11 @@ func (c *SubscriptionClient) Update(id string, params *SubParams) (*Subscription if len(params.Token) > 0 { body.Add("card", params.Token) } else if params.Card != nil { - params.Card.appendTo(body, true) + if len(params.Card.Token) > 0 { + body.Add("card", params.Card.Token) + } else { + params.Card.appendTo(body, true) + } } if len(params.Coupon) > 0 {