#dtfk
1 messages · Page 1 of 1 (latest)
Hi there, Tokens cannot be stored or used more than once. See https://stripe.com/docs/api/tokens?lang=go#tokens for details
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
please see this one
Here you are attaching a source (not token) to a customer to create a reusable payment method.
so source is not a token?
no, they are different
can u plz explain me
because source says 'source' => 'tok_mastercard',
u there?
??
Thanks for waiting, discord is busy today.
So you want o know the different between tokens and sources?
yes
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
but here we are not using mastercard token
$customer = \Stripe\Customer::create([
'source' => 'tok_mastercard',
'email' => 'paying.user@example.com',
]);
What's your question/doubt? I see you are using tok_mastercard in this request.
Yes it's a token
so in this doc they are using token only
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,
Yes you are right, and you need to use source, not token, to create future charges.
u mean like this
$charge = \Stripe\Charge::create([
'amount' => 1500, // $15.00 this time
'currency' => 'usd',
'customer' => $customer_id, // Previously stored, then retrieved
]);
Yes, if the customer doesn't have a default_source, you also need to specify a source (https://stripe.com/docs/api/charges/create?lang=node#create_charge-source) when creating a charge
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
in the source we can provide card token
Yes you can.
ok
one thing more
if u see this doc
it is using legacy api
can we do all those methods using Payment Intent API
Yes you can. In fact I'll recommend you to use PaymentIntent API unless you are maintaining a legacy application.
so i was going to do as below using Payment Intent api
So using Payment Intent api we can
- Create card token
- Create customer with that token
- Create Charge using customer id
We don't use token with PaymentIntent APIs anymore.
then what should we use?
https://stripe.com/docs/payments/save-and-reuse?platform=web you should use this doc to get started
Actually earlier I connected with another stripe dev & he mentioned that we can use
So using Payment Intent api we can
- Create card token
- Create customer with that token
- Create Charge using customer id
Now i m consfused 😫
I don't have the details of you previous discussion, but if you are using old API and plan to upgrade, your can refer to this migration guide https://stripe.com/docs/payments/payment-intents/migration