| 1 | import type { |
| 2 | Customer as StripeCustomer, |
| 3 | CreateCustomerError, |
| 4 | CreateCustomerRequest, |
| 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 Customer over HTTP. Account-scoped — binds the API key |
| 12 | * onto the host, not a specific customer resource. |
| 13 | * |
| 14 | * ### Creating a Customer at runtime |
| 15 | * **Example:** Bind and create |
| 16 | * ```typescript |
| 17 | * const create = yield* Stripe.CreateCustomer(); |
| 18 | * const customer = yield* create({ |
| 19 | * email: "alice@example.com", |
| 20 | * name: "Alice", |
| 21 | * }); |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | * @product Customer |
| 26 | */ |
| 27 | export interface CreateCustomer extends Binding.Service< |
| 28 | CreateCustomer, |
| 29 | "Stripe.CreateCustomer", |
| 30 | () => Effect.Effect< |
| 31 | ( |
| 32 | request: CreateCustomerRequest, |
| 33 | ) => Effect.Effect<StripeCustomer, CreateCustomerError, RuntimeContext> |
| 34 | > |
| 35 | > {} |
| 36 | |
| 37 | export const CreateCustomer = Binding.Service<CreateCustomer>( |
| 38 | "Stripe.CreateCustomer", |
| 39 | ); |