According to the Stripe docs:
In addition to live and test mode, there are also two types of keys secret and publishable keys.
Publishable API keys are meant solely to identify your account with Stripe, they aren't secret. In other words, they can safely be published in places like your Stripe.js javascript code, or in an Android or iPhone app. Publishable keys only have the power to create tokens.
Secret API keys should never be published, and must be kept confidentially on your own servers. These keys can perform any API request to Stripe without restriction.
You'll never need to use them both at once, you use one or the other. The error you posted states:
This API call cannot be made with a publishable API key. Please use a secret API key.
You can distinguish the keys from the first few characters:
pk_test_... - publishable key for test mode
sk_test_... - secret key for test mode
So you need to provide the secret key where you provided the publishable key before. Here's an example of using the secret key with ActiveMerchant:
transaction = ActiveMerchant::Billing::StripeGateway.new(:login => STRIPE_SECRET_KEY)
(Note there's no :password
given.)