Creating Charges

    Use Stripe's API and your server-side code to process charges. If you need help after reading this, search our documentation or check out answers to common questions. You can even chat live with other developers in #stripe on freenode.

    Once you've securely collected and tokenized your customer's credit card using Checkout or Elements, you can charge the card. Unlike collection, which occurs in the browser, charge attempts are made from your server, normally using one of our client libraries. If you haven't already, install the library for your favorite language now. This tutorial shows code for Ruby, PHP, Python, and Node, but we also have libraries for Java and Go.

    On your server, grab the Stripe token in the POST parameters submitted by your form. From there, it's one simple API call to charge the card:

    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1000 \
       -d currency=usd \
       -d description="Example charge" \
       -d source=tok_n3UDb188a4NZxWfbuMoVUTDP
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = params[:stripeToken]
    
    # Charge the user's card:
    charge = Stripe::Charge.create(
      :amount => 1000,
      :currency => "usd",
      :description => "Example charge",
      :source => token,
    )
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = request.form['stripeToken'] # Using Flask
    
    # Charge the user's card:
    charge = stripe.Charge.create(
      amount=1000,
      currency="usd",
      description="Example charge",
      source=token,
    )
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    $token = $_POST['stripeToken'];
    
    // Charge the user's card:
    $charge = \Stripe\Charge::create(array(
      "amount" => 1000,
      "currency" => "usd",
      "description" => "Example charge",
      "source" => $token,
    ));
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2";
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    String token = request.getParameter("stripeToken");
    
    // Charge the user's card:
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("amount", 1000);
    params.put("currency", "usd");
    params.put("description", "Example charge");
    params.put("source", token);
    
    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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    var token = request.body.stripeToken; // Using Express
    
    // Charge the user's card:
    var charge = stripe.charges.create({
      amount: 1000,
      currency: "usd",
      description: "Example charge",
      source: token,
    }, function(err, charge) {
      // asynchronously called
    });
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    token := r.FormValue("stripeToken")
    
    // Charge the user's card:
    params := &stripe.ChargeParams{
      Amount: 1000,
      Currency: "usd",
      Description: "Example charge",
    }
    params.SetSource(token)
    
    charge, err := charge.New(params)
    

    As a convenience, if you're logged in while reading this page, we've pre-filled the example with your test secret API key. Only you can see this value. This will authenticate you to Stripe, so keep it secret and keep it safe. Remember to replace the test key with your live key in production. You can get all your keys from the Dashboard.

    That's it! If the charge creation request succeeds, the card has been successfully charged. You will automatically receive your money in two days. If the charge attempt fails, we'll return an error instead.

    Saving credit card details for later

    Stripe tokens can only be used once, but that doesn't mean you have to request your customer's card details for every payment. Stripe provides a Customer object type that makes it easy to save this—and other—information for later use.

    Instead of charging the card immediately, create a new Customer, saving the token on the Customer in the process. This will let you charge the customer at any point in the future:

    # Create a Customer:
    curl https://api.stripe.com/v1/customers \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d email="paying.user@example.com" \
       -d source=tok_1EjnJeQSAwvKJx9bScITmyeB
    # Charge the Customer instead of the card:
    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1000 \
       -d currency=usd \
       -d customer=cus_LBm7jKYqIj5yyW
    # Save the customer ID and other info in a database for later.
    # When it's time to charge the customer again, retrieve the customer ID.
    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1500 \
       -d currency=usd \
       -d customer=cus_LBm7jKYqIj5yyW
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = params[:stripeToken]
    
    # Create a Customer:
    customer = Stripe::Customer.create(
      :email => "paying.user@example.com",
      :source => token,
    )
    
    # Charge the Customer instead of the card:
    charge = Stripe::Charge.create(
      :amount => 1000,
      :currency => "usd",
      :customer => customer.id,
    )
    
    # YOUR CODE: Save the customer ID and other info in a database for later.
    
    # YOUR CODE (LATER): When it's time to charge the customer again, retrieve the customer ID.
    charge = Stripe::Charge.create(
      :amount => 1500, # $15.00 this time
      :currency => "usd",
      :customer => customer_id, # Previously stored, then retrieved
    )
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = request.form['stripeToken']
    
    # Create a Customer:
    customer = stripe.Customer.create(
      email="paying.user@example.com",
      source=token,
    )
    
    # Charge the Customer instead of the card:
    charge = stripe.Charge.create(
      amount=1000,
      currency="usd",
      customer=customer.id,
    )
    
    # YOUR CODE: Save the customer ID and other info in a database for later.
    
    # YOUR CODE (LATER): When it's time to charge the customer again, retrieve the customer ID.
    charge = stripe.Charge.create(
      amount=1500, # $15.00 this time
      currency="usd",
      customer=customer.id, # Previously stored, then retrieved
    )
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    $token = $_POST['stripeToken'];
    
    // Create a Customer:
    $customer = \Stripe\Customer::create(array(
      "email" => "paying.user@example.com",
      "source" => $token,
    ));
    
    // Charge the Customer instead of the card:
    $charge = \Stripe\Charge::create(array(
      "amount" => 1000,
      "currency" => "usd",
      "customer" => $customer->id
    ));
    
    // YOUR CODE: Save the customer ID and other info in a database for later.
    
    // YOUR CODE (LATER): When it's time to charge the customer again, retrieve the customer ID.
    $charge = \Stripe\Charge::create(array(
      "amount" => 1500, // $15.00 this time
      "currency" => "usd",
      "customer" => $customer_id
    ));
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2";
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    String token = request.getParameter("stripeToken");
    
    // Create a Customer:
    Map<String, Object> customerParams = new HashMap<String, Object>();
    customerParams.put("email", "paying.user@example.com");
    customerParams.put("source", token);
    Customer customer = Customer.create(customerParams);
    
    // Charge the Customer instead of the card:
    Map<String, Object> chargeParams = new HashMap<String, Object>();
    chargeParams.put("amount", 1000);
    chargeParams.put("currency", "usd");
    chargeParams.put("customer", customer.getId());
    Charge charge = Charge.create(chargeParams);
    
    // YOUR CODE: Save the customer ID and other info in a database for later.
    
    // YOUR CODE (LATER): When it's time to charge the customer again, retrieve the customer ID.
    Map<String, Object> chargeParams = new HashMap<String, Object>();
    chargeParams.put("amount", 1500); // $15.00 this time
    chargeParams.put("currency", "usd");
    chargeParams.put("customer", customerId);
    Charge charge = Charge.create(chargeParams);
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    var token = request.body.stripeToken; // Using Express
    
    // Create a Customer:
    stripe.customers.create({
      email: "paying.user@example.com",
      source: token,
    }).then(function(customer) {
      // YOUR CODE: Save the customer ID and other info in a database for later.
      return stripe.charges.create({
        amount: 1000,
        currency: "usd",
        customer: customer.id,
      });
    }).then(function(charge) {
      // Use and save the charge info.
    });
    
    // YOUR CODE (LATER): When it's time to charge the customer again, retrieve the customer ID.
    stripe.charges.create({
      amount: 1500, // $15.00 this time
      currency: "usd",
      customer: customerId,
    });
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    token := r.FormValue("stripeToken")
    
    // Create a Customer:
    customerParams := &stripe.CustomerParams{
      Email: "paying.user@example.com",
    }
    customerParams.SetSource(token)
    customer, err := customer.New(customerParams)
    
    // Charge the Customer instead of the card:
    chargeParams := &stripe.ChargeParams{
      Amount: 1000,
      Currency: "usd",
      Customer: customer.id,
    }
    charge, err := charge.New(chargeParams)
    
    // YOUR CODE: Save the customer ID and other info in a database for later.
    
    // YOUR CODE (LATER): When it's time to charge the customer again, retrieve the customer ID.
    chargeParams := &stripe.ChargeParams{
      Amount: 1500, // $15.00 this time
      Currency: "usd",
      Customer: customerId,
    }
    charge, err := charge.New(chargeParams)
    

    After creating a customer in Stripe with a stored payment method, be certain to store the customer ID on your side for later use. You can charge that customer by passing the customer ID—instead of a card representation—in the charge request.

    Customers can also store multiple payment methods. The first one saved to a customer is set as the default_source. This is used for subscription payments and whenever a charge request is made with just a customer ID. You can manage the payment methods saved to a customer (e.g., create or remove cards) and you can update the customer to change default_source to another stored payment method at any time.

    Updating saved card details

    Saved cards can continue to work even if the physical card has been replaced by the customer's bank. Stripe works with card networks and automatically attempts to update saved card details whenever a customer's card is replaced. This allows your customers to continue using your service without interruption, and reduces the need for you to collect new card details whenever a card expires.

    Automatic card updates work with most Mastercard, Discover, and Visa cards, though not all issuing banks and countries support this. You can be notified whenever a card is automatically updated by listening for the customer.source.updated webhook event. Although many of the cards you save can be automatically updated, you should still adopt a process that allows customers to update or replace cards on file (e.g., a customer wants to change the card being billed or their card cannot be automatically updated). Check out our recipe for handling card updates to learn more.

    You can update a saved card's billing adress or expiration date only. Should you need to change the card that should be billed, provide a token as a value for source and update the Customer object.

    curl https://api.stripe.com/v1/customers/cus_yXrBvZuebxiiVP \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d source=tok_wbfaYhnNCi8unWxiMXG96RCc
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    cu = Stripe::Customer.retrieve("cus_OybD0hZNzjvXxc")
    cu.source = "tok_3iE3rBtKu9jvdOJ01vgDHER7"
    cu.save
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    cu = stripe.Customer.retrieve("cus_exQEfcicNBa5w3")
    cu.source = "tok_ySCEewc57alhyaIDnr70NaTt"
    cu.save()
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    $cu = \Stripe\Customer::retrieve("cus_s9TTIhLLEfyaIB");
    $cu->source = "tok_yUHFQzKngkNDSyZBxDcnzhZL";
    $cu->save();
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2";
    
    Customer cu = Customer.retrieve("cus_Pvkd93jpzP0IyT");
    Map<String, Object> updateParams = new HashMap<String, Object>();
    updateParams.put("source", "tok_zeBgsaO07Uy1QyaZmxjYDL9m");
    
    cu.update(updateParams);
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    stripe.customers.update("cus_xU3nP9fVPEGmki", {
      source: "tok_miSGrIxq9RwtFjh2vK1A2cBb"
    }, function(err, customer) {
      // asynchronously called
    });
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    c, err := customer.Update(
          "cus_NOT5Tvn81LdGsw",
          &stripe.CustomerParams{Source: "tok_vMjAWXXI630POlP4q3EGXwJd"},
        )
    

    This creates an additional saved card and sets it as the default payment source for future payments. If necessary, you can then delete the previously saved card.

    Storing information in metadata

    Stripe supports adding metadata to the most common requests you'll make, such as processing charges. Metadata is for your use only: it isn't shown to customers or factored into whether or not a charge is declined or blocked by our fraud prevention system.

    Through metadata, you can associate other information—meaningful to you—with Stripe activity. Any metadata you include will be viewable in the Dashboard (e.g., when looking at the page for an individual charge), and will also be available in common reports and exports. As an example, your store's order ID can be attached to the charge used to pay for that order. Doing so allows you, your accountant, or your finance team to easily reconcile charges in Stripe to orders in your system.

    If you are using Radar, consider passing any additional customer information and order information as metadata. By doing so, you'll be able to write Radar rules using metadata attributes and have more information about the payment available within the Dashboard which can expedite your review process.

    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1000 \
       -d currency=usd \
       -d description="Example charge" \
       -d metadata[order_id]=6735 \
       -d source=tok_LuhCQ9suQL2PDlQurR822RLe
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = params[:stripeToken]
    
    # Charge the user's card:
    charge = Stripe::Charge.create(
      :amount => 1000,
      :currency => "usd",
      :description => "Example charge",
      :metadata => {"order_id" => 6735},
      :source => token,
    )
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = request.form['stripeToken'] # Using Flask
    
    # Charge the user's card:
    charge = stripe.Charge.create(
      amount=1000,
      currency="usd",
      description="Example charge",
      metadata={"order_id": 6735},
      source=token,
    )
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    $token = $_POST['stripeToken'];
    
    // Charge the user's card:
    $charge = \Stripe\Charge::create(array(
      "amount" => 1000,
      "currency" => "usd",
      "description" => "Example charge",
      "metadata" => array("order_id" => 6735),
      "source" => $token,
    ));
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2";
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    String token = request.getParameter("stripeToken");
    
    // Charge the user's card:
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("amount", 1000);
    params.put("currency", "usd");
    params.put("description", "Example charge");
    Map<String, String> initialMetadata = new HashMap<String, String>();
    initialMetadata.put("order_id", 6735);
    params.put("metadata", initialMetadata);
    params.put("source", token);
    
    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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    var token = request.body.stripeToken; // Using Express
    
    // Charge the user's card:
    var charge = stripe.charges.create({
      amount: 1000,
      currency: "usd",
      description: "Example charge",
      metadata: {order_id: 6735},
      source: token,
    }, function(err, charge) {
      // asynchronously called
    });
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    token := r.FormValue("stripeToken")
    
    // Charge the user's card:
    params := &stripe.ChargeParams{
      Amount: 1000,
      Currency: "usd",
      Description: "Example charge",
    params.AddMeta("order_id", 6735)
    }
    params.SetSource(token)
    
    charge, err := charge.New(params)
    

    Auth and capture

    Stripe supports two-step payments so you can first authorize a charge on your customer’s card, then wait to settle (capture) it later. When a charge is authorized, the funds are guaranteed by the issuing bank and the amount held on the customer’s card for up to seven days. If the charge is not captured within this time, the authorization is canceled and funds released.

    To authorize a payment without capturing it, make a charge request that also includes the capture parameter with a value of false. This instructs Stripe to only authorize the amount on the customer’s card.

    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1000 \
       -d currency=usd \
       -d description="Example charge" \
       -d capture=false \
       -d source=tok_jZIMPtXkDVhOgb8pwUl3fon1
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = params[:stripeToken]
    
    # Charge the user's card:
    charge = Stripe::Charge.create(
      :amount => 1000,
      :currency => "usd",
      :description => "Example charge",
      :capture => false,
      :source => token,
    )
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = request.form['stripeToken'] # Using Flask
    
    # Charge the user's card:
    charge = stripe.Charge.create(
      amount=1000,
      currency="usd",
      description="Example charge",
      capture=False,
      source=token,
    )
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    $token = $_POST['stripeToken'];
    
    // Charge the user's card:
    $charge = \Stripe\Charge::create(array(
      "amount" => 1000,
      "currency" => "usd",
      "description" => "Example charge",
      "capture" => false,
      "source" => $token,
    ));
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2";
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    String token = request.getParameter("stripeToken");
    
    // Charge the user's card:
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("amount", 1000);
    params.put("currency", "usd");
    params.put("description", "Example charge");
    params.put("capture", false);
    params.put("source", token);
    
    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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    var token = request.body.stripeToken; // Using Express
    
    // Charge the user's card:
    var charge = stripe.charges.create({
      amount: 1000,
      currency: "usd",
      description: "Example charge",
      capture: false,
      source: token,
    }, function(err, charge) {
      // asynchronously called
    });
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    token := r.FormValue("stripeToken")
    
    // Charge the user's card:
    params := &stripe.ChargeParams{
      Amount: 1000,
      Currency: "usd",
      Description: "Example charge",
      Capture: false,
    }
    params.SetSource(token)
    
    charge, err := charge.New(params)
    

    To settle an authorized charge, make a capture charge request. The total authorized amount is captured by default, and you cannot capture more than this. If you want to capture less than the initial amount (e.g., $8 of a $10 authorization), pass the amount parameter. Partially capturing a charge automatically releases the remaining amount.

    curl https://api.stripe.com/v1/charges/ch_1A9eP02eZvKYlo2CkibleoVM/capture \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -X POST
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    charge = Stripe::Charge.retrieve("ch_1A9eP02eZvKYlo2CkibleoVM")
    charge.capture
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    charge = stripe.Charge.retrieve("ch_1A9eP02eZvKYlo2CkibleoVM")
    charge.capture()
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    $charge = \Stripe\Charge::retrieve("ch_1A9eP02eZvKYlo2CkibleoVM");
    $charge->capture();
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2";
    
    charge = Charge.retrieve("ch_1A9eP02eZvKYlo2CkibleoVM");
    charge.capture();
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    stripe.charges.capture("ch_1A9eP02eZvKYlo2CkibleoVM", function(err, charge) {
      // asynchronously called
    });
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    ch, err := charge.Capture("ch_1A9eRO2eZvKYlo2Cka2MTv4R", nil)
    

    Some issuing banks do not distinguish between authorizations and settled charges, which can sometimes lead to confusion. In addition, authorized charges can only be captured once. If you partially capture a charge, you cannot perform another capture for the difference. Depending on your requirements, you may be better served by saving customer’s card details for later and creating charges as needed.

    Dynamic statement descriptor

    By default, your account's statement descriptor appears on customer statements whenever you charge their card. If you need to provide a different description on a per-charge basis, include the statement_descriptor parameter.

    curl https://api.stripe.com/v1/charges \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d amount=1000 \
       -d currency=usd \
       -d description="Example charge" \
       -d statement_descriptor="Custom descriptor" \
       -d source=tok_2wyPYo3UKM30gUH3vUEX4Onq
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = params[:stripeToken]
    
    # Charge the user's card:
    charge = Stripe::Charge.create(
      :amount => 1000,
      :currency => "usd",
      :description => "Example charge",
      :statement_descriptor => "Custom descriptor",
      :source => token,
    )
    
    # 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    # Token is created using Stripe.js or Checkout!
    # Get the payment token submitted by the form:
    token = request.form['stripeToken'] # Using Flask
    
    # Charge the user's card:
    charge = stripe.Charge.create(
      amount=1000,
      currency="usd",
      description="Example charge",
      statement_descriptor="Custom descriptor",
      source=token,
    )
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    $token = $_POST['stripeToken'];
    
    // Charge the user's card:
    $charge = \Stripe\Charge::create(array(
      "amount" => 1000,
      "currency" => "usd",
      "description" => "Example charge",
      "statement_descriptor" => "Custom descriptor",
      "source" => $token,
    ));
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2";
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    String token = request.getParameter("stripeToken");
    
    // Charge the user's card:
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("amount", 1000);
    params.put("currency", "usd");
    params.put("description", "Example charge");
    params.put("statement_descriptor", "Custom descriptor");
    params.put("source", token);
    
    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_BQokikJOvBiI2HlWgH4olfQ2");
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    var token = request.body.stripeToken; // Using Express
    
    // Charge the user's card:
    var charge = stripe.charges.create({
      amount: 1000,
      currency: "usd",
      description: "Example charge",
      statement_descriptor: "Custom descriptor",
      source: token,
    }, function(err, charge) {
      // asynchronously called
    });
    
    // 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_BQokikJOvBiI2HlWgH4olfQ2"
    
    // Token is created using Stripe.js or Checkout!
    // Get the payment token submitted by the form:
    token := r.FormValue("stripeToken")
    
    // Charge the user's card:
    params := &stripe.ChargeParams{
      Amount: 1000,
      Currency: "usd",
      Description: "Example charge",
      Statement: "Custom descriptor",
    }
    params.SetSource(token)
    
    charge, err := charge.New(params)
    

    Statement descriptors are limited to 22 characters, and cannot use the special characters <, >, ', or ".

    Next steps

    Congrats! You've processed your first charge using Stripe. Some things you might want to see next: