#stripe_connect_platform
1 messages · Page 1 of 1 (latest)
:source => 'tok_visa',
Wait, so you have only one customer and you're using Customer.list() to get them? Why not Customer.retrieve()?
is there a way to set up tok_visa as the default source?
is it in Customer.data.default_source true?
Well they are in our UI and could have 1000000 customers.
You would set default source to the ID of the payment source
They are testing what Customer Portal does so we spin up a customer with a name like "demo@example.com" but I'm not sure if we are saving the cus_ id. We just need any test customer with a default source. If they don't have one, we want to give them one. If they have one, we can use theirs.
You would set default source to the ID of the payment source
I do not understand what you mean:
You would set default source to the ID of the payment source
customer = Stripe::Customer.create({
:email => 'demo@example.com',
:source => 'tok_visa',
}, {:stripe_account => stripe_user_id})
What is the ID of the 'tok_visa' fake payment source you give us to make fake customers?????
We have to put the fake customer on a subscription to demo customer portal so they need a default source. This should be really easy no?
We just want to:
goal: create a testmode customer with a valid credit card (default source)
optional
When using payment sources created via the Token or Sources APIs, passing source will create a new source object, make it the new customer default source, and delete the old customer default if one exists. If you want to add additional sources instead of replacing the existing defau
(byebug) customer.id
"cus_MYjoARubtUG6V8"
(byebug) customer.data
*** NoMethodError Exception: undefined method `data' for #Stripe::Customer:0x00007fb682f27a98
I think the issue is looking for the default source on the custoemr
Please try to be a bit more concise with your replies, if you can. It's very difficult to answer multiple questions at once and there is a lot of unnecsessary detail that we can get caught up in when trying to help you
New question
If we have a Customer, how do we just check if they have a source that is valid? Where is it on the customer.
Is customer.sources.present? sufficient?
To clarify, you're specifically looking at Sources only
I want to avoid an error when we try to put the customer on a subscription - that's it - really simple
So whatever we need to check to make sure we can put them on a subscription
I think that thing we need to check is whether the customer has a valid credit card on file (in normal human language).
But how does that translate to the Customer object. How do we just confirm that a Customer has a valid cc on file. Is it - customer.sources.present?
source is a weird term for me - we just want them to have a valid cc which is going to just be 'tok_visa' since it is just a fake testmode customer either we create or find
OK guys, I am not communicating well i think
I think the answer is just that we had:
customer.try(:data).try(:default_source).present?
And really it is:
customer.try(:default_source).present?
that's it.
it's not nested in :data
Well once its attached to the customer, as a source or a payment method, it wouldnt be a token any longer
but you can retrieve customer sources and PMs via the API to confirm they exist already:
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
or list card sources: https://stripe.com/docs/api/cards/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
This might be what you want, if using Sources, yes. Listing would be for all of them, this is just the default
But note that this won't be set for customers if you're using payment methods (the newer API)
For subscription/invoice payments, you can optionally set a default payment method for invoice payment: https://stripe.com/docs/api/customers/update?lang=curl#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.