@crediblemark/buayar 0.2.0 → 0.2.1
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 +12 -2
- package/dist/index.d.mts +68 -2
- package/dist/index.d.ts +68 -2
- package/dist/index.js +497 -4
- package/dist/index.mjs +491 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,6 +85,13 @@
|
|
|
85
85
|
* Verifikasi Header & Webhook otomatis.
|
|
86
86
|
* Ekstensi `OyClient` (Inquiry Status, Saldo Merchant & Kirim Uang/Disbursement).
|
|
87
87
|
|
|
88
|
+
* 🏛️ **[Integrasi Stripe (docs/stripe.md)](file:///media/rasyiqi/7653717A1C07B131/Buayar/docs/stripe.md)**
|
|
89
|
+
* Checkout Sessions API (Redirect Hosted Page, multi-currency).
|
|
90
|
+
* Payment Intents API Direct Charge (Kartu Kredit, Debit, Google Pay, Apple Pay, dll).
|
|
91
|
+
* Verifikasi webhook signature HMAC-SHA256 otomatis.
|
|
92
|
+
* Ekstensi `StripeClient` (Retrieve Session, Retrieve Intent, Refund, Saldo Merchant).
|
|
93
|
+
* ⚠️ **Catatan**: Stripe tidak mendukung Virtual Account lokal Indonesia. Cocok untuk pembayaran internasional / kartu kredit global.
|
|
94
|
+
|
|
88
95
|
---
|
|
89
96
|
|
|
90
97
|
## ⚙️ Konfigurasi Environment Variables (`.env`)
|
|
@@ -93,8 +100,8 @@ SDK `Buayar` membaca konfigurasi secara otomatis dari `process.env`. Anda dapat
|
|
|
93
100
|
|
|
94
101
|
### 1. Standar Universal (Direkomendasikan)
|
|
95
102
|
```env
|
|
96
|
-
# Provider aktif: 'midtrans' | 'duitku' | 'ipaymu' | 'xendit' | 'doku' | 'prismalink' | 'faspay' | 'finpay' | 'nicepay' | 'oy'
|
|
97
|
-
PROVIDER_PG=
|
|
103
|
+
# Provider aktif: 'midtrans' | 'duitku' | 'ipaymu' | 'xendit' | 'doku' | 'prismalink' | 'faspay' | 'finpay' | 'nicepay' | 'oy' | 'stripe'
|
|
104
|
+
PROVIDER_PG=stripe
|
|
98
105
|
|
|
99
106
|
# Kredensial Universal
|
|
100
107
|
BUAYAR_MERCHANT_CODE=myusername # Username OY! Bisnis
|
|
@@ -136,6 +143,9 @@ BUAYAR_RETURN_URL=https://myapp.com/payment/finish
|
|
|
136
143
|
| `NICEPAY_KEY` | Nicepay | Merchant Key rahasia Nicepay. |
|
|
137
144
|
| `OY_USERNAME` | OY! Bisnis | Username akun OY! Bisnis. |
|
|
138
145
|
| `OY_API_KEY` | OY! Bisnis | API Key OY! Bisnis. |
|
|
146
|
+
| `STRIPE_SECRET_KEY` | Stripe | Secret Key Stripe (`sk_test_...` / `sk_live_...`). **Wajib.** |
|
|
147
|
+
| `STRIPE_WEBHOOK_SECRET` | Stripe | Webhook Signing Secret Stripe (`whsec_...`). Wajib untuk verifikasi callback. |
|
|
148
|
+
| `STRIPE_PUBLIC_KEY` | Stripe | Publishable Key Stripe (`pk_test_...` / `pk_live_...`). Opsional, untuk frontend. |
|
|
139
149
|
| `BUAYAR_API_KEY` / `PG_API_KEY` / `PAYMENT_API_KEY` | Semua | API Key / Server Key universal. |
|
|
140
150
|
| `BUAYAR_MERCHANT_CODE` / `PG_MERCHANT_CODE` | Duitku / Umum | Kode merchant dari dashboard payment gateway. |
|
|
141
151
|
| `BUAYAR_SANDBOX` / `PG_SANDBOX` / `PAYMENT_SANDBOX` | Semua | Mode sandbox (`true` / `false`). |
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,11 @@ interface CreateInvoiceParams {
|
|
|
19
19
|
* Jika dikosongkan, akan beralih ke Mode Semi Integrasi (Redirect Checkout).
|
|
20
20
|
*/
|
|
21
21
|
paymentMethod?: CanonicalPaymentMethod | string;
|
|
22
|
+
/**
|
|
23
|
+
* Kode mata uang ISO 4217 (opsional). Default: 'IDR'.
|
|
24
|
+
* Contoh: 'idr', 'usd', 'sgd'
|
|
25
|
+
*/
|
|
26
|
+
currency?: string;
|
|
22
27
|
/** Parameter kustom tambahan untuk provider spesifik (opsional) */
|
|
23
28
|
providerParams?: any;
|
|
24
29
|
}
|
|
@@ -335,6 +340,15 @@ declare class OyProvider extends BasePaymentProvider {
|
|
|
335
340
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
336
341
|
}
|
|
337
342
|
|
|
343
|
+
declare class StripeProvider extends BasePaymentProvider {
|
|
344
|
+
readonly name = "stripe";
|
|
345
|
+
private getBaseUrl;
|
|
346
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
347
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
348
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
349
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
350
|
+
}
|
|
351
|
+
|
|
338
352
|
interface DuitkuDisbursementParams {
|
|
339
353
|
bankCode: string;
|
|
340
354
|
bankAccount: string;
|
|
@@ -628,6 +642,36 @@ declare class OyClient {
|
|
|
628
642
|
}): Promise<any>;
|
|
629
643
|
}
|
|
630
644
|
|
|
645
|
+
declare class StripeClient {
|
|
646
|
+
private secretKey;
|
|
647
|
+
constructor(config: ProviderConfig | {
|
|
648
|
+
apiKey?: string;
|
|
649
|
+
serverKey?: string;
|
|
650
|
+
secretKey?: string;
|
|
651
|
+
});
|
|
652
|
+
private getBaseUrl;
|
|
653
|
+
/**
|
|
654
|
+
* Helper HTTP Request ke Stripe API
|
|
655
|
+
*/
|
|
656
|
+
request(method: "GET" | "POST" | "DELETE", endpoint: string, body?: any): Promise<any>;
|
|
657
|
+
/**
|
|
658
|
+
* Ambil detail Checkout Session
|
|
659
|
+
*/
|
|
660
|
+
retrieveCheckoutSession(sessionId: string): Promise<any>;
|
|
661
|
+
/**
|
|
662
|
+
* Ambil detail Payment Intent
|
|
663
|
+
*/
|
|
664
|
+
retrievePaymentIntent(paymentIntentId: string): Promise<any>;
|
|
665
|
+
/**
|
|
666
|
+
* Cek saldo akun Stripe (Balance)
|
|
667
|
+
*/
|
|
668
|
+
checkBalance(): Promise<any>;
|
|
669
|
+
/**
|
|
670
|
+
* Buat refund dana
|
|
671
|
+
*/
|
|
672
|
+
createRefund(paymentIntentId: string, amount?: number): Promise<any>;
|
|
673
|
+
}
|
|
674
|
+
|
|
631
675
|
declare class PaymentManager {
|
|
632
676
|
private providers;
|
|
633
677
|
constructor();
|
|
@@ -653,6 +697,8 @@ declare class PaymentManager {
|
|
|
653
697
|
getNicepayClient(config: ProviderConfig): NicepayClient;
|
|
654
698
|
getOyProvider(): OyProvider;
|
|
655
699
|
getOyClient(config: ProviderConfig): OyClient;
|
|
700
|
+
getStripeProvider(): StripeProvider;
|
|
701
|
+
getStripeClient(config: ProviderConfig): StripeClient;
|
|
656
702
|
createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
657
703
|
verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
658
704
|
getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
@@ -690,7 +736,7 @@ declare class Buayar {
|
|
|
690
736
|
*/
|
|
691
737
|
setConfig(config: Partial<BuayarConfig>): void;
|
|
692
738
|
/**
|
|
693
|
-
* Dapatkan nama provider aktif ('midtrans' | 'duitku' | 'ipaymu' | 'xendit' | 'doku' | 'prismalink' | 'faspay' | 'finpay' | 'nicepay' | 'oy' | ...)
|
|
739
|
+
* Dapatkan nama provider aktif ('midtrans' | 'duitku' | 'ipaymu' | 'xendit' | 'doku' | 'prismalink' | 'faspay' | 'finpay' | 'nicepay' | 'oy' | 'stripe' | ...)
|
|
694
740
|
*/
|
|
695
741
|
get provider(): string;
|
|
696
742
|
/**
|
|
@@ -730,6 +776,7 @@ declare class Buayar {
|
|
|
730
776
|
getFinpayClient(configOverride?: Partial<ProviderConfig>): FinpayClient;
|
|
731
777
|
getNicepayClient(configOverride?: Partial<ProviderConfig>): NicepayClient;
|
|
732
778
|
getOyClient(configOverride?: Partial<ProviderConfig>): OyClient;
|
|
779
|
+
getStripeClient(configOverride?: Partial<ProviderConfig>): StripeClient;
|
|
733
780
|
}
|
|
734
781
|
declare const buayar: Buayar;
|
|
735
782
|
|
|
@@ -798,6 +845,10 @@ declare const CANONICAL_TO_OY: Record<string, {
|
|
|
798
845
|
bank_code?: string;
|
|
799
846
|
channel?: string;
|
|
800
847
|
}>;
|
|
848
|
+
/**
|
|
849
|
+
* Mapping dari Canonical Payment Method ke payment_method_types Stripe
|
|
850
|
+
*/
|
|
851
|
+
declare const CANONICAL_TO_STRIPE: Record<string, string>;
|
|
801
852
|
/**
|
|
802
853
|
* Ubah method code apapun (baik canonical maupun kode raw provider) ke kode Duitku yang valid
|
|
803
854
|
*/
|
|
@@ -852,6 +903,10 @@ declare function toOyPaymentMethod(code?: string): {
|
|
|
852
903
|
bank_code?: string;
|
|
853
904
|
channel?: string;
|
|
854
905
|
} | undefined;
|
|
906
|
+
/**
|
|
907
|
+
* Ubah method code apapun ke format Stripe
|
|
908
|
+
*/
|
|
909
|
+
declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
855
910
|
/**
|
|
856
911
|
* Ubah method code apapun ke format canonical standar Buayar
|
|
857
912
|
*/
|
|
@@ -979,6 +1034,17 @@ declare function generateOyHeaders(username: string, apiKey: string): Record<str
|
|
|
979
1034
|
*/
|
|
980
1035
|
declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
|
|
981
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* Serializer helper untuk format URL-encoded form data Stripe
|
|
1039
|
+
* Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
|
|
1040
|
+
*/
|
|
1041
|
+
declare function serializeStripeParams(obj: any, prefix?: string): string;
|
|
1042
|
+
/**
|
|
1043
|
+
* Verifikasi webhook signature Stripe (stripe-signature header)
|
|
1044
|
+
* Format header: t=1492774577,v1=5257a869e7ecebeda32affa62cd323fa9d214e1b50613e039f08f6362ced773d
|
|
1045
|
+
*/
|
|
1046
|
+
declare function verifyStripeWebhook(rawPayload: string | any, signatureHeader: string, webhookSecret: string, toleranceSeconds?: number): boolean;
|
|
1047
|
+
|
|
982
1048
|
/**
|
|
983
1049
|
* Generate MD5 hash string (lowercase)
|
|
984
1050
|
*/
|
|
@@ -1005,4 +1071,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1005
1071
|
*/
|
|
1006
1072
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1007
1073
|
|
|
1008
|
-
export { BasePaymentProvider, 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_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckTransactionParams, type CheckTransactionResult, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, 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, PrismalinkClient, PrismalinkProvider, type ProviderConfig, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildCoreChargePayload, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toXenditPaymentMethod, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPrismalinkSignature, verifyXenditWebhookToken };
|
|
1074
|
+
export { BasePaymentProvider, 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 CheckTransactionParams, type CheckTransactionResult, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, 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, PrismalinkClient, PrismalinkProvider, type ProviderConfig, StripeClient, StripeProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildCoreChargePayload, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializeStripeParams, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPrismalinkSignature, verifyStripeWebhook, verifyXenditWebhookToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ interface CreateInvoiceParams {
|
|
|
19
19
|
* Jika dikosongkan, akan beralih ke Mode Semi Integrasi (Redirect Checkout).
|
|
20
20
|
*/
|
|
21
21
|
paymentMethod?: CanonicalPaymentMethod | string;
|
|
22
|
+
/**
|
|
23
|
+
* Kode mata uang ISO 4217 (opsional). Default: 'IDR'.
|
|
24
|
+
* Contoh: 'idr', 'usd', 'sgd'
|
|
25
|
+
*/
|
|
26
|
+
currency?: string;
|
|
22
27
|
/** Parameter kustom tambahan untuk provider spesifik (opsional) */
|
|
23
28
|
providerParams?: any;
|
|
24
29
|
}
|
|
@@ -335,6 +340,15 @@ declare class OyProvider extends BasePaymentProvider {
|
|
|
335
340
|
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
336
341
|
}
|
|
337
342
|
|
|
343
|
+
declare class StripeProvider extends BasePaymentProvider {
|
|
344
|
+
readonly name = "stripe";
|
|
345
|
+
private getBaseUrl;
|
|
346
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
347
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
348
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
349
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
350
|
+
}
|
|
351
|
+
|
|
338
352
|
interface DuitkuDisbursementParams {
|
|
339
353
|
bankCode: string;
|
|
340
354
|
bankAccount: string;
|
|
@@ -628,6 +642,36 @@ declare class OyClient {
|
|
|
628
642
|
}): Promise<any>;
|
|
629
643
|
}
|
|
630
644
|
|
|
645
|
+
declare class StripeClient {
|
|
646
|
+
private secretKey;
|
|
647
|
+
constructor(config: ProviderConfig | {
|
|
648
|
+
apiKey?: string;
|
|
649
|
+
serverKey?: string;
|
|
650
|
+
secretKey?: string;
|
|
651
|
+
});
|
|
652
|
+
private getBaseUrl;
|
|
653
|
+
/**
|
|
654
|
+
* Helper HTTP Request ke Stripe API
|
|
655
|
+
*/
|
|
656
|
+
request(method: "GET" | "POST" | "DELETE", endpoint: string, body?: any): Promise<any>;
|
|
657
|
+
/**
|
|
658
|
+
* Ambil detail Checkout Session
|
|
659
|
+
*/
|
|
660
|
+
retrieveCheckoutSession(sessionId: string): Promise<any>;
|
|
661
|
+
/**
|
|
662
|
+
* Ambil detail Payment Intent
|
|
663
|
+
*/
|
|
664
|
+
retrievePaymentIntent(paymentIntentId: string): Promise<any>;
|
|
665
|
+
/**
|
|
666
|
+
* Cek saldo akun Stripe (Balance)
|
|
667
|
+
*/
|
|
668
|
+
checkBalance(): Promise<any>;
|
|
669
|
+
/**
|
|
670
|
+
* Buat refund dana
|
|
671
|
+
*/
|
|
672
|
+
createRefund(paymentIntentId: string, amount?: number): Promise<any>;
|
|
673
|
+
}
|
|
674
|
+
|
|
631
675
|
declare class PaymentManager {
|
|
632
676
|
private providers;
|
|
633
677
|
constructor();
|
|
@@ -653,6 +697,8 @@ declare class PaymentManager {
|
|
|
653
697
|
getNicepayClient(config: ProviderConfig): NicepayClient;
|
|
654
698
|
getOyProvider(): OyProvider;
|
|
655
699
|
getOyClient(config: ProviderConfig): OyClient;
|
|
700
|
+
getStripeProvider(): StripeProvider;
|
|
701
|
+
getStripeClient(config: ProviderConfig): StripeClient;
|
|
656
702
|
createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
657
703
|
verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
658
704
|
getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
@@ -690,7 +736,7 @@ declare class Buayar {
|
|
|
690
736
|
*/
|
|
691
737
|
setConfig(config: Partial<BuayarConfig>): void;
|
|
692
738
|
/**
|
|
693
|
-
* Dapatkan nama provider aktif ('midtrans' | 'duitku' | 'ipaymu' | 'xendit' | 'doku' | 'prismalink' | 'faspay' | 'finpay' | 'nicepay' | 'oy' | ...)
|
|
739
|
+
* Dapatkan nama provider aktif ('midtrans' | 'duitku' | 'ipaymu' | 'xendit' | 'doku' | 'prismalink' | 'faspay' | 'finpay' | 'nicepay' | 'oy' | 'stripe' | ...)
|
|
694
740
|
*/
|
|
695
741
|
get provider(): string;
|
|
696
742
|
/**
|
|
@@ -730,6 +776,7 @@ declare class Buayar {
|
|
|
730
776
|
getFinpayClient(configOverride?: Partial<ProviderConfig>): FinpayClient;
|
|
731
777
|
getNicepayClient(configOverride?: Partial<ProviderConfig>): NicepayClient;
|
|
732
778
|
getOyClient(configOverride?: Partial<ProviderConfig>): OyClient;
|
|
779
|
+
getStripeClient(configOverride?: Partial<ProviderConfig>): StripeClient;
|
|
733
780
|
}
|
|
734
781
|
declare const buayar: Buayar;
|
|
735
782
|
|
|
@@ -798,6 +845,10 @@ declare const CANONICAL_TO_OY: Record<string, {
|
|
|
798
845
|
bank_code?: string;
|
|
799
846
|
channel?: string;
|
|
800
847
|
}>;
|
|
848
|
+
/**
|
|
849
|
+
* Mapping dari Canonical Payment Method ke payment_method_types Stripe
|
|
850
|
+
*/
|
|
851
|
+
declare const CANONICAL_TO_STRIPE: Record<string, string>;
|
|
801
852
|
/**
|
|
802
853
|
* Ubah method code apapun (baik canonical maupun kode raw provider) ke kode Duitku yang valid
|
|
803
854
|
*/
|
|
@@ -852,6 +903,10 @@ declare function toOyPaymentMethod(code?: string): {
|
|
|
852
903
|
bank_code?: string;
|
|
853
904
|
channel?: string;
|
|
854
905
|
} | undefined;
|
|
906
|
+
/**
|
|
907
|
+
* Ubah method code apapun ke format Stripe
|
|
908
|
+
*/
|
|
909
|
+
declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
855
910
|
/**
|
|
856
911
|
* Ubah method code apapun ke format canonical standar Buayar
|
|
857
912
|
*/
|
|
@@ -979,6 +1034,17 @@ declare function generateOyHeaders(username: string, apiKey: string): Record<str
|
|
|
979
1034
|
*/
|
|
980
1035
|
declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
|
|
981
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* Serializer helper untuk format URL-encoded form data Stripe
|
|
1039
|
+
* Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
|
|
1040
|
+
*/
|
|
1041
|
+
declare function serializeStripeParams(obj: any, prefix?: string): string;
|
|
1042
|
+
/**
|
|
1043
|
+
* Verifikasi webhook signature Stripe (stripe-signature header)
|
|
1044
|
+
* Format header: t=1492774577,v1=5257a869e7ecebeda32affa62cd323fa9d214e1b50613e039f08f6362ced773d
|
|
1045
|
+
*/
|
|
1046
|
+
declare function verifyStripeWebhook(rawPayload: string | any, signatureHeader: string, webhookSecret: string, toleranceSeconds?: number): boolean;
|
|
1047
|
+
|
|
982
1048
|
/**
|
|
983
1049
|
* Generate MD5 hash string (lowercase)
|
|
984
1050
|
*/
|
|
@@ -1005,4 +1071,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1005
1071
|
*/
|
|
1006
1072
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1007
1073
|
|
|
1008
|
-
export { BasePaymentProvider, 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_XENDIT, CORE_API_METHODS, type CanonicalPaymentMethod, type CheckTransactionParams, type CheckTransactionResult, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, 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, PrismalinkClient, PrismalinkProvider, type ProviderConfig, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildCoreChargePayload, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toXenditPaymentMethod, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPrismalinkSignature, verifyXenditWebhookToken };
|
|
1074
|
+
export { BasePaymentProvider, 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 CheckTransactionParams, type CheckTransactionResult, type CreateInvoiceParams, type CustomerDetails, DUITKU_TO_CANONICAL, 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, PrismalinkClient, PrismalinkProvider, type ProviderConfig, StripeClient, StripeProvider, type VerifyCallbackResult, XenditClient, type XenditDisbursementParams, XenditProvider, buayar, buildCoreChargePayload, formatNicepayTimestamp, generateDokuHeaders, generateFaspaySignature, generateFinpaySignature, generateIpaymuSignature, generateNicepayToken, generateOyHeaders, generatePrismalinkSignature, getDuitkuInquirySignatures, getDuitkuPaymentMethodsSignature, getDuitkuStatusSignatures, getPaymentMethodCategory, getXenditAuthHeader, hmacSha256, md5, parseCoreChargeResponse, paymentManager, resolveConfigFromEnv, safeCompare, serializeStripeParams, sha256, sha512, toCanonicalPaymentMethod, toDokuPaymentMethod, toDuitkuPaymentMethod, toFaspayPaymentMethod, toFinpayPaymentMethod, toIpaymuPaymentMethod, toNicepayPaymentMethod, toOyPaymentMethod, toPrismalinkPaymentMethod, toStripePaymentMethod, toXenditPaymentMethod, verifyDokuWebhookSignature, verifyDuitkuCallbackSignature, verifyFaspaySignature, verifyFinpaySignature, verifyIpaymuCallback, verifyNicepayWebhook, verifyOyWebhook, verifyPrismalinkSignature, verifyStripeWebhook, verifyXenditWebhookToken };
|