Types
The SDK provides full TypeScript type coverage for every API request and response. It also uses branded types to prevent accidentally mixing up different ID strings.Branded IDs
Branded types add compile-time safety to string IDs. APaymentId cannot be accidentally passed where a MerchantId is expected, even though both are strings at runtime.
Available Branded Types
| Type | Factory | Example |
|---|---|---|
PaymentId | asPaymentId() | pay_test_abc123 |
MerchantId | asMerchantId() | merch_xyz789 |
InvoiceId | asInvoiceId() | inv_test_abc123 |
SubscriptionId | asSubscriptionId() | sub_abc123 |
InstallmentPlanId | asInstallmentPlanId() | inst_abc123 |
PaymentLinkCode | asPaymentLinkCode() | link_abc123 |
How Branding Works
__brand property is a phantom type — it exists only in the type system and has zero runtime overhead. You can still use branded IDs as regular strings: