Angular — API reference
The Angular SDK exports its public surface from
projects/pdirect-pay/src/public-api.ts.
Everything below is exported. Internal helpers (mobile-money phone
input, bank transfer form) are private and may change without
notice.
Module
Section titled “Module”PdirectPayModule
Section titled “PdirectPayModule”@NgModule({...})export class PdirectPayModule { static forRoot(config?: Partial<{ env: PdirectEnvConfig; defaultConfig: Partial<PdirectPayConfig>; }>): ModuleWithProviders<PdirectPayModule>;}The exports include every standalone component listed below — you
can import { PdirectPayModule } for an all-at-once registration or
import only the components you actually use.
Injection tokens
Section titled “Injection tokens”| Token | Type |
|---|---|
PDIRECT_PAY_CONFIG | PdirectPayConfig |
PDIRECT_ENV_CONFIG | PdirectEnvConfig |
interface PdirectEnvConfig { baseUrl: string; appKey: string;}Components
Section titled “Components”All standalone, all under selector form pdirect-*.
<pdirect-pay-checkout> — PdirectPayCheckoutComponent
Section titled “<pdirect-pay-checkout> — PdirectPayCheckoutComponent”@Input() title?: string;@Input() titleStyle?: Record<string, string>;@Input() titleBackgroundColor?: string;@Input() configs!: PdirectPayConfig; // required@Input() paymentBody!: PdirectPaymentBody; // required@Input() enableHapticFeedback: boolean = true;@Input() backgroundColor?: string;@Input() padding?: string;@Input() themeConfig?: PdirectPayThemeConfig;@Input() language?: string;
@Output() response = new EventEmitter<PdirectPayOnResponse>();@Output() error = new EventEmitter<PdirectPayOnError>();@Output() closed = new EventEmitter<void>();→ Maps to:
POST /payments/collect
+
POST /payments/submit.
<pdirect-payment-method-selection> — PdirectPaymentMethodSelectionComponent
Section titled “<pdirect-payment-method-selection> — PdirectPaymentMethodSelectionComponent”@Input() paymentMethods: PdirectPaymentMethod[];@Input() selectedMethod?: PdirectPaymentMethod;
@Output() methodSelected = new EventEmitter<PdirectPaymentMethod>();<pdirect-payment-form> — PdirectPaymentFormComponent
Section titled “<pdirect-payment-form> — PdirectPaymentFormComponent”@Input() channel?: PdirectPayChannel;@Input() transactionId?: string;@Input() showUserInfoForm: boolean = false;
@Output() formSubmitted = new EventEmitter<Record<string, unknown>>();@Output() cancel = new EventEmitter<void>();<pdirect-otp-verification> — PdirectOtpVerificationComponent
Section titled “<pdirect-otp-verification> — PdirectOtpVerificationComponent”@Input() transactionId?: string;
@Output() otpVerified = new EventEmitter<string>();@Output() resendOtp = new EventEmitter<void>();@Output() cancel = new EventEmitter<void>();<pdirect-processing> — PdirectProcessingComponent
Section titled “<pdirect-processing> — PdirectProcessingComponent”@Input() type: 'default' | 'mobileMoney' = 'default';@Input() message?: string;<pdirect-result> — PdirectResultComponent
Section titled “<pdirect-result> — PdirectResultComponent”@Input() type: 'success' | 'error' | 'warning' | 'info' = 'success';@Input() title?: string;@Input() message?: string;@Input() amount?: number;@Input() currency?: string;@Input() transactionId?: string;@Input() autoRedirectSeconds?: number;@Input() primaryActionLabel?: string;@Input() secondaryActionLabel?: string;
@Output() autoRedirect = new EventEmitter<void>();@Output() primaryAction = new EventEmitter<void>();@Output() secondaryAction = new EventEmitter<void>();<pdirect-loading> — PdirectLoadingComponent
Section titled “<pdirect-loading> — PdirectLoadingComponent”@Input() message?: string;<pdirect-payment-status> — PdirectPaymentStatusComponent
Section titled “<pdirect-payment-status> — PdirectPaymentStatusComponent”For server-initiated transactions where you need to poll status by ID rather than mount the full checkout flow:
@Input() statusConfig!: PdirectPaymentStatusConfig;@Input() showHeader: boolean = true;@Input() showCloseButton: boolean = true;
@Output() statusChange = new EventEmitter<PdirectPaymentStatusResponse>();@Output() paymentComplete = new EventEmitter<PdirectPaymentStatusResponse>();@Output() paymentFailed = new EventEmitter<PdirectPaymentStatusResponse>();@Output() onClose = new EventEmitter<void>();@Output() onDoneEvent = new EventEmitter<PdirectPaymentStatusResponse>();interface PdirectPaymentStatusConfig { paymentId: string; // required config: PdirectPayConfig; // required pollingInterval?: number; // ms, default 5000 maxPollingAttempts?: number; // default 60 language?: PdirectPayLanguage; autoStart?: boolean; // default true}→ Maps to:
GET /payments/mobile-money/status/{payment_id}.
Services
Section titled “Services”All providedIn: 'root'.
PdirectPaymentService
Section titled “PdirectPaymentService”state$: Observable<PdirectPaymentState>;get currentState: PdirectPaymentState;
resetState(): void;setAppKey(appKey: string): void;setAcceptLanguage(language: string): void;
createPayment(body: PdirectPaymentBody): Observable<PdirectHttpResponse<CreatePaymentResponse>>;getTransactionDetails(transactionId: string): Observable<PdirectHttpResponse<TransactionDetailsResponse>>;submitPaymentDetails(req: PdirectPaymentSubmitRequest): Observable<PdirectHttpResponse<PaymentSubmitResponse>>;verifyOtp(req: PdirectOtpVerifyRequest): Observable<PdirectHttpResponse<OtpVerifyResponse>>;resendOtp(req: PdirectOtpResendRequest): Observable<PdirectHttpResponse<OtpResendResponse>>;
selectPaymentMethod(method: PdirectPaymentMethod): void;navigateToScreen(screen: PdirectPayScreenNavigation): void;→ Maps to:
| Method | Endpoint |
|---|---|
createPayment | POST /payments/collect |
getTransactionDetails | GET /payments/transaction/{id} |
submitPaymentDetails | POST /payments/submit |
verifyOtp | POST /payments/verify-otp |
resendOtp | POST /payments/resend-otp |
PdirectHttpClientService
Section titled “PdirectHttpClientService”configure(config: PdirectHttpClientConfig): void;setAppKey(appKey: string): void;clearAppKey(): void;setAcceptLanguage(language: string): void;clearAcceptLanguage(): void;
get<T>(path: string, query?: Record<string, string>): Observable<PdirectHttpResponse<T>>;post<T>(path: string, data?: unknown, query?: Record<string, string>): Observable<PdirectHttpResponse<T>>;put<T>(path: string, data?: unknown, query?: Record<string, string>): Observable<PdirectHttpResponse<T>>;delete<T>(path: string, query?: Record<string, string>): Observable<PdirectHttpResponse<T>>;interface PdirectHttpClientConfig { appKey?: string; acceptLanguage?: string; customHeaders?: Record<string, string>;}PdirectLocalizationService
Section titled “PdirectLocalizationService”currentLanguage$: Observable<PdirectPayLanguage>;translations$: Observable<PdirectTranslations>;get currentLanguage: PdirectPayLanguage;get translations: PdirectTranslations;
setLanguage(language: PdirectPayLanguage): void;setLanguageByCode(code: string): void;translate(key: keyof PdirectTranslations, params?: Record<string, string | number>): string;getSupportedLanguages(): Array<{ code: PdirectPayLanguage; name: string; nativeName: string }>;detectAndSetLanguage(): void;addTranslations(language: PdirectPayLanguage, translations: Partial<PdirectTranslations>): void;Models
Section titled “Models”The full type set is documented in the audit and re-summarised here. Read the SDK source or your IDE’s go-to-definition for full field lists.
| Type | Purpose |
|---|---|
PdirectPayConfig | App-key, environment, language, timeout. |
PdirectPaymentBody | Collect-payment request body. |
PdirectMerchantInfo | id, name, logoUrl?, website?, description?. |
PdirectPayResponse | Success response. |
PdirectPayError | Application error. |
PdirectPayOnResponse | Component success callback payload. |
PdirectPayOnError | Component error callback payload. |
PdirectHttpResponse<T> | Wrapper around every HTTP call: data, message, statusCode, isSuccess, apiResponseCode. |
PdirectPaymentInfo | Resolved payment-method options for paymentMethod: 'none' flows. |
PdirectPaymentMethod | Single method descriptor. |
PdirectTransactionDetails | Detail view body. |
PdirectPaymentSubmitRequest / Response | Submit body / result. |
PdirectOtpVerifyRequest / Response | OTP verify body / result. |
PdirectOtpResendRequest / Response | OTP resend body / result. |
PdirectPaymentStatusConfig / Response | Status component config / result. |
PdirectPayChannel, PdirectPayFillingInfo,
PdirectPayScreenNavigation, PdirectPayResultScreen,
PdirectPaymentStatus, PdirectPayApiResponseCode,
PdirectPayLanguage, PdirectPrinterType, PdirectPayThemeMode.
Companion objects (helpers):
PdirectPayApiResponseCodeInfo.{getMessage, isSuccess, fromString}PdirectPaymentStatusInfo.{getDisplayName, isSuccess, isFailure, isPending, fromString}PdirectPayLanguageInfo/PdirectPayLanguageHelperPdirectPayChannelInfoPdirectPayScreenNavigationInfo
Constants
Section titled “Constants”PdirectPayColors— palette tokens.PdirectPayDefaultTheme— default light / dark CSS-property maps.PdirectPayEnv— static class withinitialize,apiBaseUrl,paymentApiUrl,endpoints,defaultHeaders,buildAuthHeaders,validateConfiguration. Useful when driving the SDK without DI.