1import type {
2 BillingCreditGrant as StripeCreditGrant,
3 CreateBillingCreditGrantError,
4 CreateBillingCreditGrantRequest,
5} from "@distilled.cloud/stripe/stripe";
6import type * as Effect from "effect/Effect";
7import * as Binding from "../Binding.ts";
8import type { RuntimeContext } from "../RuntimeContext.ts";
9
10/**
11 * Create a Stripe Credit Grant over HTTP. Account-scoped — binds the API
12 * key onto the host, not a specific grant resource.
13 *
14 * ### Creating a Credit Grant at runtime
15 * **Example:** Bind and create
16 * ```typescript
17 * const create = yield* Stripe.CreateCreditGrant();
18 * const grant = yield* create({
19 * customer: "cus_123",
20 * amount: { type: "monetary", monetary: { currency: "usd", value: 1000 } },
21 * applicability_config: { scope: { price_type: "metered" } },
22 * category: "promotional",
23 * name: "Welcome credits",
24 * });
25 * ```
26 *
27 * @binding
28 * @product Billing
29 */
30export interface CreateCreditGrant extends Binding.Service<
31 CreateCreditGrant,
32 "Stripe.CreateCreditGrant",
33 () => Effect.Effect<
34 (
35 request: CreateBillingCreditGrantRequest,
36 ) => Effect.Effect<
37 StripeCreditGrant,
38 CreateBillingCreditGrantError,
39 RuntimeContext
40 >
41 >
42> {}
43
44export const CreateCreditGrant = Binding.Service<CreateCreditGrant>(
45 "Stripe.CreateCreditGrant",
46);