Skip to content

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.

@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.

TokenType
PDIRECT_PAY_CONFIGPdirectPayConfig
PDIRECT_ENV_CONFIGPdirectEnvConfig
interface PdirectEnvConfig {
baseUrl: string;
appKey: string;
}

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}.

All providedIn: 'root'.

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:

MethodEndpoint
createPaymentPOST /payments/collect
getTransactionDetailsGET /payments/transaction/{id}
submitPaymentDetailsPOST /payments/submit
verifyOtpPOST /payments/verify-otp
resendOtpPOST /payments/resend-otp
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>;
}
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;

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.

TypePurpose
PdirectPayConfigApp-key, environment, language, timeout.
PdirectPaymentBodyCollect-payment request body.
PdirectMerchantInfoid, name, logoUrl?, website?, description?.
PdirectPayResponseSuccess response.
PdirectPayErrorApplication error.
PdirectPayOnResponseComponent success callback payload.
PdirectPayOnErrorComponent error callback payload.
PdirectHttpResponse<T>Wrapper around every HTTP call: data, message, statusCode, isSuccess, apiResponseCode.
PdirectPaymentInfoResolved payment-method options for paymentMethod: 'none' flows.
PdirectPaymentMethodSingle method descriptor.
PdirectTransactionDetailsDetail view body.
PdirectPaymentSubmitRequest / ResponseSubmit body / result.
PdirectOtpVerifyRequest / ResponseOTP verify body / result.
PdirectOtpResendRequest / ResponseOTP resend body / result.
PdirectPaymentStatusConfig / ResponseStatus 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 / PdirectPayLanguageHelper
  • PdirectPayChannelInfo
  • PdirectPayScreenNavigationInfo
  • PdirectPayColors — palette tokens.
  • PdirectPayDefaultTheme — default light / dark CSS-property maps.
  • PdirectPayEnv — static class with initialize, apiBaseUrl, paymentApiUrl, endpoints, defaultHeaders, buildAuthHeaders, validateConfiguration. Useful when driving the SDK without DI.