| 1 | import type { |
| 2 | AccountLink, |
| 3 | CreateAccountLinkError, |
| 4 | CreateAccountLinkRequest, |
| 5 | } from "@distilled.cloud/stripe/stripe"; |
| 6 | import type * as Effect from "effect/Effect"; |
| 7 | import * as Binding from "../Binding.ts"; |
| 8 | import type { RuntimeContext } from "../RuntimeContext.ts"; |
| 9 | |
| 10 | /** |
| 11 | * Create a Stripe Account Link over HTTP. Account-scoped — binds the API |
| 12 | * key onto the host, not a specific connected account. |
| 13 | * |
| 14 | * Account Links are the URLs a Connect platform hands a merchant to |
| 15 | * complete hosted onboarding for an Express or Standard account. |
| 16 | * |
| 17 | * ### Onboarding a merchant |
| 18 | * **Example:** Bind and create a link |
| 19 | * ```typescript |
| 20 | * const createLink = yield* Stripe.CreateAccountLink(); |
| 21 | * const link = yield* createLink({ |
| 22 | * account: "acct_…", |
| 23 | * type: "account_onboarding", |
| 24 | * return_url: "https://example.com/onboarded", |
| 25 | * }); |
| 26 | * // link.url is the hosted onboarding page |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | * @product Account |
| 31 | */ |
| 32 | export interface CreateAccountLink extends Binding.Service< |
| 33 | CreateAccountLink, |
| 34 | "Stripe.CreateAccountLink", |
| 35 | () => Effect.Effect< |
| 36 | ( |
| 37 | request: CreateAccountLinkRequest, |
| 38 | ) => Effect.Effect<AccountLink, CreateAccountLinkError, RuntimeContext> |
| 39 | > |
| 40 | > {} |
| 41 | |
| 42 | export const CreateAccountLink = Binding.Service<CreateAccountLink>( |
| 43 | "Stripe.CreateAccountLink", |
| 44 | ); |