Development Quickstart

    Get up and running with our API 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 an API 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 an API 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 use this line:

    gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'

    Check out the Ruby API docs, or see the source on GitHub.

    Available through pip:

    pip install --upgrade stripe

    Alternatively, you can also use easy_install:

    easy_install --upgrade stripe

    Check out the Python API docs, or see the source on GitHub. You can also find the Stripe package on PyPI.

    The PHP library can be installed via Composer:

    composer require stripe/stripe-php

    Alternatively, you can download the source directly.

    Check out the PHP API docs, or see the source on GitHub.

    For Maven, add the following dependency to your POM:

    <dependency>
      <groupId>com.stripe</groupId>
      <artifactId>stripe-java</artifactId>
      <version>7.0.0</version>
    </dependency>

    In other environments, manually install the following JARs:

    Check out the Java API docs, or see the source on GitHub.

    Install via npm:

    npm install stripe

    Check out the node.js API Docs, or see the source on GitHub.

    Install via go:

    go get github.com/stripe/stripe-go

    Then import the package:

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

    For more details, check out the Go API docs and GoDoc, or see the source on GitHub.

    Install via dotnet:

    dotnet add package Stripe.net
    dotnet restore

    Or using NuGet:

    PM> Install-Package Stripe.net

    For more details, check out the .NET API docs, or see the source on GitHub.

    Check out our iOS and Android documentation to learn more about installing our mobile SDKs.

    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 .

    curl https://api.stripe.com/v1/charges \
       -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
       -d amount=999 \
       -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: 999,
        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=999,
      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' => 999,
        '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", 999);
    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
    var stripe = require("stripe")("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
    
    const charge = stripe.charges.create({
      amount: 999,
      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(999),
        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.SetApiKey("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
    
    var options = new ChargeCreateOptions {
        Amount = 999,
        Currency = "usd",
        SourceId = "tok_visa",
        ReceiptEmail = "jenny.rosen@example.com",
    };
    var service = new ChargeService();
    Charge charge = service.Create(options);
    

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

    {
      "id": "ch_1C89EzBGVvYIumpFuowNjRvd",
      "object": "charge",
      "amount": 999,
      "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 }

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

    Next steps

    Congrats! Read on to begin integrating Stripe:

    Questions?

    We're always happy to help with code or other questions you might have! Search our documentation, contact support, or connect with our sales team. You can also chat live with other developers in #stripe on freenode.

    Was this page helpful? Yes No

    Send

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