ACTIONS
  • Home
  • My Actions
  • My Projects
  • My Packages
Stripe -> Retrieve a Customer
Readonly
Stripe - Retrieve a Customer

Action summary

Stripe -> Retrieve a Customer

Xano / Stripe

Stripe - Retrieve a Customer

How to Get the Stripe API Key

To retrieve your Stripe API key, follow these steps:

  1. Log in to your Stripe dashboard at https://dashboard.stripe.com.
  2. Navigate to Developers > API keys.
  3. Locate the Secret Key under the Standard keys section.
  4. Click Reveal test key (for testing) or use the live key for production.
  5. Copy the API key and store it securely.

Note: Never expose your API key in client-side applications.

Overview

This function retrieves a customer's details from Stripe using their unique customer_id.

Inputs

The function accepts the following inputs:

Name Type Description
customer_id text The unique identifier of the Stripe customer
stripe_api_key registry/text The API key used to authenticate with Stripe

Function Stack

The function consists of the following steps:

1. Stripe API Call

  • API Request:
    • Endpoint: https://api.stripe.com/v1/customers/%s
    • Method: GET
    • Authentication: Uses the stripe_api_key
    • Path Parameter:
      • customer_id: The unique identifier of the Stripe customer
    • Returns: stripe_api

2. Precondition Check

  • Ensures that the API response status is 200 before proceeding.

3. Response

  • Key: As Self
  • Value: var: stripe_api.response.result
  • The function returns the customer's details received from Stripe if the API call is successful.

Usage

  1. Provide a valid customer_id to retrieve customer details.
  2. Ensure that stripe_api_key is correctly set up in the registry.
  3. Call the function to fetch customer information from Stripe.
  4. If successful, the function returns customer details in JSON format.

Example Response

{
  "id": "cus_12345",
  "object": "customer",
  "email": "customer@example.com",
  "created": 1672531199,
  "name": "John Doe",
  "phone": "+1234567890",
  "metadata": {}
}

Error Handling

  • If the API response status is not 200, the function does not proceed.
  • Ensure valid customer_id is provided to prevent API errors.

Notes

  • This function requires an active Stripe account and API key.
  • API keys should be kept secure and not exposed in client-side applications.

Version notes

2025-03-03 17:35:46
Current
2025-03-03T12:05:47.000+00:00