Development quickstart

    Get up and running with our client libraries and start developing your Stripe integration.

    Integrating Stripe into your app or website can begin as soon as you create a Stripe account, requiring only three steps:

    1. Obtain your API keys so Stripe can authenticate your integration’s API requests
    2. Install a client library so your integration can interact with the Stripe API
    3. Make a test API request to confirm everything is up and running

    Step 1: Obtain your API keys

    Stripe authenticates your API requests using your account’s API keys. If you do not include your key when making an API request, or use one that is incorrect or outdated, Stripe returns an error.

    Every account is provided with two pairs of keys: one for testing and one for running live transactions. All API requests exist in either test or live mode, and objects—customers, plans, coupons, and so forth—in one mode cannot be manipulated by objects in the other.

    Your API keys are available in the Dashboard. We include randomly generated API keys in our code examples if you are not logged in. Replace these with your own or log in to see code examples populated with your own test API keys.

    If you cannot see your secret API keys in the Dashboard, this means you do not have access to them. Contact your Stripe account’s owner and ask to be added to their team as a developer.

    Step 2: Install a client library

    We provide official libraries for different programming languages and mobile platforms.

    Available as a gem:

    sudo gem install stripe

    If you use bundler, you can add this line:

    gem 'stripe'

    Available through pip:

    pip install --upgrade stripe

    Alternatively, you can also use easy_install:

    easy_install --upgrade stripe

    The PHP library can be installed via Composer:

    composer require stripe/stripe-php

    Alternatively, you can download the source directly.

    For Gradle, add the following dependency to your build.gradle:

    implementation "com.stripe:stripe-java:{VERSION}"
    (Replace {VERSION} with the actual version number you want to use. You can find the most recent version on Maven Repository or GitHub.)

    For Maven, add the following dependency to your POM:

    <dependency> <groupId>com.stripe</groupId> <artifactId>stripe-java</artifactId> <version>{VERSION}</version> </dependency>
    (Replace {VERSION} with the actual version number you want to use. You can find the most recent version on Maven Repository or GitHub.)

    In other environments, manually install the following JARs:

    Install via npm:

    npm install stripe

    Install via go:

    go get github.com/stripe/stripe-go

    Then import the package:

    import ( "github.com/stripe/stripe-go" )

    Install via dotnet:

    dotnet add package Stripe.net dotnet restore

    Or using NuGet:

    PM> Install-Package Stripe.net

    iOS SDK

    The iOS SDK is open source, fully documented, and compatible with apps supporting iOS 10 or above.

    1. If you haven't already, install the latest version of CocoaPods.
    2. If you don't have an existing Podfile, run the following command to create one:
      pod init
    3. Add this line to your Podfile:
      pod 'Stripe'
    4. Run the following command:
      pod install
    5. Don't forget to use the .xcworkspace file to open your project in Xcode, instead of the .xcodeproj file, from here on out.
    6. In the future, to update to the latest version of the SDK, just run:
      pod update Stripe
    1. If you haven't already, install the latest version of Carthage.
    2. Add this line to your Cartfile:
      github "stripe/stripe-ios"
    3. Follow the Carthage installation instructions.
    4. In the future, to update to the latest version of the SDK, run the following command:
      carthage update stripe-ios --platform ios
    1. Head to our GitHub releases page and download and unzip Stripe.framework.zip.
    2. Drag Stripe.framework to the "Embedded Binaries" section of your Xcode project's "General" settings. Make sure to select "Copy items if needed".
    3. Head to the "Build Phases" section of your Xcode project settings, and create a new "Run Script Build Phase". Paste the following snippet into the text field:
      bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework/integrate-dynamic-framework.sh"
    4. In the future, to update to the latest version of our SDK, just repeat steps 1 and 2.

    When your app starts, configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API.

    import UIKit import Stripe @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { Stripe.setDefaultPublishableKey("pk_test_TYooMQauvdEDq54NiTphI7jx") // do any other necessary launch configuration return true } }
    #import "AppDelegate.h" #import <Stripe/Stripe.h> @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [Stripe setDefaultPublishableKey:@"pk_test_TYooMQauvdEDq54NiTphI7jx"]; // do any other necessary launch configuration return YES; } @end

    Android SDK

    The Android SDK is open source and fully documented.

    To install the SDK, add stripe-android to the dependencies block of your app/build.gradle file:

    apply plugin: 'com.android.application' android { ... } dependencies { // ... // Stripe Android SDK implementation 'com.stripe:stripe-android:13.1.3' }

    Configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API, such as in your Application subclass:

    import com.stripe.android.PaymentConfiguration class MyApp: Application() { override fun onCreate() { super.onCreate() PaymentConfiguration.init( applicationContext, "pk_test_TYooMQauvdEDq54NiTphI7jx" ) } }
    import com.stripe.android.PaymentConfiguration; public class MyApp extends Application { @Override public void onCreate() { super.onCreate(); PaymentConfiguration.init( getApplicationContext(), "pk_test_TYooMQauvdEDq54NiTphI7jx" ); } }

    There are also many third-party libraries created by the Stripe community so you can use a language we do not officially support.

    Step 3: Make a test API request

    To check that your integration is working correctly, make a test API request using your test secret key to create a Charge or a PaymentIntent.

    curl https://api.stripe.com/v1/charges \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d amount=1000 \ -d currency=usd \ -d source=tok_visa \ -d receipt_email="jenny.rosen@example.com"
    # Set your secret key: remember to change this to your live secret key in production # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' charge = Stripe::Charge.create({ amount: 1000, currency: 'usd', source: 'tok_visa', receipt_email: 'jenny.rosen@example.com', })
    # Set your secret key: remember to change this to your live secret key in production # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' charge = stripe.Charge.create( amount=1000, currency='usd', source='tok_visa', receipt_email='jenny.rosen@example.com', )
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $charge = \Stripe\Charge::create([ 'amount' => 1000, 'currency' => 'usd', 'source' => 'tok_visa', 'receipt_email' => 'jenny.rosen@example.com', ]);
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", 1000); params.put("currency", "usd"); params.put("source", "tok_visa"); params.put("receipt_email", "jenny.rosen@example.com"); Charge charge = Charge.create(params);
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); (async () => { const charge = await stripe.charges.create({ amount: 1000, currency: 'usd', source: 'tok_visa', receipt_email: 'jenny.rosen@example.com', }); })();
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.ChargeParams{ Amount: stripe.Int64(1000), Currency: stripe.String(string(stripe.CurrencyUSD)), ReceiptEmail: stripe.String("jenny.rosen@example.com"), } params.SetSource("tok_visa") ch, _ := charge.New(params)
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new ChargeCreateOptions { Amount = 1000, Currency = "usd", Source = "tok_visa", ReceiptEmail = "jenny.rosen@example.com", }; var service = new ChargeService(); var charge = service.Create(options);

    Stripe returns a Charge object in response to your API request.

    { "id": "ch_1C89EzBGVvYIumpFuowNjRvd", "object": "charge", "amount": 1000, "amount_refunded": 0, "application": null, "application_fee": null, "balance_transaction": "txn_1C89EzBGVvYIumpFonIVQCqz", "captured": true, "created": 1521647561,
    See all 74 lines "currency": "usd", "customer": null, "description": null, "destination": null, "dispute": null, "failure_code": null, "failure_message": null, "fraud_details": {}, "invoice": null, "livemode": false, "metadata": {}, "on_behalf_of": null, "order": null, "outcome": { "network_status": "approved_by_network", "reason": null, "risk_level": "normal", "risk_score": "23", // Provided only with Stripe Radar for Fraud Teams "seller_message": "Payment complete.", "type": "authorized" }, "paid": true, "receipt_email": "jenny.rosen@example.com", "receipt_number": null, "refunded": false, "refunds": { "object": "list", "data": [], "has_more": false, "total_count": 0, "url": "/v1/charges/ch_1C89EzBGVvYIumpFuowNjRvd/refunds" }, "review": null, "shipping": null, "source": { "id": "card_1C89EzBGVvYIumpFRu1TaQSW", "object": "card", "address_city": null, "address_country": null, "address_line1": null, "address_line1_check": null, "address_line2": null, "address_state": null, "address_zip": null, "address_zip_check": null, "brand": "Visa", "country": "US", "customer": null, "cvc_check": null, "dynamic_last4": null, "exp_month": 8, "exp_year": 2019, "fingerprint": "hJ3Ax4VGoOj4H6mu", "funding": "credit", "last4": "4242", "metadata": {}, "name": null, "tokenization_method": null }, "source_transfer": null, "statement_descriptor": null, "status": "succeeded", "transfer_group": null }
    curl https://api.stripe.com/v1/payment_intents \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d amount=1000 \ -d currency=usd \ -d "payment_method_types[]"=card \ -d receipt_email="jenny.rosen@example.com"
    # Set your secret key: remember to change this to your live secret key in production # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' Stripe::PaymentIntent.create({ amount: 1000, currency: 'usd', payment_method_types: ['card'], receipt_email: 'jenny.rosen@example.com', })
    # Set your secret key: remember to change this to your live secret key in production # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' stripe.PaymentIntent.create( amount=1000, currency='usd', payment_method_types=['card'], receipt_email='jenny.rosen@example.com', )
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); \Stripe\PaymentIntent::create([ 'amount' => 1000, 'currency' => 'usd', 'payment_method_types' => ['card'], 'receipt_email' => 'jenny.rosen@example.com', ]);
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", 1000); params.put("currency", "usd"); ArrayList paymentMethodTypes = new ArrayList(); paymentMethodTypes.add("card"); params.put("payment_method_types", paymentMethodTypes); params.put("receipt_email", "jenny.rosen@example.com"); PaymentIntent.create(params);
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); (async () => { const paymentIntent = await stripe.paymentIntents.create({ amount: 1000, currency: 'usd', payment_method_types: ['card'], receipt_email: 'jenny.rosen@example.com', }); })();
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.PaymentIntentParams{ Amount: stripe.Int64(1000), Currency: stripe.String(string(stripe.CurrencyUSD)), PaymentMethodTypes: stripe.StringSlice([]string{ "card", }), ReceiptEmail: stripe.String("jenny.rosen@example.com"), } paymentintent.New(params)
    // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new PaymentIntentCreateOptions { Amount = 1000, Currency = "usd", PaymentMethodTypes = new List<string> { "card" }, ReceiptEmail = "jenny.rosen@example.com", }; var service = new PaymentIntentService(); service.Create(options);

    Stripe returns a PaymentIntent object in response to your API request.

    { "id": "pi_1DRuHnHgsMRlo4MtwuIAUe6u", "object": "payment_intent", "amount": 1000, "amount_capturable": 0, "amount_received": 0, "application": null, "application_fee_amount": null, "canceled_at": null, "cancellation_reason": null,
    See all 43 lines "capture_method": "automatic", "charges": { "object": "list", "data": [], "has_more": false, "total_count": 0, "url": "/v1/charges?payment_intent=pi_1DRuHnHgsMRlo4MtwuIAUe6u" }, "client_secret": "{{PAYMENT_INTENT_CLIENT_SECRET}}", "confirmation_method": "automatic", "created": 1556123069, "currency": "usd", "customer": null, "description": null, "invoice": null, "last_payment_error": null, "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, "payment_method": null, "payment_method_types": [ "card" ], "receipt_email": "jenny.rosen@example.com", "review": null, "shipping": null, "source": null, "statement_descriptor": null, "status": "requires_payment_method", "transfer_data": null, "transfer_group": null }

    Once you have successfully made an API request, you’re ready to begin integrating Stripe.

    Next steps

    Congrats! Read on to begin integrating Stripe:

    Was this page helpful?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    On this page