stripe_api_client 0.2.3 copy "stripe_api_client: ^0.2.3" to clipboard
stripe_api_client: ^0.2.3 copied to clipboard

Stripe API Client generated from OpenAPI specification

example/README.md

Example: List Customers #

This example demonstrates how to use the Stripe API client to list customers from your Stripe account.

Setup #

  1. Navigate to the example directory:

    cd example
    
  2. Install dependencies:

    dart pub get
    
  3. Create a .env file in the project root (parent directory):

    cp ../.env.example ../.env
    
  4. Edit ../.env and add your Stripe API key:

    STRIPE_API_KEY=sk_test_your_actual_api_key_here
    

    You can get your API key from the Stripe Dashboard.

Running the Example #

From the example directory:

dart run list_customers.dart

Or from the project root:

cd example && dart run list_customers.dart

What This Example Does #

  1. Loads the Stripe API key from the .env file
  2. Creates a custom authentication provider that adds the API key to the Authorization header
  3. Initializes the Stripe client
  4. Fetches and displays a list of customers from your Stripe account

Customization #

You can modify this example to:

  • Create new customers
  • Update customer information
  • Access other Stripe API endpoints
  • Add error handling for specific error types

See the Stripe API documentation for available endpoints and operations.