#juneid_90104
1 messages · Page 1 of 1 (latest)
moving the rest of the question here
If we create a customer using a token then while charging what will we pass tokenId or sourceId.
What flow are you trying to build? Are you following a guide?
I am creating a donation system where first i create a token.
When donor adds card and amount information.
Then i use this token to vreate a customer and attac the card.
But for charge i need source id?
What i sthe normal flow ?
what are you using to collect the payment method information?
are you using card element or something else?
Is this a new integration?
I have created a UI to collect information and create a token using Create a card token api.
This is my first step.
Is this a new integration you're building? If so, I'd recommend switching to newer elements + APIs as the token API is considered legacy
Any workaround for apis only ?
i just want to know how things wor if we create atoken then what should be the next steps ?
@stoic agate catching up since my teammate needs to step away
lets say i have a token and now its time to create and charge customeR.
As my teammate mentioned, if you're building a brand-new integration, we recommend using the PaymentIntents API and using the PaymentElement to collect payment details
For now i am dealing with creating a token using api
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 you insist on using the Tokens API, your next step after you have a token are to either create a charge using that token or attach the card to a customer
Here's the doc to follow if you want to create charges using tokens. note that tokens are single use. This means that if you have a token and you create a charge, you can't use that token again: https://stripe.com/docs/payments/accept-a-payment-charges?platform=web
Here's the doc to follow if you want to save a card to a customer and charge that customer later: https://stripe.com/docs/saving-cards
If we create a customer first by using the token.
then will it rerurn sourceid?
becuase whe i use the same token fro creating a charge it says not lined to customer.
linked*
Once you use the token to create a customer, you can't use that token ever again. If you want to charge the customer later, you'd use their customer ID when creating the charge.
If you're running into an error, could you share the request ID for that request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Can i share test customerid here ?
Yep, that works too!
cus_P31fflm9uC3456
this is a successful charge.
steps i did
- created a customer by just using name email.
- then i created a source id by using a the token which basically first attach the card and then returns sourceid.
- Then i charge the customer using sourceid>
cus_P37RKUnuqVwWdw
this is not successful because for this
- i created a customer using token
- then simply passed the same token for charge becuase sourceid in returning null.
I see what's going on. You seem to be doing two different things. for cus_P31fflm9uC3456, you created a source object using a token. You then attached that source object to a customer: https://stripe.com/docs/api/sources/attach
https://stripe.com/docs/sources/customers#attaching-a-source-to-an-existing-customer-object
For cus_P37RKUnuqVwWdw, you created a token and then passed that token when creating the customer. This added a Card object as the customer's default_source
what did i do wrong for second one ?