レポートのチャートPrivate preview
連結アカウントにチャートを表示します。
連結アカウントの UI コンポーネントをレンダリングして、純売上高や総売上高のチャートなど、Stripe ダッシュボードのようなチャートを表示します。
アカウントセッションを作成する
アカウントセッションの作成時に、components
パラメーターで reporting_chart
を指定して、Reporting chart を有効にします。
注
Reporting chart コンポーネントはプライベートベータであり、Stripe SDK にはまだ含まれていません。アカウントセッションの作成時に有効にするには、Stripe ベータ SDK で次のコードスニペットを使用してください。
Stripe.api_key = '{{sk_INSERT_YOUR_SECRET_KEY}}'
Stripe.api_version = '2023-10-16; embedded_connect_beta=v2;'
account_session = Stripe::AccountSession.create({
account: '{{CONNECTED_ACCOUNT_ID}}'
,
components: {
reporting_chart: {enabled: true}
}
})
アカウントセッションを作成して、ConnectJS を初期化すると、フロントエンドに Reporting chart コンポーネントを表示できます。
コンポーネントをレンダリングする
const container = document.getElementById("container");
const reportingChart = stripeConnectInstance.create("reporting-chart");
reportingChart.setReportName("net_volume");
reportingChart.setIntervalStart(new Date(2023, 11, 17));
reportingChart.setIntervalEnd(new Date(2024, 08, 18));
reportingChart.setIntervalType("day");
container.appendChild(reportingChart);
Method | Type | Description | Default | Required or Optional |
---|
setReportName | 'net_volume' | 'gross_volume' | The name of the report to render as a chart. | | required |
setIntervalStart | Date | The start time to query data. Returned data might start later than this timestamp if data is sparse. | The time of the connected account’s first data point for the report specified. | optional |
setIntervalEnd | Date | The end time to query data. Returned data might end earlier than this timestamp if data is sparse. | The time of the connected account’s last data point for the report specified. | optional |
setIntervalType | 'day' | 'month' | 'quarter' | 'year' | Used to determine granularity of the data. | Based on the duration between intervalStart and intervalEnd . A longer time frame defaults to showing less granular data. | optional |
Request access Private preview
Sign in to request access to this Connect embedded component in private preview.
If you don’t have a Stripe account, you can register here.