#dtfk

1 messages · Page 1 of 1 (latest)

keen marshBOT
errant obsidian
dusty raven
#

please see this one

errant obsidian
#

Here you are attaching a source (not token) to a customer to create a reusable payment method.

dusty raven
#

so source is not a token?

errant obsidian
#

no, they are different

dusty raven
#

can u plz explain me

#

because source says 'source' => 'tok_mastercard',

#

u there?

#

??

errant obsidian
#

Thanks for waiting, discord is busy today.

#

So you want o know the different between tokens and sources?

dusty raven
#

yes

errant obsidian
#

The token presents sensitive information that Stripe collected (i.e., credit card number, bank account), and your application can use tokens without worrying about PCI compliance.

#

The sources presents payment instruments like cards, ACH direct debit and etc

dusty raven
#

but here we are not using mastercard token

#

$customer = \Stripe\Customer::create([
'source' => 'tok_mastercard',
'email' => 'paying.user@example.com',
]);

errant obsidian
#

What's your question/doubt? I see you are using tok_mastercard in this request.

dusty raven
#

tok mastercard is token ?

#

right?

errant obsidian
#

Yes it's a token

dusty raven
#

so in this doc they are using token only

errant obsidian
#

Ok, I know where the confusion is now.

#

You can pass a token to the customer creation API, what happen under the hood is that Stripe will use this token to create a source, and attach it to customer,

dusty raven
#

and then we can use customer id & can create charge call multiple times

#

correct?

errant obsidian
#

Yes you are right, and you need to use source, not token, to create future charges.

dusty raven
#

u mean like this

#

$charge = \Stripe\Charge::create([
'amount' => 1500, // $15.00 this time
'currency' => 'usd',
'customer' => $customer_id, // Previously stored, then retrieved
]);

errant obsidian
dusty raven
#

in the source we can provide card token

errant obsidian
#

Yes you can.

dusty raven
#

ok

#

one thing more

#

if u see this doc

#

it is using legacy api

#

can we do all those methods using Payment Intent API

errant obsidian
#

Yes you can. In fact I'll recommend you to use PaymentIntent API unless you are maintaining a legacy application.

dusty raven
#

so i was going to do as below using Payment Intent api

#

So using Payment Intent api we can

  1. Create card token
  2. Create customer with that token
  3. Create Charge using customer id
errant obsidian
#

We don't use token with PaymentIntent APIs anymore.

dusty raven
#

then what should we use?

errant obsidian
dusty raven
#

Actually earlier I connected with another stripe dev & he mentioned that we can use
So using Payment Intent api we can

  1. Create card token
  2. Create customer with that token
  3. Create Charge using customer id
#

Now i m consfused 😫

errant obsidian