#kaustuva-le-sources
1 messages · Page 1 of 1 (latest)
heya @fleet thunder, yes, it should be possible, you can attach a source to a customer using https://stripe.com/docs/api/sources/attach
Thanks Alex.
What I am also looking for is....a way to pass card information and create a source.
This document is not super detailed about the options I need to pass for creating the source with a card (i.e. card number, other details etc) -> https://stripe.com/docs/api/sources/create
My code:
const source = await stripe.sources.create({
type: 'card',
currency: 'aud',
owner: {
email: 'test1@example.com'
},
// need to check params to pass for a card here
})
error message:
Error: Missing required param: card.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
you should ideally be using PaymentIntents and PaymentMethods for card payments : https://stripe.com/docs/payments/save-and-reuse
using PaymentIntents and PaymentMethods would allow you access to many new features which using Sources and Charges wouldn't have
Thanks. However if I did want to create a source with a card how would I do that?
Hi, I'm taking over alex-stripe.
You would first create a token: https://stripe.com/docs/api/tokens/create_card
And then pass the token when creating the source: https://stripe.com/docs/api/sources/create#create_source-token
But I would strongly recommend to use Checkout Session or PaymentIntent instead.
Token and sources are an old way of implementing Stripe.
Thanks Soma
How do I make my subscription schedule use a particular source? Can I pass the source id as a parameter?
I don't see a way to set that on the subscription schedule.
So if I'm using sources how do I start a subscription for a customer on one of their saved sources?
Also, in case of paymentIntent/PaymentMethod how do I attach it to a subscription schedule(can I create subscription schedule with a peymentMethod)?
If you are using a PaymentMethod, then you can set default_settings.default_payment_method on the subscription schedule https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-default_settings-default_payment_method
Thanks
I'm trying to attach an existing source to a csutomer object. Both the source and customer are in the connect account. I'm however using my platform key.
await stripe.customers.createSource(
connectId,
{
source: subscription_data.source,
},{ stripeAccount: stripe_connect_account_id })
This doesn't seem to work. The error I get is missing required param: source
Is there any way to attach the source to the customer on my connect account?
Can you share the ID of the failing API request? (req_xxx)
req_n4aIh3hKCWVrhe
Yeah, there's no parameters passed in the payload we've received
Are you sure that's the code that's being executed?
Yeah
My guess is subscription_data.source is undefined. stripe-node will remove any parameters without a value
Yes, my bad. worked with a small change.
So, I was able to pass default_source and create a subscription schedule.
This is the subscription schedule that was created:
https://dashboard.stripe.com/test/subscription_schedules/sub_sched_1KQsFJFUtwYrZPVCs0Z1EwcD
How do I check if it has the default_source property set to the source I used?
Looks like you didn't pass a default_source parameter when creating the schedule: https://dashboard.stripe.com/test/logs/req_cbqDjb8ovip4dX
Sorry this is the one. I can see the default_source field
https://dashboard.stripe.com/test/events/evt_1KQsQGFUtwYrZPVC7gtZLRHD
So the autodebit will happen from the default_source of the subscription schedule no matter what the user's default source is?
Yes, exactly. default_source on the subscription will take precedent over the default source of the associated customer
So if I have default_source set on subscription schedule....I don't need to worry if the customer's default source changes before the autodebit as long as the default_source on sub schedule remains the same?
Exactly
actually soma mentioned in the thread above that setting a source on sub schedule is not possible. But seems to be working fine for me.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yeah I guess it's undocumented. Sources are an older API now so we don't recommend using them unless a legacy integration
So for now, we're creating a source, attaching the source to the customer and then creating a sub schedule with the source as the 'default_source' for the sub schedule.
We'll switch to paymentMethods soon.
Cool!
Thanks a lot for all the help
Np!