Skip to content

Stripe.Customer reference

Source: src/Stripe/CreateCustomer.ts

Create a Stripe Customer over HTTP. Account-scoped — binds the API key onto the host, not a specific customer resource.

CreateCustomer: Creating a Customer at runtime

Section titled “CreateCustomer: Creating a Customer at runtime”
const create = yield* Stripe.CreateCustomer();
const customer = yield* create({
email: "alice@example.com",
name: "Alice",
});

Source: src/Stripe/CreateCustomerHttp.ts Kind: Layer · Provides: Stripe.CreateCustomer

HTTP implementation of CreateCustomer. Provide it on the Function or Worker Effect.

Source: src/Stripe/Customer.ts

A Stripe Customer — the billing identity invoices, subscriptions, and Checkout sessions attach to. Email, name, description, phone, and metadata are updated in place. Deleting a customer is permanent and immediately cancels any active subscriptions.

Email and name

const customer = yield* Stripe.Customer("alice", {
email: "alice@example.com",
name: "Alice Example",
});

Description, phone, and metadata

const customer = yield* Stripe.Customer("alice", {
email: "alice@example.com",
name: "Alice Example",
description: "Beta tester",
phone: "+15555550100",
metadata: { plan: "pro" },
});
const customer = yield* Stripe.Customer("alice", {
email: "alice+updated@example.com",
name: "Alice Example",
metadata: { plan: "enterprise" },
});

Source: src/Stripe/CustomerTaxId.ts

A Stripe Customer Tax ID — a tax identifier (VAT, EIN, GST, …) attached to a Customer and printed on invoices. Existence-only: type and value cannot be updated in place; changing customer, type, or value replaces the tax ID. Destroy deletes it.

Customer tax IDs have no metadata of their own. Ownership for account-wide list() (nuke) is inferred from the parent Customer’s Alchemy metadata.

const customer = yield* Stripe.Customer("alice", {
email: "alice@example.com",
});
const vat = yield* Stripe.CustomerTaxId("alice-vat", {
customer: customer.id,
type: "eu_vat",
value: "DE123456789",
});
const vat = yield* Stripe.CustomerTaxId("alice-vat", {
customer: customer.id,
type: "eu_vat",
value: "DE000000000",
});

Source: src/Stripe/RetrieveCustomer.ts

Retrieve a bound Stripe Customer over HTTP.

const retrieve = yield* Stripe.RetrieveCustomer(alice);
const live = yield* retrieve();

Source: src/Stripe/RetrieveCustomerHttp.ts Kind: Layer · Provides: Stripe.RetrieveCustomer

HTTP implementation of RetrieveCustomer. Provide it on the Function or Worker Effect.

Source: src/Stripe/RetrieveCustomerTaxId.ts

Retrieve a bound Stripe Customer Tax ID over HTTP.

RetrieveCustomerTaxId: Reading a Customer Tax ID

Section titled “RetrieveCustomerTaxId: Reading a Customer Tax ID”
const retrieve = yield* Stripe.RetrieveCustomerTaxId(vat);
const live = yield* retrieve();

Source: src/Stripe/RetrieveCustomerTaxIdHttp.ts Kind: Layer · Provides: Stripe.RetrieveCustomerTaxId

HTTP implementation of RetrieveCustomerTaxId. The nested retrieve takes both customer and id.

Source: src/Stripe/UpdateCustomer.ts

Update a bound Stripe Customer over HTTP.

const update = yield* Stripe.UpdateCustomer(alice);
const live = yield* update({ name: "Alice Example" });

Source: src/Stripe/UpdateCustomerHttp.ts Kind: Layer · Provides: Stripe.UpdateCustomer

HTTP implementation of UpdateCustomer. Provide it on the Function or Worker Effect.