# Making API calls for connected accounts Learn how to add the right information to your API calls so you can make calls for your connected accounts. You can make API calls for your connected accounts: * Server-side with the [Stripe-Account header](#stripe-account-header) and the connected account ID, per request * Client-side by passing the connected account ID as an argument to the client library To help with performance and reliability, Stripe has established [rate limits and allocations](https://docs.stripe.com/rate-limits.md) for API endpoints. ## Adding the Stripe-Account header server-side To make server-side API calls for connected accounts, use the `Stripe-Account` header with the account identifier, which begins with the prefix `acct_`. Here are four examples using your platform’s [API secret key](https://docs.stripe.com/keys.md) and the connected account’s [Account](https://docs.stripe.com/api/accounts.md) identifier: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PaymentIntentCreateOptions { Amount = 1000, Currency = "usd" }; var service = new PaymentIntentService(); PaymentIntent paymentIntent = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PaymentIntentParams{ Amount: stripe.Int64(1000), Currency: stripe.String(string(stripe.CurrencyUSD)), }; result, err := paymentintent.New(params); ``` ```java Stripe.apiKey = "<>"; PaymentIntentCreateParams params = PaymentIntentCreateParams.builder().setAmount(1000L).setCurrency("usd").build(); PaymentIntent paymentIntent = PaymentIntent.create(params); ``` ```node const stripe = require('stripe')('<>'); const paymentIntent = await stripe.paymentIntents.create({ amount: 1000, currency: 'usd', }); ``` ```python import stripe stripe.api_key = "<>" payment_intent = stripe.PaymentIntent.create( amount=1000, currency="usd", ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $paymentIntent = $stripe->paymentIntents->create([ 'amount' => 1000, 'currency' => 'usd', ]); ``` ```ruby Stripe.api_key = '<>' payment_intent = Stripe::PaymentIntent.create({ amount: 1000, currency: 'usd', }) ``` ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new BalanceGetOptions(); var service = new BalanceService(); Balance balance = service.Get(options); ``` ```go stripe.Key = "<>" params := &stripe.BalanceParams{}; result, err := balance.Get(params); ``` ```java Stripe.apiKey = "<>"; Balance balance = Balance.retrieve(); ``` ```node const stripe = require('stripe')('<>'); const balance = await stripe.balance.retrieve(); ``` ```python import stripe stripe.api_key = "<>" balance = stripe.Balance.retrieve() ``` ```php $stripe = new \Stripe\StripeClient('<>'); $balance = $stripe->balance->retrieve([]); ``` ```ruby Stripe.api_key = '<>' balance = Stripe::Balance.retrieve() ``` ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new ProductListOptions { Limit = 5 }; var service = new ProductService(); StripeList products = service.List(options); ``` ```go stripe.Key = "<>" params := &stripe.ProductListParams{}; params.Limit = stripe.Int64(5) result := product.List(params); ``` ```java Stripe.apiKey = "<>"; ProductListParams params = ProductListParams.builder().setLimit(5L).build(); ProductCollection products = Product.list(params); ``` ```node const stripe = require('stripe')('<>'); const products = await stripe.products.list({ limit: 5, }); ``` ```python import stripe stripe.api_key = "<>" products = stripe.Product.list(limit=5) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $products = $stripe->products->all(['limit' => 5]); ``` ```ruby Stripe.api_key = '<>' products = Stripe::Product.list({limit: 5}) ``` ```dotnet StripeConfiguration.ApiKey = "<>"; var service = new CustomerService(); Customer deleted = service.Delete("{{CUSTOMER_ID}}"); ``` ```go stripe.Key = "<>" params := &stripe.CustomerParams{}; result, err := customer.Del("{{CUSTOMER_ID}}", params); ``` ```java Stripe.apiKey = "<>"; Customer resource = Customer.retrieve("{{CUSTOMER_ID}}"); Customer customer = resource.delete(); ``` ```node const stripe = require('stripe')('<>'); const deleted = await stripe.customers.del('{{CUSTOMER_ID}}'); ``` ```python import stripe stripe.api_key = "<>" deleted = stripe.Customer.delete("{{CUSTOMER_ID}}") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $deleted = $stripe->customers->delete('{{CUSTOMER_ID}}', []); ``` ```ruby Stripe.api_key = '<>' deleted = Stripe::Customer.delete('{{CUSTOMER_ID}}') ``` The `Stripe-Account` header approach is implied in any API request that includes the Stripe account ID in the URL. Here’s an example that shows how to [Retrieve an account](https://docs.stripe.com/api/accounts/retrieve.md) with your user’s [Account](https://docs.stripe.com/api/accounts.md) identifier in the URL. ```dotnet StripeConfiguration.ApiKey = "<>"; var service = new AccountService(); Account account = service.Get("<>"); ``` ```go stripe.Key = "<>" params := &stripe.AccountParams{}; result, err := account.GetByID("<>", params); ``` ```java Stripe.apiKey = "<>"; Account account = Account.retrieve("<>"); ``` ```node const stripe = require('stripe')('<>'); const account = await stripe.accounts.retrieve('<>'); ``` ```python import stripe stripe.api_key = "<>" account = stripe.Account.retrieve("<>") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $account = $stripe->accounts->retrieve('<>', []); ``` ```ruby Stripe.api_key = '<>' account = Stripe::Account.retrieve('<>') ``` All of Stripe’s server-side libraries support this approach on a per-request basis: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new CustomerCreateOptions { Email = "person@example.com" }; var service = new CustomerService(); Customer customer = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.CustomerParams{Email: stripe.String("person@example.com")}; result, err := customer.New(params); ``` ```java Stripe.apiKey = "<>"; CustomerCreateParams params = CustomerCreateParams.builder().setEmail("person@example.com").build(); Customer customer = Customer.create(params); ``` ```node const stripe = require('stripe')('<>'); const customer = await stripe.customers.create({ email: 'person@example.com', }); ``` ```python import stripe stripe.api_key = "<>" customer = stripe.Customer.create(email="person@example.com") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $customer = $stripe->customers->create(['email' => 'person@example.com']); ``` ```ruby Stripe.api_key = '<>' customer = Stripe::Customer.create({email: 'person@example.com'}) ``` ## Adding the connected account ID to a client-side application Client-side libraries set the connected account ID as an argument to the client application: The JavaScript code for passing the connected account ID client-side is the same for plain JS and for ESNext. ```javascript var stripe = Stripe('<>', { stripeAccount: '<>', }); ``` ```javascript import {loadStripe} from '@stripe/stripe-js'; // Make sure to call `loadStripe` outside of a component's render to avoid // recreating the `Stripe` object on every render. const stripePromise = loadStripe('<>', { stripeAccount: '<>', }); ``` ```swift import UIKit import StripePayments @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { StripeAPI.defaultPublishableKey = "<>" STPAPIClient.shared.stripeAccount = "<>" return true } } ``` ```objc \#import "AppDelegate.h" @import StripeCore; @import StripePayments; @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [StripeAPI setDefaultPublishableKey:@"<>"]; [[STPAPIClient sharedClient] setStripeAccount:@"<>"]; return YES; } @end ``` ```kotlin import com.stripe.android.PaymentConfiguration class MyActivity: Activity() { private lateinit var stripe: Stripe override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) stripe = Stripe( this, PaymentConfiguration.getInstance(this).publishableKey, "<>" ) } } ``` ```java import com.stripe.android.PaymentConfiguration; public class MyActivity extends Activity { private Stripe stripe; @Override public void onCreate(@Nullable Bundle savedInstancedState) { super.onCreate(savedInstancedState); stripe = new Stripe( this, PaymentConfiguration.getInstance(this).getPublishableKey(), "<>" ); } } ``` ```javascript import {StripeProvider} from '@stripe/stripe-react-native'; function App() { return ( // Your app code here ); } ``` ## See Also * [Creating charges](https://docs.stripe.com/connect/charges.md) * [Using subscriptions](https://docs.stripe.com/connect/subscriptions.md)