Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@stripe/sdk-migrator

Package Overview
Dependencies
Maintainers
60
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stripe/sdk-migrator

A TypeScript CLI tool for Stripe SDK migration

latest
npmnpm
Version
1.0.0
Version published
Maintainers
60
Created
Source

Stripe SDK Migrator

The sdk-migrator is a tool that can modify Java and Python codebases that use the Stripe SDK. It will take code using older integration styles and output the same code but in the newer style.

Eg. In Stripe Java SDK v29.5.0 we introduced new v1 namespace in StripeClient. Running the v1-namespace migration would convert all your StripeClient calls to support the newer code path.

class AcmeBusinessApp {
    public StripeCollection<Customer> fetchCustomerList(StripeClient client) {
-        return client.customers().list();
+        return client.v1().customers().list();
    }
}

[!WARNING] sdk-migrator makes its best effort to migrate your code (especially with dynamic languages). Make sure you have all your code checked in a version control system (e.g. Git) before using this tool. Always review and test your code before deploying.

Installation

sdk-migrator is a Node.js-based package and can be installed globally as a CLI:

npm i -g @stripe/sdk-migrator

or used directly with npx (which comes pre-installed with npm):

npx @stripe/sdk-migrator

If you need Node.js installed, you can follow these instructions for your platform.

Usage

[!WARNING] SDK Migrator can modify files in your codebase. Make sure you have all your code checked in a version control system (e.g. Git) before using this tool. Always review and test your code before deploying.

# Run V1 Namespace migration on a Java codebase in ~/stripe-integration
npx @stripe/sdk-migrator --language java -d ~/stripe-integration --migration v1-namespace

Command Line Options

  • -h, --help: Show help message
  • -v, --version: Show version information
  • -d, --directory: Code directory to process
  • -l, --language: Programming language (java, python)
  • -m, --migration: Migration name (e.g., v1-namespace)
  • -x, --execute: Execute mode will modify files in your codebase
  • -u, --untyped: Untyped mode for codebases that are not fully typed. Currently only available for Python (optional)

Examples

# Show help
npx @stripe/sdk-migrator --help

# Show version
npx @stripe/sdk-migrator --version

# Run V1 Namespace migration in dry run mode(default). Dry run mode shows all the files that it will modify but does not persist it to disk. 
npx @stripe/sdk-migrator --language python -d ~/stripe-integration --migration v1-namespace

# Execute flag(-x or --execute) will make the migration changes and persist the files to disk.  
# Run V1 Namespace migration on a typed Python codebase in ~/stripe-integration
npx @stripe/sdk-migrator --language python -d ~/stripe-integration --migration v1-namespace --execute

# Run V1 Namespace migration on a untyped/paritally typed Python codebase in ~/stripe-integration
npx @stripe/sdk-migrator --language python -d ~/stripe-integration --migration v1-namespace --untyped --execute

# Run V1 Namespace migration on a Java codebase in ~/stripe-integration
npx @stripe/sdk-migrator --language java -d ~/stripe-integration --migration v1-namespace --execute

Customization

If you extend/implement your own StripeClient in your codebase, you can change the regex in src/{lang}/{migration}/configure.ts to use the tool.

Development

Contribution guidelines for this project

Keywords

stripe

FAQs

Package last updated on 27 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts