UNPKG

@vansite/ts-sharetribe-flex-sdk

Version:

This is a TypeScript SDK for Sharetribe Flex API. It reduces the complexity of the API and provides a more user-friendly interface.

43 lines (42 loc) 1.72 kB
/** * @fileoverview Client for creating Stripe Account Links in the Sharetribe Marketplace API. * * Use this to generate onboarding or verification links for the current user's Stripe Connect account. * The returned link redirects the user to Stripe to complete account setup or provide missing info. * * @see https://www.sharetribe.com/api-reference/marketplace.html#stripe-account-links */ import type { AxiosResponse } from "axios"; import MarketplaceApi from "./index"; import { ExtraParameter, StripeAccountLinksCreateParameter, StripeAccountLinksResponse } from "../../types"; /** * Stripe Account Links API client (current user) */ declare class StripeAccountLinks { readonly authRequired = true; private readonly axios; private readonly endpoint; private readonly headers; constructor(api: MarketplaceApi); /** * Create a Stripe Account Link (onboarding or verification) * * @template P * @template EP * @param {P & StripeAccountLinksCreateParameter} params * @param {EP} [extraParams] * @returns {Promise<AxiosResponse<StripeAccountLinksResponse<"create", EP>>>} * * @example * const { data } = await sdk.stripeAccountLinks.create({ * failureURL: "https://yoursite.com/stripe/failure", * successURL: "https://yoursite.com/stripe/success", * type: "account_onboarding", * }); * * // Redirect user * window.location.href = data.attributes.url; */ create<P extends StripeAccountLinksCreateParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<StripeAccountLinksResponse<"create", EP>>>; } export default StripeAccountLinks;