#stripe_connect_platform

1 messages · Page 1 of 1 (latest)

lunar remnantBOT
wheat robin
#

:source => 'tok_visa',

nocturne hazel
#

Wait, so you have only one customer and you're using Customer.list() to get them? Why not Customer.retrieve()?

wheat robin
#

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.

nocturne hazel
wheat robin
#

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

#

I think the issue is looking for the default source on the custoemr

nocturne hazel
#

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

wheat robin
#

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?

silver compass
#

To clarify, you're specifically looking at Sources only

wheat robin
#

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

silver compass
#

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:

silver compass
#

But note that this won't be set for customers if you're using payment methods (the newer API)