Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Stripe's API version for testing, etc

We're managing an old Rails app that uses Stripe but our Stripe version 26 months behind the current API. We're looking to upgrade to the current Stripe API but because many changes will affect our system, we'd really like a way to test out the changes before we change the live API that our live site is using.

So I have two questions:

1) When working with the API we rely heavily on the distinction between Live and Test modes. Is there any way to upgrade the Test mode API only (without upgrading Live) so we can identify and correct for any breakage without actually breaking the user experience?

2) Is it possible to upgrade the API one version at a time, rather than all-at-once, to make the transition more manageable for us?

like image 832
Topher Hunt Avatar asked Jun 12 '15 13:06

Topher Hunt


1 Answers

It's extremely poorly documented, but it turns out you can change the Stripe API version to any version you want on a per-request basis by setting Stripe.api_version = 'YYYY-MM-DD' before sending a request using the Ruby bindings (https://stripe.com/docs/api/ruby#versioning), or by sending a Stripe-Version HTTP header.

So we'll plan to configure our specs to use the latest API version for all requests, and test for breakage that way.

like image 198
Topher Hunt Avatar answered Oct 05 '22 01:10

Topher Hunt