Making Test Charges on a Production Connect App

53 views
Skip to first unread message

Charles Zhang (donorbox.org)

unread,
Dec 15, 2015, 11:23:10 AM12/15/15
to Stripe API Discussion
Hello,

I help run a Stripe Connect app with Shared Customers.
Charges should be make on a new token generated by a Shared Customer.
Our user's want to make test charges with test cards on the live site. 


What is the best way for our users to test transactions? I poured thru the documentation, but it wasn't quite clear. 
Forgive me if I missed something. https://stripe.com/docs/connect/testing

Thanks a lot for the help.



Matthew Arkin

unread,
Dec 15, 2015, 11:29:54 AM12/15/15
to Jake K.
Hi Charles,

One thing to note is that you probably don't want test transactions running on a live page, doing so would mean that anyone could use a test card on something meant to be live and not in test. You'd likely want some sort of toggle on each donation page that your user can set to determine if it is in Live or Test Mode. Based on that toggle, in your database, you'd determine whether or not to use a Live or a Test API key.

Test cards only work with a test API key.

I believe you're using Stripe Connect. If you're using the Stripe-Account header, then switching to test mode is just a case of swapping your platform's live API key for the test API key. Alternatively, if you're using the Access Token method, you can use the user's refresh token to obtain a test API key while leaving the live API key active. You'd set the appropriate key based on that Live / Test toggle in your database. 

Matt

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Charles Zhang (donorbox.org)

unread,
Dec 16, 2015, 8:20:53 AM12/16/15
to Stripe API Discussion
Thanks Matt!

I believe this is the info that we need. We are using token right now (hope to switch to the header in the future). Do we need to use the test secret key (along with production client id) to generate a test token?

Appreciate it.

Remi J.

unread,
Dec 16, 2015, 8:22:51 AM12/16/15
to api-d...@lists.stripe.com
Hey Charles,

The flow is described in our documentation [1] and the idea is to make a curl request like this one:

   -d client_secret=PLATFORM_TEST_SECRET_KEY \
   -d refresh_token=REFRESH_TOKEN \
   -d grant_type=refresh_token

You'd then get a test-mode access token back from us for that account!

All the best,
Remi

Reply all
Reply to author
Forward
0 new messages