Add a new payment source to a customer.
A payment source can be a credit/debit card or a bank account. Creating a new source will not change the customer's existing default source; you should update the customer or recipient with a new "Default source" for that. If the customer has no default source, the added source will become the default. Whenever you create a new card source for a customer, Stripe will automatically validate the card.
var Stripe = require('machinepack-stripe');
// Add a new payment source to a customer.
Stripe.createSource({
token: 'tok_somesourceIdjsd2isnsd',
customer: 'cus_4kmLwU2PvQBeqq',
: ,
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// OK.
success: function (result) {
},
});
The Stripe token for the source, as returned by the Stripe.js SDK.
'tok_somesourceIdjsd2isnsd'
The Stripe ID of the customer who this source belongs to.
'cus_4kmLwU2PvQBeqq'
An unexpected error occurred.
OK.
{
id: 'ba_18k5KBAE8iIXJx4mnWV35Rnl',
object: 'bank_account or card or bitcoin_receiver',
address_city: '',
address_country: '',
address_line1: '',
address_line1_check: '',
address_line2: '',
address_state: '',
address_zip: '',
address_zip_check: '',
brand: 'Visa',
country: 'US',
customer: '',
cvc_check: '',
dynamic_last4: '',
exp_month: 8,
exp_year: 2017,
funding: 'credit',
last4: '4242',
name: '',
tokenization_method: '',
account: 'acct_18epKhAE8iIXJx4m',
account_holder_name: 'Jane Austen',
account_holder_type: 'individual',
bank_name: 'STRIPE TEST BANK',
currency: 'usd',
default_for_currency: false,
fingerprint: 'rNUOheo5Mxi8lCO6',
routing_number: '110000000',
status: 'new',
active: false,
amount: 100,
amount_received: 0,
bitcoin_amount: 1757908,
bitcoin_amount_received: 0,
bitcoin_uri: 'bitcoin:test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1?amount=0.01757908',
created: 1471583627,
description: 'Receiver for John Doe',
email: '[email protected]',
filled: false,
inbound_address: 'test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1',
livemode: false,
metadata: {},
refund_address: '',
uncaptured_funds: false,
used_for_payment: false
}