@crediblemark/buayar 0.5.1 → 0.6.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/dist/index.d.mts CHANGED
@@ -346,10 +346,38 @@ declare class XenditProvider extends BasePaymentProvider {
346
346
  declare class DokuProvider extends BasePaymentProvider {
347
347
  readonly name = "doku";
348
348
  private getBaseUrl;
349
+ /**
350
+ * DETEKSI mode integrasi DOKU:
351
+ * - SNAP : kredensial baru (Client ID `doku_...` + Secret Key `SK-...`) + opsional RSA privateKey
352
+ * untuk Get Token B2B. Diaktifkan via extra.snap / extra.dokuMode="snap" / doku_ prefix.
353
+ * - Legacy: Jokul v2 (Client-Id + Signature HMAC-SHA256), default jika bukan SNAP.
354
+ */
355
+ private isSnap;
356
+ private buildSnap;
357
+ /** Helper: jumlah integer → format SNAP 2-desimal (".00"). */
358
+ private snapAmount;
349
359
  createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
360
+ /**
361
+ * DOKU SNAP: buat transaksi (Create VA / Generate QRIS / e-Wallet Payment).
362
+ * Autentikasi via B2B token + symmetric HMAC-SHA512 signature.
363
+ */
364
+ private createSnapInvoice;
365
+ /** Create Virtual Account (SNAP) — DOKU Generate Payment Code. */
366
+ private snapCreateVA;
367
+ /** Generate QRIS (SNAP) — dynamic QRIS MPM. */
368
+ private snapGenerateQRIS;
369
+ /** e-Wallet payment (SNAP) — DANA / OVO / ShopeePay via payment-host-to-host. */
370
+ private snapEWalletPayment;
350
371
  verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
372
+ /**
373
+ * Verifikasi webhook / notifikasi DOKU SNAP.
374
+ * Signature dibangun dengan symmetric HMAC-SHA512 (AccessToken kosong).
375
+ */
376
+ private verifySnapCallback;
351
377
  getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
352
378
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
379
+ /** Cek status transaksi SNAP (menggunakan Query QRIS bila ref berasal dari QRIS). */
380
+ private snapCheckTransaction;
353
381
  }
354
382
 
355
383
  declare class PrismalinkProvider extends BasePaymentProvider {
@@ -1297,6 +1325,67 @@ declare function generateDokuHeaders(clientId: string, secretKey: string, reques
1297
1325
  */
1298
1326
  declare function verifyDokuWebhookSignature(headers: Record<string, string | string[] | undefined>, body: any, clientId: string, secretKey: string, requestTarget?: string): boolean;
1299
1327
 
1328
+ /**
1329
+ * DOKU SNAP (Standard Open API Pembayaran) helpers.
1330
+ *
1331
+ * SNAP is the Bank Indonesia standardized API that DOKU implements.
1332
+ * It differs from the legacy Jokul v2 HMAC flow:
1333
+ *
1334
+ * 1. Get B2B Access Token (ASYMETRIC):
1335
+ * POST /authorization/v1/access-token/b2b
1336
+ * X-SIGNATURE = Base64( SHA256withRSA( privateKey, clientId + "|" + X-TIMESTAMP ) )
1337
+ * → accessToken (Bearer), expiresIn ~900s
1338
+ *
1339
+ * 2. Transaction (e.g. Create VA / Generate QRIS / e-Wallet) (SYMETRIC):
1340
+ * stringToSign =
1341
+ * HTTPMethod + ":" + EndpointUrl + ":" + AccessToken + ":" +
1342
+ * Lowercase(HexEncode( SHA-256( minify(requestBody) ) )) + ":" + X-TIMESTAMP
1343
+ * X-SIGNATURE = HMAC-SHA512( clientSecret, stringToSign )
1344
+ * Headers: X-PARTNER-ID, X-EXTERNAL-ID, X-TIMESTAMP, CHANNEL-ID, Authorization: Bearer
1345
+ *
1346
+ * 3. Notification / webhook verification (SYMETRIC, same formula as #2 with
1347
+ * AccessToken = "" and EndpointUrl = merchant notification path).
1348
+ */
1349
+ /** YYYY-MM-DDTHH:mm:ss+07:00 (DOKU accepts +07:00 offset) */
1350
+ declare function snapTimestamp(date?: Date): string;
1351
+ /** Compact (minified) JSON — whitespace removed, used as signature input. */
1352
+ declare function minifyJson(obj: any): string;
1353
+ /** Lowercase hex SHA-256 of a minified JSON body. */
1354
+ declare function sha256Hex(body: any): string;
1355
+ /**
1356
+ * Symmetric signature (HMAC-SHA512) used for all SNAP transaction requests
1357
+ * and for verifying incoming DOKU notifications.
1358
+ *
1359
+ * @param clientSecret The DOKU Secret Key (`SK-...`).
1360
+ * @param method HTTP method, e.g. "POST".
1361
+ * @param endpointUrl Request-target path (no host), e.g. "/virtual-accounts/..."
1362
+ * @param accessToken B2B access token WITHOUT the "Bearer " prefix.
1363
+ * @param body request body object or raw string.
1364
+ * @param timestamp X-TIMESTAMP value (must match).
1365
+ */
1366
+ declare function generateSnapSymmetricSignature(clientSecret: string, method: string, endpointUrl: string, accessToken: string, body: any, timestamp: string): string;
1367
+ /**
1368
+ * Asymmetric signature (SHA256withRSA) used to obtain the B2B access token.
1369
+ *
1370
+ * @param privateKey RSA private key (PEM or base64 raw).
1371
+ * @param clientId Client ID (`doku_key_...`).
1372
+ * @param timestamp X-TIMESTAMP value (must match).
1373
+ * @returns Base64 signature.
1374
+ */
1375
+ declare function generateSnapAsymmetricSignature(privateKey: string, clientId: string, timestamp: string): string;
1376
+ /** Generate a unique X-EXTERNAL-ID (numeric request id, unique per day). */
1377
+ declare function snapExternalId(prefix?: string): string;
1378
+ /**
1379
+ * Verify an incoming DOKU SNAP webhook notification signature.
1380
+ *
1381
+ * @param headers Incoming request headers (canonical keys assumed).
1382
+ * @param body Parsed request body.
1383
+ * @param clientSecret DOKU Secret Key.
1384
+ * @param endpointUrl Your notification URL request-target, e.g. "/payments/notifications".
1385
+ * @returns true when the X-SIGNATURE matches.
1386
+ */
1387
+ declare function verifySnapWebhookSignature(headers: Record<string, string | string[] | undefined>, body: any, clientSecret: string, endpointUrl?: string): boolean;
1388
+
1300
1389
  /**
1301
1390
  * Generate signature PrismaLink
1302
1391
  *
@@ -1450,6 +1539,47 @@ declare function buildTwoCheckoutAuth(merchantCode: string, secretKey: string):
1450
1539
  */
1451
1540
  declare function verifyTwoCheckoutWebhook(secretWord: string, saleId: string, productId: string, invoiceId: string, providedHash: string): boolean;
1452
1541
 
1542
+ interface SnapClientOptions {
1543
+ clientId: string;
1544
+ clientSecret: string;
1545
+ privateKey?: string;
1546
+ sandbox?: boolean;
1547
+ merchantId?: string;
1548
+ terminalId?: string;
1549
+ partnerServiceId?: string;
1550
+ channelId?: string;
1551
+ }
1552
+ /**
1553
+ * DOKU SNAP HTTP client: handles B2B token caching + signed requests
1554
+ * (Create VA, Generate QRIS, e-Wallet payment, query/status).
1555
+ */
1556
+ declare class SnapClient {
1557
+ private options;
1558
+ private token;
1559
+ private tokenExpiry;
1560
+ constructor(options: Partial<ProviderConfig> & SnapClientOptions);
1561
+ get baseUrl(): string;
1562
+ get isConfigured(): boolean;
1563
+ /**
1564
+ * Get (cached) B2B access token. Mints a new one when expired.
1565
+ */
1566
+ getAccessToken(): Promise<string>;
1567
+ clearToken(): void;
1568
+ /**
1569
+ * Perform a signed SNAP transaction request.
1570
+ * @param method GET/POST
1571
+ * @param endpoint request-target path (e.g. /virtual-accounts/...)
1572
+ * @param body request body (object)
1573
+ * @param opts extra headers (X-DEVICE-ID, X-IP-ADDRESS, etc.)
1574
+ */
1575
+ request(method: "GET" | "POST", endpoint: string, body?: any, opts?: {
1576
+ externalId?: string;
1577
+ deviceId?: string;
1578
+ ipAddress?: string;
1579
+ extraHeaders?: Record<string, string>;
1580
+ }): Promise<any>;
1581
+ }
1582
+
1453
1583
  /**
1454
1584
  * Generate MD5 hash string (lowercase)
1455
1585
  */
@@ -1479,4 +1609,4 @@ declare function safeCompare(a: string, b: string): boolean;
1479
1609
  */
1480
1610
  declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
1481
1611
 
1482
- export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, Buayar, type BuayarConfig, CANONICAL_TO_DOKU, CANONICAL_TO_DUITKU, CANONICAL_TO_FASPAY, CANONICAL_TO_FINPAY, CANONICAL_TO_IPAYMU, CANONICAL_TO_MIDTRANS, CANONICAL_TO_NICEPAY, CANONICAL_TO_OY, CANONICAL_TO_PRISMALINK, CANONICAL_TO_STRIPE, CANONICAL_TO_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodsParams, type GetPaymentMethodsResult, type InvoiceResponse, IpaymuClient, IpaymuProvider, MIDTRANS_PROBE_PAYLOADS, MIDTRANS_STATIC_METHODS, type MandiriBillInfo, MidtransClient, MidtransProvider, NicepayClient, NicepayProvider, OyClient, OyProvider, PaymentManager, type PaymentMethod, type PaymentMethodItem, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderConfig, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SquareClient, SquareProvider, StripeClient, StripeProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
1612
+ export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, Buayar, type BuayarConfig, CANONICAL_TO_DOKU, CANONICAL_TO_DUITKU, CANONICAL_TO_FASPAY, CANONICAL_TO_FINPAY, CANONICAL_TO_IPAYMU, CANONICAL_TO_MIDTRANS, CANONICAL_TO_NICEPAY, CANONICAL_TO_OY, CANONICAL_TO_PRISMALINK, CANONICAL_TO_STRIPE, CANONICAL_TO_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodsParams, type GetPaymentMethodsResult, type InvoiceResponse, IpaymuClient, IpaymuProvider, MIDTRANS_PROBE_PAYLOADS, MIDTRANS_STATIC_METHODS, type MandiriBillInfo, MidtransClient, MidtransProvider, NicepayClient, NicepayProvider, OyClient, OyProvider, PaymentManager, type PaymentMethod, type PaymentMethodItem, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderConfig, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SnapClient, type SnapClientOptions, SquareClient, SquareProvider, StripeClient, StripeProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, minifyJson, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha256Hex, sha512, snapExternalId, snapTimestamp, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
package/dist/index.d.ts CHANGED
@@ -346,10 +346,38 @@ declare class XenditProvider extends BasePaymentProvider {
346
346
  declare class DokuProvider extends BasePaymentProvider {
347
347
  readonly name = "doku";
348
348
  private getBaseUrl;
349
+ /**
350
+ * DETEKSI mode integrasi DOKU:
351
+ * - SNAP : kredensial baru (Client ID `doku_...` + Secret Key `SK-...`) + opsional RSA privateKey
352
+ * untuk Get Token B2B. Diaktifkan via extra.snap / extra.dokuMode="snap" / doku_ prefix.
353
+ * - Legacy: Jokul v2 (Client-Id + Signature HMAC-SHA256), default jika bukan SNAP.
354
+ */
355
+ private isSnap;
356
+ private buildSnap;
357
+ /** Helper: jumlah integer → format SNAP 2-desimal (".00"). */
358
+ private snapAmount;
349
359
  createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
360
+ /**
361
+ * DOKU SNAP: buat transaksi (Create VA / Generate QRIS / e-Wallet Payment).
362
+ * Autentikasi via B2B token + symmetric HMAC-SHA512 signature.
363
+ */
364
+ private createSnapInvoice;
365
+ /** Create Virtual Account (SNAP) — DOKU Generate Payment Code. */
366
+ private snapCreateVA;
367
+ /** Generate QRIS (SNAP) — dynamic QRIS MPM. */
368
+ private snapGenerateQRIS;
369
+ /** e-Wallet payment (SNAP) — DANA / OVO / ShopeePay via payment-host-to-host. */
370
+ private snapEWalletPayment;
350
371
  verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
372
+ /**
373
+ * Verifikasi webhook / notifikasi DOKU SNAP.
374
+ * Signature dibangun dengan symmetric HMAC-SHA512 (AccessToken kosong).
375
+ */
376
+ private verifySnapCallback;
351
377
  getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
352
378
  checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
379
+ /** Cek status transaksi SNAP (menggunakan Query QRIS bila ref berasal dari QRIS). */
380
+ private snapCheckTransaction;
353
381
  }
354
382
 
355
383
  declare class PrismalinkProvider extends BasePaymentProvider {
@@ -1297,6 +1325,67 @@ declare function generateDokuHeaders(clientId: string, secretKey: string, reques
1297
1325
  */
1298
1326
  declare function verifyDokuWebhookSignature(headers: Record<string, string | string[] | undefined>, body: any, clientId: string, secretKey: string, requestTarget?: string): boolean;
1299
1327
 
1328
+ /**
1329
+ * DOKU SNAP (Standard Open API Pembayaran) helpers.
1330
+ *
1331
+ * SNAP is the Bank Indonesia standardized API that DOKU implements.
1332
+ * It differs from the legacy Jokul v2 HMAC flow:
1333
+ *
1334
+ * 1. Get B2B Access Token (ASYMETRIC):
1335
+ * POST /authorization/v1/access-token/b2b
1336
+ * X-SIGNATURE = Base64( SHA256withRSA( privateKey, clientId + "|" + X-TIMESTAMP ) )
1337
+ * → accessToken (Bearer), expiresIn ~900s
1338
+ *
1339
+ * 2. Transaction (e.g. Create VA / Generate QRIS / e-Wallet) (SYMETRIC):
1340
+ * stringToSign =
1341
+ * HTTPMethod + ":" + EndpointUrl + ":" + AccessToken + ":" +
1342
+ * Lowercase(HexEncode( SHA-256( minify(requestBody) ) )) + ":" + X-TIMESTAMP
1343
+ * X-SIGNATURE = HMAC-SHA512( clientSecret, stringToSign )
1344
+ * Headers: X-PARTNER-ID, X-EXTERNAL-ID, X-TIMESTAMP, CHANNEL-ID, Authorization: Bearer
1345
+ *
1346
+ * 3. Notification / webhook verification (SYMETRIC, same formula as #2 with
1347
+ * AccessToken = "" and EndpointUrl = merchant notification path).
1348
+ */
1349
+ /** YYYY-MM-DDTHH:mm:ss+07:00 (DOKU accepts +07:00 offset) */
1350
+ declare function snapTimestamp(date?: Date): string;
1351
+ /** Compact (minified) JSON — whitespace removed, used as signature input. */
1352
+ declare function minifyJson(obj: any): string;
1353
+ /** Lowercase hex SHA-256 of a minified JSON body. */
1354
+ declare function sha256Hex(body: any): string;
1355
+ /**
1356
+ * Symmetric signature (HMAC-SHA512) used for all SNAP transaction requests
1357
+ * and for verifying incoming DOKU notifications.
1358
+ *
1359
+ * @param clientSecret The DOKU Secret Key (`SK-...`).
1360
+ * @param method HTTP method, e.g. "POST".
1361
+ * @param endpointUrl Request-target path (no host), e.g. "/virtual-accounts/..."
1362
+ * @param accessToken B2B access token WITHOUT the "Bearer " prefix.
1363
+ * @param body request body object or raw string.
1364
+ * @param timestamp X-TIMESTAMP value (must match).
1365
+ */
1366
+ declare function generateSnapSymmetricSignature(clientSecret: string, method: string, endpointUrl: string, accessToken: string, body: any, timestamp: string): string;
1367
+ /**
1368
+ * Asymmetric signature (SHA256withRSA) used to obtain the B2B access token.
1369
+ *
1370
+ * @param privateKey RSA private key (PEM or base64 raw).
1371
+ * @param clientId Client ID (`doku_key_...`).
1372
+ * @param timestamp X-TIMESTAMP value (must match).
1373
+ * @returns Base64 signature.
1374
+ */
1375
+ declare function generateSnapAsymmetricSignature(privateKey: string, clientId: string, timestamp: string): string;
1376
+ /** Generate a unique X-EXTERNAL-ID (numeric request id, unique per day). */
1377
+ declare function snapExternalId(prefix?: string): string;
1378
+ /**
1379
+ * Verify an incoming DOKU SNAP webhook notification signature.
1380
+ *
1381
+ * @param headers Incoming request headers (canonical keys assumed).
1382
+ * @param body Parsed request body.
1383
+ * @param clientSecret DOKU Secret Key.
1384
+ * @param endpointUrl Your notification URL request-target, e.g. "/payments/notifications".
1385
+ * @returns true when the X-SIGNATURE matches.
1386
+ */
1387
+ declare function verifySnapWebhookSignature(headers: Record<string, string | string[] | undefined>, body: any, clientSecret: string, endpointUrl?: string): boolean;
1388
+
1300
1389
  /**
1301
1390
  * Generate signature PrismaLink
1302
1391
  *
@@ -1450,6 +1539,47 @@ declare function buildTwoCheckoutAuth(merchantCode: string, secretKey: string):
1450
1539
  */
1451
1540
  declare function verifyTwoCheckoutWebhook(secretWord: string, saleId: string, productId: string, invoiceId: string, providedHash: string): boolean;
1452
1541
 
1542
+ interface SnapClientOptions {
1543
+ clientId: string;
1544
+ clientSecret: string;
1545
+ privateKey?: string;
1546
+ sandbox?: boolean;
1547
+ merchantId?: string;
1548
+ terminalId?: string;
1549
+ partnerServiceId?: string;
1550
+ channelId?: string;
1551
+ }
1552
+ /**
1553
+ * DOKU SNAP HTTP client: handles B2B token caching + signed requests
1554
+ * (Create VA, Generate QRIS, e-Wallet payment, query/status).
1555
+ */
1556
+ declare class SnapClient {
1557
+ private options;
1558
+ private token;
1559
+ private tokenExpiry;
1560
+ constructor(options: Partial<ProviderConfig> & SnapClientOptions);
1561
+ get baseUrl(): string;
1562
+ get isConfigured(): boolean;
1563
+ /**
1564
+ * Get (cached) B2B access token. Mints a new one when expired.
1565
+ */
1566
+ getAccessToken(): Promise<string>;
1567
+ clearToken(): void;
1568
+ /**
1569
+ * Perform a signed SNAP transaction request.
1570
+ * @param method GET/POST
1571
+ * @param endpoint request-target path (e.g. /virtual-accounts/...)
1572
+ * @param body request body (object)
1573
+ * @param opts extra headers (X-DEVICE-ID, X-IP-ADDRESS, etc.)
1574
+ */
1575
+ request(method: "GET" | "POST", endpoint: string, body?: any, opts?: {
1576
+ externalId?: string;
1577
+ deviceId?: string;
1578
+ ipAddress?: string;
1579
+ extraHeaders?: Record<string, string>;
1580
+ }): Promise<any>;
1581
+ }
1582
+
1453
1583
  /**
1454
1584
  * Generate MD5 hash string (lowercase)
1455
1585
  */
@@ -1479,4 +1609,4 @@ declare function safeCompare(a: string, b: string): boolean;
1479
1609
  */
1480
1610
  declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
1481
1611
 
1482
- export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, Buayar, type BuayarConfig, CANONICAL_TO_DOKU, CANONICAL_TO_DUITKU, CANONICAL_TO_FASPAY, CANONICAL_TO_FINPAY, CANONICAL_TO_IPAYMU, CANONICAL_TO_MIDTRANS, CANONICAL_TO_NICEPAY, CANONICAL_TO_OY, CANONICAL_TO_PRISMALINK, CANONICAL_TO_STRIPE, CANONICAL_TO_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodsParams, type GetPaymentMethodsResult, type InvoiceResponse, IpaymuClient, IpaymuProvider, MIDTRANS_PROBE_PAYLOADS, MIDTRANS_STATIC_METHODS, type MandiriBillInfo, MidtransClient, MidtransProvider, NicepayClient, NicepayProvider, OyClient, OyProvider, PaymentManager, type PaymentMethod, type PaymentMethodItem, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderConfig, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SquareClient, SquareProvider, StripeClient, StripeProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };
1612
+ export { AdyenClient, AdyenProvider, BasePaymentProvider, BraintreeClient, BraintreeProvider, Buayar, type BuayarConfig, CANONICAL_TO_DOKU, CANONICAL_TO_DUITKU, CANONICAL_TO_FASPAY, CANONICAL_TO_FINPAY, CANONICAL_TO_IPAYMU, CANONICAL_TO_MIDTRANS, CANONICAL_TO_NICEPAY, CANONICAL_TO_OY, CANONICAL_TO_PRISMALINK, CANONICAL_TO_STRIPE, CANONICAL_TO_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckBalanceResult, type CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, type DisburseParams, type DisburseResult, DokuClient, DokuProvider, DuitkuClient, type DuitkuDisbursementParams, DuitkuProvider, FaspayClient, FaspayProvider, FinpayClient, FinpayProvider, type GetPaymentMethodsParams, type GetPaymentMethodsResult, type InvoiceResponse, IpaymuClient, IpaymuProvider, MIDTRANS_PROBE_PAYLOADS, MIDTRANS_STATIC_METHODS, type MandiriBillInfo, MidtransClient, MidtransProvider, NicepayClient, NicepayProvider, OyClient, OyProvider, PaymentManager, type PaymentMethod, type PaymentMethodItem, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderConfig, RazorpayClient, RazorpayProvider, type RefundParams, type RefundResult, SnapClient, type SnapClientOptions, SquareClient, SquareProvider, StripeClient, StripeProvider, TwoCheckoutClient, TwoCheckoutProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildBraintreeBasicAuth, buildCoreChargePayload, buildPaypalBasicAuth, buildPayuBasicAuth, buildRazorpayBasicAuth, buildTwoCheckoutAuth, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, generateSnapAsymmetricSignature, generateSnapSymmetricSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, minifyJson, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializePaypalParams, serializeStripeParams, sha256, sha256Hex, sha512, snapExternalId, snapTimestamp, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyAdyenWebhook, verifyBraintreeWebhook, verifyCheckoutComWebhook, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPaypalWebhookSimple, verifyPayuWebhook, verifyPrismalinkSignature, verifyRazorpayWebhook, verifySnapWebhookSignature, verifySquareWebhook, verifyStripeWebhook, verifyTwoCheckoutWebhook, verifyXenditWebhookToken };