Skip to main content

customers

Creates, updates, deletes, gets or lists a customers resource.

Overview​

Namecustomers
TypeResource
Idrailway.billing.customers

Fields​

The following fields are returned by SELECT queries:

One Customer row.

NameDatatypeDescription
idstring
default_payment_method_idstring
stripe_customer_idstring
applied_creditsnumberThe total amount of credits that have been applied during the current billing period.
billing_addressobjectCustomerAddress object
billing_emailstring
billing_periodobjectBillingPeriod object
credit_balancenumberThe total amount of unused credits for the customer.
current_usagenumberThe current usage for the customer. This value is cached and may not be up to date.
default_payment_methodobjectPaymentMethod object
has_exhausted_free_planboolean
invoicesarrayList of CustomerInvoice objects
is_prepayingboolean
is_trialingboolean
is_usage_subscriberboolean
is_withdrawing_to_creditsboolean
plan_limit_overrideobjectPlanLimitOverride object
remaining_usage_credit_balancenumber
spend_commitmentobjectSpendCommitment object
statestring (ACTIVE, CANCELLED, INACTIVE, PAST_DUE, UNPAID)
subscriptionsarrayList of CustomerSubscription objects
supported_withdrawal_platformsarray
tax_idsarrayList of CustomerTaxId objects
trial_days_remaininginteger
usage_limitobjectUsageLimit object
workspaceobjectWorkspace object

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectworkspace_idGets a Customer of a Workspace. Backed by the Railway GraphQL query workspace.customer.
create_free_plan_subscriptionexecidCreate a free plan subscription for a customer. Backed by the Railway GraphQL mutation customerCreateFreePlanSubscription.
remove_usage_limitexeccustomer_idRemove the usage limit for a customer. Backed by the Railway GraphQL mutation usageLimitRemove.
set_usage_limitexeccustomer_id, soft_limit_dollarshard_limit_dollarsSet the usage limit for a customer. Backed by the Railway GraphQL mutation usageLimitSet.
toggle_payouts_to_creditsexeccustomer_id, is_withdrawing_to_creditsToggle whether a customer is automatically withdrawing to credits. Backed by the Railway GraphQL mutation customerTogglePayoutsToCredits.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
workspace_idstring
customer_idstring
hard_limit_dollarsstringInteger passed as a string, for example '1'.
idstring
is_withdrawing_to_creditsstringBoolean passed as a string, for example 'true'.
soft_limit_dollarsstringInteger passed as a string, for example '1'.

SELECT examples​

Gets a Customer of a Workspace. Backed by the Railway GraphQL query workspace.customer.

SELECT
id,
default_payment_method_id,
stripe_customer_id,
applied_credits,
billing_address,
billing_email,
billing_period,
credit_balance,
current_usage,
default_payment_method,
has_exhausted_free_plan,
invoices,
is_prepaying,
is_trialing,
is_usage_subscriber,
is_withdrawing_to_credits,
plan_limit_override,
remaining_usage_credit_balance,
spend_commitment,
state,
subscriptions,
supported_withdrawal_platforms,
tax_ids,
trial_days_remaining,
usage_limit,
workspace
FROM railway.billing.customers
WHERE workspace_id = '{{ workspace_id }}' -- required
;

Lifecycle Methods​

Create a free plan subscription for a customer. Backed by the Railway GraphQL mutation customerCreateFreePlanSubscription.

EXEC railway.billing.customers.create_free_plan_subscription
@id='{{ id }}' --required
;