#dtfk - card tokens
1 messages ยท Page 1 of 1 (latest)
If you're referring to this Card Token: https://stripe.com/docs/api/tokens/create_card
it looks like it can only be used once.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If there any multiuse token functionality available?
Yeah, we have the whole Payment Methods API and its functionality which does exactly that
But do these generate card token?
No, they create Payment Methods which can be used in place of Card Tokens
we want only token based
In that case you'll have to work with single-use Card Tokens as far as I can tell.
and if there's any workaround to use multiple times
lets say if we have token and it failed becayse the card has insufficient amount then we can tell the customer and he can fix his card
That would be a workflow where you'd have to create a new Card Token, since they cannot be updated once they're created.
If the Card Token is valid and not failing, you should be able to save it on the Customer object to use for subsequent payments, as described here: https://stripe.com/docs/saving-cards#saving-credit-card-details-for-later
so u mean we are charging by sending the customer id which already has token attached to it?
I'm not sure if you are or not. I'm just mentioning that it's an option for recurring charges. That won't really help you if the charge is failing though
Sorry, let me rephrase it
So right now we are charging on the basis of stripe token
the method u just shared is doing as below:
// Create a Customer:
$customer = \Stripe\Customer::create([
'source' => 'tok_mastercard',
'email' => 'paying.user@example.com',
]);
// Charge the Customer instead of the card:
$charge = \Stripe\Charge::create([
'amount' => 1000,
'currency' => 'usd',
'customer' => $customer->id,
]);
So using the above method we can do recurring charges?
I believe so, yes. Are you getting an error when testing?
No, I am just confirming from you
The above doc link says its legacy api
is there any updated version as well?
What do you mean by "updated version"? The whole API is legacy, so the docs are referencing that fact
i mean using the Payment Intent Api version is available?
Ah, I see. I believe this guide goes into more detail: https://stripe.com/docs/payments/payment-intents/migration
So using Payment Intent api we can
- Create card token
- Create customer with that token
- Create Charge using customer id
Is above flow correct?
u there??
No worries !!๐
suppose when we charge the customer using the customer id & it failed due to insufficent fund
can we re run the charge call later on the same customer id if the customer inform us the card is working now
Yes, I believe so. I was able to create a test charge that declined using our test token tok_visa_chargeDeclinedInsufficientFunds and it allowed me to try twice
u created the test charge on token or customer id?
On a Customer
using a test Card Token from here: https://stripe.com/docs/testing?testing-method=tokens#declined-payments
But what if we create a charge on token that was declined earlier due to insufficient funds
That's exactly what I did
That's exactly what I did. Is there a question there?
Hi ๐
It's really hard to understand what the current question is here. Can you restate?
Real quick, it's worth mentioning that if you ONLY create a Card Token and a Charge, then the Card Token can be used only once. If you instead create a Card Token and then attach it to a Customer, then it can be reused.
Anyway, snufkin will be able to help you from here, as I have to step away. Best of luck!
@turbid jacinth
one think we have already used a card token, can we attach it to customer id object & reuse it?
If a Card token has already been used it cannot be attached to a Customer
It is considered "consumed" at that point
if a card token is declined due to insufficient funds, will it be consider as used?
Has this occurred? Have you tested this?
You should be able to retrieve the Token object and examine the used property: https://stripe.com/docs/api/tokens/object#token_object-used
Correct
That lets you know the Token has already been consumed
But if used is false you can still attach it to a Customer so you can re-use it later
or we can directly charge using token without customer id
Correct, which will use the Token
The Payment Intent API is used to collect funds. You can use it to save Payment Methods as well but the core purpose is to collect payment.
The Setup Intent is used to set up a Payment Method for a Customer so you can charge it later: https://stripe.com/docs/payments/save-and-reuse
ok
Our business model is like this that we save payment details like ach details: bank acc numbers, routing number
Because we are compliant
And this thing happens without using stripe save future payments option
Now after 10 days when we like to charge that payment method, should we use Payment Intent or Setup Intent?
Setup Intents don't make charges. They set up Payment Methods.
If you want to charge the payment method you will need to use a Payment Intent or a Charge object. We recommend the Payment Intent.
Please review this doc for how to make a Payment with Stripe: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
ok Thank you so much @warped dagger @turbid jacinth for all the info
Happy to help ๐