Subscription

subscription describes a recurring relationship between a payer and a payment method. The type below follows the fields serialized from the schema in the codebase.

Draft: The documented REST endpoints for subscription are not yet exposed in the router. Webhooks are the implemented integration path at the moment.

Payload

type SubscriptionID = `sub_${string}`;
type PaymentMethodType =
| "swish"
| "autogiro"
| "autogiro_external"
| "card"
| "apple_pay"
| "google_pay"
| "stripe_subscription"
| "sepa_direct_debit"
| "none";

type Subscription = {
id: SubscriptionID;
payer_id: PayerID;
amount: string;
transaction_date: string;
payment_method_type: PaymentMethodType;
payment_method: PaymentMethod | null;
status: "pending" | "active" | "terminated";
reference: string;
source: "repejo" | "imported";
index_adjustment_consent: boolean;
metadata: Record<string, string>;
recruiter_external_id: string | null;
recruitment_method: string | null;
payer?: Payer;
};

amount is serialised as a string to preserve precision.

payment_method_type identifies the payment method as a string. payment_method is a nested object with type-specific details, or null when no payment method details are embedded. This is relevant for webhook consumers that filter on autogiro_external. See PaymentMethod for the nested payload shape.

recruiter_external_id is the external id of the recruiter (face-to-face fundraiser) attributed to the subscription, or null when no recruiter is attached. recruitment_method is the stable key of the recruitment method, or null.

Planned endpoints

  • GET /api/subscriptions
  • GET /api/subscriptions/:id
  • POST /api/subscriptions
  • PATCH /api/subscriptions/:id

In webhook payloads, the related payer is embedded for subscription events when the association has been preloaded.