Stripe.createCard()

Create a new card for a customer

Creating a new credit card will not change the card owner's existing default credit card; you should update the customer or recipient with a new default_card for that. If the card's owner has no default credit card, the added credit card will become the default. Whenever you create a new card for a customer, Stripe will automatically validate the card.

Usage

Hover over inputs/exits for more info.

var Stripe = require('machinepack-stripe-subscriptions');


// Create a new card for a customer

Stripe.createCard({

apiKey: 'somestring837483749blah',

token: 'tok_someCardIdjsd2isnsd',

customer: 'cus_4kmLwU2PvQBeqq',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (newCard) {

 

},

});

Inputs

apiKey required

Your Stripe API key

'somestring837483749blah'
token required

The Stripe token for the card, as returned by the Stripe.js SDK

'tok_someCardIdjsd2isnsd'
customer required

The Stripe id of the customer who this card belongs to

'cus_4kmLwU2PvQBeqq'

Exits

error

An unexpected error occurred.

success

OK.

{ id: 'card_14Ye1j2eZvKYlo2CJOPrAfPP',
  object: 'card',
  last4: '4242',
  brand: 'Visa',
  funding: 'credit',
  exp_month: 12,
  exp_year: 2016,
  fingerprint: 'Xt5EWLLDS7FJjR1c',
  country: 'US',
  name: null,
  address_line1: null,
  address_line2: null,
  address_city: null,
  address_state: null,
  address_zip: null,
  address_country: null,
  cvc_check: 'pass',
  address_line1_check: null,
  address_zip_check: null,
  customer: 'cus_4i4AvLpWDpiivV' }