17

I'm working on a script that uses the Strip REST api with the PHP SDK. I was hoping to be able to replicate the production data in the test environment. Is this possible?

Thanks,

Andrew

Andrew Hughes
  • 311
  • 3
  • 5
  • 4
    this is not supported: https://groups.google.com/a/lists.stripe.com/d/msg/api-discuss/Tu1BYQF1qJY/mtNFqfiZAwAJ – koopajah Nov 08 '16 at 19:48
  • 3
    This is sooo necessary. Would love to have this right now :/ – zelusp Mar 23 '20 at 00:10
  • It looks like there was some confusion in that thread about what was requested. I'm running into an issue where there are a number of products, pricing strategies, etc that we would like to test, but there's no way to test that config apples-to-apples without copying it by hand first or rolling your own hacky scripting. – bsplosion Mar 21 '22 at 03:08

2 Answers2

2

To my knowledge there's no way to directly port production data into the test data. However a simple script can be constructed to iterate over production data, grab the necessary attributes, switch to test API credentials, and create the necessary records.

I've done this in an idempotent way so that it can be done anytime we add something to Stripe in production, we can create a mirror of this object in our own data model for both production, development, staging, and make sure the item exists in Stripe's test environment.

Jesse Novotny
  • 704
  • 7
  • 16
  • 2
    This is what I had in mind although your use case may be a bit more complicated: https://gist.github.com/jessenovotny/8c8068a79312c3d6135efee3223c9bba – Jesse Novotny Mar 25 '20 at 03:47
1

As I found, you need to write the script and change flag "livemode" to false. That might convert production data to test data. Stripe does not offer to this directly. You can see the flag desciption in below image.

enter image description here

Girish
  • 46
  • 2