PaymentMethod

payment_method är ett nestat objekt som inkluderas i webhook-payloads för subscription-events. Objektet innehåller gemensamma fält samt typspecifika fält beroende på betalsätt.

Gemensamma fält

type PaymentMethodBase = {
id: string;
type: "autogiro" | "swish" | "stripe";
inserted_at: string;
updated_at: string;
};

Autogiro

Inkluderas när payment_method_type är "autogiro".

type AutogiroPaymentMethod = PaymentMethodBase & {
type: "autogiro";
payer_number: string;
clearing_number: string;
account_number: string;
personal_identity_number: string;
bank: string | null;
};

Swish

Inkluderas när payment_method_type är "swish".

type SwishPaymentMethod = PaymentMethodBase & {
type: "swish";
consent_id: string;
alias: string;
status: string;
activated_at: string | null;
};

Stripe

Inkluderas när payment_method_type är "card", "apple_pay", "google_pay" eller "stripe_subscription".

type StripePaymentMethod = PaymentMethodBase & {
type: "stripe";
stripe_payment_method_id: string;
};

Union-typ

type PaymentMethod =
| AutogiroPaymentMethod
| SwishPaymentMethod
| StripePaymentMethod;

payment_method är null om betaluppdraget inte har en kopplad betalmetod.