@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.64 kB
TypeScript
/**
* @fileoverview Client for creating Stripe Setup Intents in the Sharetribe Marketplace API.
*
* A Setup Intent is used to save a payment method (e.g. card) for future use
* without charging immediately — ideal for marketplaces that charge later.
*
* Returns `client_secret` for use with Stripe.js / Elements.
*
* @see https://www.sharetribe.com/api-reference/marketplace.html#stripe-setup-intents
*/
import type { AxiosResponse } from "axios";
import MarketplaceApi from "./index";
import { ExtraParameter, StripeSetupIntentsCreateParameter, StripeSetupIntentsResponse } from "../../types";
/**
* Stripe Setup Intents API client (current user)
*/
declare class StripeSetupIntents {
readonly authRequired = true;
private readonly axios;
private readonly endpoint;
private readonly headers;
constructor(api: MarketplaceApi);
/**
* Create a new Setup Intent for saving a payment method
*
* @template P
* @template EP
* @param {P & StripeSetupIntentsCreateParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<StripeSetupIntentsResponse<"create">>>}
*
* @example
* const { data } = await sdk.stripeSetupIntents.create({});
*
* // Use with Stripe.js
* stripe.confirmCardSetup(data.attributes.clientSecret, {
* payment_method: { card: cardElement }
* });
*/
create<P extends StripeSetupIntentsCreateParameter, EP extends ExtraParameter | undefined = undefined>(params?: P, extraParams?: EP): Promise<AxiosResponse<StripeSetupIntentsResponse<"create">>>;
}
export default StripeSetupIntents;