monime-package 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,6 +70,7 @@ Recommended to store credentials in `.env`:
70
70
  ```bash
71
71
  MONIME_SPACE_ID=space_XXXXXXXX
72
72
  MONIME_ACCESS_TOKEN=sk_live_xxx
73
+ MONIME_VERSION=caph.2025-08-23 # Optional, defaults to latest
73
74
  ```
74
75
 
75
76
  You can also pass credentials directly when creating the client.
@@ -86,6 +87,7 @@ import { createClient } from "monime-package";
86
87
  const client = createClient({
87
88
  monimeSpaceId: process.env.MONIME_SPACE_ID!,
88
89
  accessToken: process.env.MONIME_ACCESS_TOKEN!,
90
+ monimeVersion: "caph.2025-08-23", // Optional
89
91
  });
90
92
  ```
91
93
 
@@ -117,6 +119,72 @@ type Result<T> = {
117
119
 
118
120
  The client exposes namespaced APIs under `client.<module>`. Below is the complete API reference:
119
121
 
122
+ ### Payments (New)
123
+
124
+ Manage all incoming payments (payins).
125
+
126
+ ```ts
127
+ // Get payment details
128
+ client.payment.get(paymentId: string): Promise<Result<GetPayment>>
129
+
130
+ // List payments
131
+ client.payment.getAll(params?: any): Promise<Result<ListPayments>>
132
+
133
+ // Patch payment
134
+ client.payment.patch(paymentId: string, body: any): Promise<Result<PatchPayment>>
135
+ ```
136
+
137
+ ### Webhooks (New)
138
+
139
+ Manage webhooks for real-time notifications.
140
+
141
+ ```ts
142
+ // Create webhook
143
+ client.webhook.create(body: CreateWebhookRequest): Promise<Result<CreateWebhookResponse>>
144
+
145
+ // Get webhook
146
+ client.webhook.get(webhookId: string): Promise<Result<GetWebhookResponse>>
147
+
148
+ // List webhooks
149
+ client.webhook.getAll(): Promise<Result<ListWebhooksResponse>>
150
+
151
+ // Update webhook
152
+ client.webhook.update(webhookId: string, body: UpdateWebhookRequest): Promise<Result<UpdateWebhookResponse>>
153
+
154
+ // Delete webhook
155
+ client.webhook.delete(webhookId: string): Promise<{ success: boolean; error?: Error }>
156
+ ```
157
+
158
+ ### Receipts (New)
159
+
160
+ Manage payment receipts.
161
+
162
+ ```ts
163
+ // Get receipt
164
+ client.receipt.get(orderNumber: string): Promise<Result<GetReceiptResponse>>
165
+
166
+ // Redeem receipt
167
+ client.receipt.redeem(orderNumber: string, body: any): Promise<Result<RedeemReceiptResponse>>
168
+ ```
169
+
170
+ ### USSD OTPs (New)
171
+
172
+ Generate USSD OTPs.
173
+
174
+ ```ts
175
+ // Create USSD OTP
176
+ client.ussdOtp.create(body: CreateUssdOtpRequest): Promise<Result<CreateUssdOtpResponse>>
177
+ ```
178
+
179
+ ### Provider KYC (New)
180
+
181
+ Get provider KYC details.
182
+
183
+ ```ts
184
+ // Get provider KYC
185
+ client.providerKyc.get(providerId: string): Promise<Result<GetProviderKycResponse>>
186
+ ```
187
+
120
188
  ### Financial Accounts
121
189
 
122
190
  Manage digital wallets and financial accounts.
@@ -387,6 +455,7 @@ The client accepts the following options (see `src/client.ts`):
387
455
  type ClientOptions = {
388
456
  monimeSpaceId: string; // Your Monime Space ID
389
457
  accessToken: string; // Your Monime API token
458
+ monimeVersion?: "caph.2025-08-23" | "caph.2025-06-20"; // API Version
390
459
  };
391
460
  ```
392
461
 
package/dist/index.d.mts CHANGED
@@ -1,3 +1,9 @@
1
+ interface ClientConfig {
2
+ monimeSpaceId: string;
3
+ accessToken: string;
4
+ monimeVersion?: string | undefined;
5
+ }
6
+
1
7
  interface AllCheckout {
2
8
  success: boolean;
3
9
  messages: string[];
@@ -166,7 +172,7 @@ interface Price {
166
172
  value: number;
167
173
  }
168
174
 
169
- declare function CheckoutSessionAPI(client: MonimeClient): {
175
+ declare function CheckoutSessionAPI(config: ClientConfig): {
170
176
  create: (name: string, amount: number, quantity: number, successUrl: string, cancelUrl: string, description?: string, financialAccountId?: string, primaryColor?: string, images?: string[]) => Promise<{
171
177
  success: boolean;
172
178
  error?: Error;
@@ -753,9 +759,166 @@ interface Amount$1 {
753
759
  value: number;
754
760
  }
755
761
 
762
+ interface Payment {
763
+ id: string;
764
+ status: "pending" | "processing" | "completed" | "failed";
765
+ amount: {
766
+ currency: string;
767
+ value: number;
768
+ };
769
+ channel: {
770
+ type: "bank" | "card" | "momo" | "wallet";
771
+ };
772
+ name: string | null;
773
+ reference: string | null;
774
+ orderNumber: string | null;
775
+ financialAccountId: string | null;
776
+ financialTransactionReference: string | null;
777
+ fees: Array<{
778
+ code: string;
779
+ amount: {
780
+ currency: string;
781
+ value: number;
782
+ };
783
+ }>;
784
+ createTime: string;
785
+ updateTime: string;
786
+ ownershipGraph: {
787
+ owner: {
788
+ id: string;
789
+ type: string;
790
+ metadata: Record<string, any> | null;
791
+ };
792
+ };
793
+ metadata: Record<string, any> | null;
794
+ }
795
+ interface GetPayment {
796
+ success: boolean;
797
+ messages: string[];
798
+ result: Payment;
799
+ }
800
+ interface ListPayments {
801
+ success: boolean;
802
+ messages: string[];
803
+ result: Payment[];
804
+ pagination: {
805
+ next: string | null;
806
+ };
807
+ }
808
+ interface PatchPayment {
809
+ success: boolean;
810
+ messages: string[];
811
+ result: Payment;
812
+ }
813
+
814
+ interface WebhookVerificationMethod {
815
+ type: "HS256" | "ES256";
816
+ secret: string;
817
+ }
818
+ interface Webhook {
819
+ id: string;
820
+ name: string;
821
+ url: string;
822
+ enabled: boolean;
823
+ events: string[];
824
+ apiRelease: string;
825
+ verificationMethod: WebhookVerificationMethod;
826
+ headers: Record<string, string>;
827
+ alertEmails: string[];
828
+ createTime: string;
829
+ updateTime: string;
830
+ metadata: Record<string, any>;
831
+ }
832
+ interface CreateWebhookRequest {
833
+ name: string;
834
+ url: string;
835
+ events: string[];
836
+ enabled?: boolean;
837
+ apiRelease?: string;
838
+ headers?: Record<string, string>;
839
+ alertEmails?: string[];
840
+ verificationMethod?: WebhookVerificationMethod;
841
+ metadata?: Record<string, any>;
842
+ }
843
+ interface CreateWebhookResponse {
844
+ success: boolean;
845
+ messages: string[];
846
+ result: Webhook;
847
+ }
848
+ interface GetWebhookResponse {
849
+ success: boolean;
850
+ messages: string[];
851
+ result: Webhook;
852
+ }
853
+ interface ListWebhooksResponse {
854
+ success: boolean;
855
+ messages: string[];
856
+ result: Webhook[];
857
+ pagination?: {
858
+ next: string | null;
859
+ };
860
+ }
861
+ interface UpdateWebhookRequest {
862
+ name?: string;
863
+ url?: string;
864
+ events?: string[];
865
+ enabled?: boolean;
866
+ headers?: Record<string, string>;
867
+ alertEmails?: string[];
868
+ verificationMethod?: WebhookVerificationMethod;
869
+ metadata?: Record<string, any>;
870
+ }
871
+ interface UpdateWebhookResponse {
872
+ success: boolean;
873
+ messages: string[];
874
+ result: Webhook;
875
+ }
876
+
877
+ interface Receipt {
878
+ orderNumber: string;
879
+ [key: string]: any;
880
+ }
881
+ interface GetReceiptResponse {
882
+ success: boolean;
883
+ messages: string[];
884
+ result: Receipt;
885
+ }
886
+ interface RedeemReceiptResponse {
887
+ success: boolean;
888
+ messages: string[];
889
+ result: Receipt;
890
+ }
891
+
892
+ interface UssdOtp {
893
+ id: string;
894
+ phoneNumber: string;
895
+ otp: string;
896
+ expiresAt: string;
897
+ [key: string]: any;
898
+ }
899
+ interface CreateUssdOtpRequest {
900
+ phoneNumber: string;
901
+ [key: string]: any;
902
+ }
903
+ interface CreateUssdOtpResponse {
904
+ success: boolean;
905
+ messages: string[];
906
+ result: UssdOtp;
907
+ }
908
+
909
+ interface ProviderKyc {
910
+ providerId: string;
911
+ [key: string]: any;
912
+ }
913
+ interface GetProviderKycResponse {
914
+ success: boolean;
915
+ messages: string[];
916
+ result: ProviderKyc;
917
+ }
918
+
756
919
  type Currency = "USD" | "SLE";
757
920
 
758
- declare function FinancialAccountAPI(client: MonimeClient): {
921
+ declare function FinancialAccountAPI(config: ClientConfig): {
759
922
  create: (name: string, currency: Currency) => Promise<{
760
923
  success: boolean;
761
924
  data?: CreateFinancialAccount;
@@ -871,7 +1034,7 @@ interface Amount {
871
1034
  value: number;
872
1035
  }
873
1036
 
874
- declare function FinancialTransactionAPI(client: MonimeClient): {
1037
+ declare function FinancialTransactionAPI(config: ClientConfig): {
875
1038
  get: (transactionId: string) => Promise<{
876
1039
  success: boolean;
877
1040
  error?: Error;
@@ -884,7 +1047,7 @@ declare function FinancialTransactionAPI(client: MonimeClient): {
884
1047
  }>;
885
1048
  };
886
1049
 
887
- declare function InternalTransferAPI(client: MonimeClient): {
1050
+ declare function InternalTransferAPI(config: ClientConfig): {
888
1051
  create: (sourceAccount: string, destinationAccount: string, amount: number) => Promise<{
889
1052
  success: boolean;
890
1053
  data?: CreateInternalTransfer;
@@ -906,7 +1069,25 @@ declare function InternalTransferAPI(client: MonimeClient): {
906
1069
  }>;
907
1070
  };
908
1071
 
909
- declare function PaymentCodeAPI(client: MonimeClient): {
1072
+ declare function PaymentAPI(config: ClientConfig): {
1073
+ get: (paymentId: string) => Promise<{
1074
+ success: boolean;
1075
+ data?: GetPayment;
1076
+ error?: Error;
1077
+ }>;
1078
+ getAll: (params?: Record<string, any>) => Promise<{
1079
+ success: boolean;
1080
+ data?: ListPayments;
1081
+ error?: Error;
1082
+ }>;
1083
+ patch: (paymentId: string, body: Record<string, any>) => Promise<{
1084
+ success: boolean;
1085
+ data?: PatchPayment;
1086
+ error?: Error;
1087
+ }>;
1088
+ };
1089
+
1090
+ declare function PaymentCodeAPI(config: ClientConfig): {
910
1091
  create: (paymentName: string, amount: number, financialAccount: string, username: string, phoneNumber: string) => Promise<{
911
1092
  success: boolean;
912
1093
  data?: CreatePaymentCode;
@@ -928,7 +1109,7 @@ declare function PaymentCodeAPI(client: MonimeClient): {
928
1109
  }>;
929
1110
  };
930
1111
 
931
- declare function PayoutAPI(client: MonimeClient): {
1112
+ declare function PayoutAPI(config: ClientConfig): {
932
1113
  create: (amount: number, destination: DestinationOption, sourceAccount: string) => Promise<{
933
1114
  success: boolean;
934
1115
  data?: CreatePayout;
@@ -950,26 +1131,85 @@ declare function PayoutAPI(client: MonimeClient): {
950
1131
  }>;
951
1132
  };
952
1133
 
1134
+ declare function ProviderKycAPI(config: ClientConfig): {
1135
+ get: (providerId: string) => Promise<{
1136
+ success: boolean;
1137
+ data?: GetProviderKycResponse;
1138
+ error?: Error;
1139
+ }>;
1140
+ };
1141
+
1142
+ declare function ReceiptAPI(config: ClientConfig): {
1143
+ get: (orderNumber: string) => Promise<{
1144
+ success: boolean;
1145
+ data?: GetReceiptResponse;
1146
+ error?: Error;
1147
+ }>;
1148
+ redeem: (orderNumber: string, body?: Record<string, any>) => Promise<{
1149
+ success: boolean;
1150
+ data?: RedeemReceiptResponse;
1151
+ error?: Error;
1152
+ }>;
1153
+ };
1154
+
1155
+ declare function UssdOtpAPI(config: ClientConfig): {
1156
+ create: (body: CreateUssdOtpRequest) => Promise<{
1157
+ success: boolean;
1158
+ data?: CreateUssdOtpResponse;
1159
+ error?: Error;
1160
+ }>;
1161
+ };
1162
+
1163
+ declare function WebhookAPI(config: ClientConfig): {
1164
+ create: (body: CreateWebhookRequest) => Promise<{
1165
+ success: boolean;
1166
+ data?: CreateWebhookResponse;
1167
+ error?: Error;
1168
+ }>;
1169
+ get: (webhookId: string) => Promise<{
1170
+ success: boolean;
1171
+ data?: GetWebhookResponse;
1172
+ error?: Error;
1173
+ }>;
1174
+ getAll: () => Promise<{
1175
+ success: boolean;
1176
+ data?: ListWebhooksResponse;
1177
+ error?: Error;
1178
+ }>;
1179
+ update: (webhookId: string, body: UpdateWebhookRequest) => Promise<{
1180
+ success: boolean;
1181
+ data?: UpdateWebhookResponse;
1182
+ error?: Error;
1183
+ }>;
1184
+ delete: (webhookId: string) => Promise<{
1185
+ success: boolean;
1186
+ error?: Error;
1187
+ }>;
1188
+ };
1189
+
953
1190
  interface ClientOptions {
954
1191
  monimeSpaceId: string;
955
1192
  accessToken: string;
1193
+ monimeVersion?: "caph.2025-08-23" | "caph.2025-06-20";
956
1194
  }
957
1195
  declare class MonimeClient {
958
1196
  private monimeSpaceId;
959
1197
  private accessToken;
1198
+ private monimeVersion?;
960
1199
  financialAccount: ReturnType<typeof FinancialAccountAPI>;
961
1200
  internalTransfer: ReturnType<typeof InternalTransferAPI>;
962
1201
  paymentCode: ReturnType<typeof PaymentCodeAPI>;
1202
+ payment: ReturnType<typeof PaymentAPI>;
963
1203
  payout: ReturnType<typeof PayoutAPI>;
1204
+ providerKyc: ReturnType<typeof ProviderKycAPI>;
1205
+ receipt: ReturnType<typeof ReceiptAPI>;
1206
+ ussdOtp: ReturnType<typeof UssdOtpAPI>;
1207
+ webhook: ReturnType<typeof WebhookAPI>;
964
1208
  financialTransaction: ReturnType<typeof FinancialTransactionAPI>;
965
1209
  checkoutSession: ReturnType<typeof CheckoutSessionAPI>;
966
1210
  constructor(options: ClientOptions);
967
- _getConfig(): {
968
- monimeSpaceId: string;
969
- accessToken: string;
970
- };
971
1211
  }
972
1212
 
973
1213
  declare function createClient(options: ClientOptions): MonimeClient;
974
1214
 
975
- export { type AllFinancialAccount, type AllInternalTransfers, type ClientOptions, type CreateFinancialAccount, type CreateInternalTransfer, type CreatePaymentCode, type CreatePayout, type DestinationOption, type GetAll, type GetAllPaymentCode, type GetFinancialAccount, type GetOne, type GetOnePayout, type InternalTransfer, MonimeClient, createClient };
1215
+ export { type AllFinancialAccount, type AllInternalTransfers, type ClientOptions, type CreateFinancialAccount, type CreateInternalTransfer, type CreatePaymentCode, type CreatePayout, type CreateUssdOtpRequest, type CreateUssdOtpResponse, type CreateWebhookRequest, type CreateWebhookResponse, type DestinationOption, type GetAll, type GetAllPaymentCode, type GetFinancialAccount, type GetOne, type GetOnePayout, type GetPayment, type GetProviderKycResponse, type GetReceiptResponse, type GetWebhookResponse, type InternalTransfer, type ListPayments, type ListWebhooksResponse, MonimeClient, type PatchPayment, type Payment, type ProviderKyc, type Receipt, type RedeemReceiptResponse, type UpdateWebhookRequest, type UpdateWebhookResponse, type UssdOtp, type Webhook, type WebhookVerificationMethod, createClient };