Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AstrakhantsevaAA committed Oct 9, 2023
1 parent 6906d53 commit 2271b6f
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions docs/website/docs/dlt-ecosystem/verified-sources/stripe.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Need help deploying these sources, or figuring out how to run them in your data
:::


Stripe is an online payment platform that allows businesses to securely process and manage customer transactions over the Internet.
[Stripe](https://stripe.com) is an online payment platform that allows businesses to securely process and manage customer transactions over the Internet.

This Stripe `dlt` verified source and
[pipeline example](https://github.com/dlt-hub/verified-sources/blob/master/sources/stripe_pipeline.py)
Expand Down Expand Up @@ -46,6 +46,10 @@ Please note that endpoints in the verified source can be customized as per the S
1. In "Standard Keys", click "Reveal test key" beside the Secret Key.
1. Note down the API_secret_key for configuring secrets.toml.

> Note: The Stripe UI, which is described here, might change.
The full guide is available at [this link.](https://stripe.com/docs/keys)


### Initialize the verified source

To get started with your data pipeline, follow these steps:
Expand Down Expand Up @@ -82,10 +86,12 @@ For more information, read the
[sources.stripe_analytics]
stripe_secret_key = "stripe_secret_key"# please set me up!
```
1. Substitute "stripe_secret_key" with the value [you copied above](#grab-api-credentials) for secure access to your Stripe resources.
1. Substitute "stripe_secret_key" with the value [you copied above](#grab-credentials) for secure access to your Stripe resources.

1. Finally, enter credentials for your chosen destination as per the [docs](../destinations/).

For more information, read the [General Usage: Credentials.](../../general-usage/credentials)

## Run the pipeline

1. Before running the pipeline, ensure that you have installed all the necessary dependencies by
Expand All @@ -98,7 +104,7 @@ For more information, read the
1. You're now ready to run the pipeline! To get started, run the following command:

```bash
python3 stripe_analytics_pipeline.py
python stripe_analytics_pipeline.py
```

1. Once the pipeline has finished running, you can verify that everything loaded correctly by using
Expand All @@ -118,7 +124,7 @@ For more information, read the [Walkthrough: Run a pipeline](../../walkthroughs/
`dlt` works on the principle of [sources](../../general-usage/source) and
[resources](../../general-usage/resource).

However, it is important to note is how the `ENDPOINTS` and `INCREMENTAL_ENDPOINTS` tuples are defined in `stripe_analytics/settings.py`.
However, it is important to note is how the `ENDPOINTS` and `INCREMENTAL_ENDPOINTS` tuples are defined in `stripe_analytics/settings.py`.

```python
# The most popular Stripe API's endpoints
Expand All @@ -131,7 +137,7 @@ INCREMENTAL_ENDPOINTS = ("Event", "Invoice", "BalanceTransaction")
### Source `stripe_source`

This function retrieves data from the Stripe API for the specified endpoint
This function retrieves data from the Stripe API for the specified endpoint:

```python
@dlt.source
Expand All @@ -146,11 +152,11 @@ def stripe_source(
- `endpoints`: Tuple containing endpoint names.
- `start_date`: Start datetime for data loading (default: None).
- `end_date`: End datetime for data loading (default: None).
>This source loads both endpoint types in 'replace mode'. For incremental endpoints, use incremental_stripe_source.
>This source loads all provided endpoints in 'replace' mode. For incremental endpoints, use incremental_stripe_source.
### Source `incremental_stripe_source`

This source loads data in append mode from incremental endpoints.
This source loads data in 'append' mode from incremental endpoints.

```python
@dlt.source
Expand All @@ -168,7 +174,9 @@ def incremental_stripe_source(
`end_date`: End datetime for data loading (default: None).


After each run, initial_start_date updates to the last loaded date. Subsequent runs then retrieve only new data using append mode, streamlining the process and preventing redundant data downloads.
After each run, 'initial_start_date' updates to the last loaded date. Subsequent runs then retrieve only new data using append mode, streamlining the process and preventing redundant data downloads.

For more information, read the [General Usage: Incremental loading](../../general-usage/incremental-loading).

### Resource `metrics_resource`

Expand All @@ -181,11 +189,10 @@ def metrics_resource() -> Iterable[TDataItem]:


Abrevations MRR and Churn rate are as follows:

- Monthly Recurring Revenue (MRR):
Measures the predictable monthly revenue from all active subscriptions. It's the sum of the monthly-normalized subscription amounts.
- Churn rate:
Indicates the rate subscribers leave a service over a specific period. Calculated by dividing the number of recent cancellations by the total subscribers from 30 days ago, adjusted for new subscribers.
- Monthly Recurring Revenue (MRR):
- Measures the predictable monthly revenue from all active subscriptions. It's the sum of the monthly-normalized subscription amounts.
- Churn rate:
- Indicates the rate subscribers leave a service over a specific period. Calculated by dividing the number of recent cancellations by the total subscribers from 30 days ago, adjusted for new subscribers.

### Create your own pipeline

Expand Down

0 comments on commit 2271b6f

Please sign in to comment.