@crediblemark/buayar 0.2.0 → 0.3.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 +12 -2
- package/dist/index.d.mts +383 -2
- package/dist/index.d.ts +383 -2
- package/dist/index.js +3772 -541
- package/dist/index.mjs +3736 -541
- 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,96 @@ 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
|
+
|
|
352
|
+
declare class PaypalProvider extends BasePaymentProvider {
|
|
353
|
+
readonly name = "paypal";
|
|
354
|
+
private getSandbox;
|
|
355
|
+
private getBaseUrl;
|
|
356
|
+
/** OAuth2 Client Credentials — dapatkan access token */
|
|
357
|
+
private getAccessToken;
|
|
358
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
359
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
360
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
361
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
declare class AdyenProvider extends BasePaymentProvider {
|
|
365
|
+
readonly name = "adyen";
|
|
366
|
+
private getBaseUrl;
|
|
367
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
368
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
369
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
370
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare class CheckoutComProvider extends BasePaymentProvider {
|
|
374
|
+
readonly name = "checkoutcom";
|
|
375
|
+
private getBaseUrl;
|
|
376
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
377
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
378
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
379
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
declare class RazorpayProvider extends BasePaymentProvider {
|
|
383
|
+
readonly name = "razorpay";
|
|
384
|
+
private getBaseUrl;
|
|
385
|
+
private buildHeaders;
|
|
386
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
387
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
388
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
389
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
declare class SquareProvider extends BasePaymentProvider {
|
|
393
|
+
readonly name = "square";
|
|
394
|
+
private getBaseUrl;
|
|
395
|
+
private buildHeaders;
|
|
396
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
397
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
398
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
399
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
declare class PayuProvider extends BasePaymentProvider {
|
|
403
|
+
readonly name = "payu";
|
|
404
|
+
private getBaseUrl;
|
|
405
|
+
/** OAuth2 Bearer Token untuk PayU */
|
|
406
|
+
private getAccessToken;
|
|
407
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
408
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
409
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
410
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
declare class BraintreeProvider extends BasePaymentProvider {
|
|
414
|
+
readonly name = "braintree";
|
|
415
|
+
private getBaseUrl;
|
|
416
|
+
private buildHeaders;
|
|
417
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
418
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
419
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
420
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
declare class TwoCheckoutProvider extends BasePaymentProvider {
|
|
424
|
+
readonly name = "twocheckout";
|
|
425
|
+
private getBaseUrl;
|
|
426
|
+
private buildHeaders;
|
|
427
|
+
createInvoice(params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
428
|
+
verifyCallback(body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
429
|
+
getPaymentMethods(params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
430
|
+
checkTransaction(params: CheckTransactionParams, config: ProviderConfig): Promise<CheckTransactionResult>;
|
|
431
|
+
}
|
|
432
|
+
|
|
338
433
|
interface DuitkuDisbursementParams {
|
|
339
434
|
bankCode: string;
|
|
340
435
|
bankAccount: string;
|
|
@@ -628,6 +723,165 @@ declare class OyClient {
|
|
|
628
723
|
}): Promise<any>;
|
|
629
724
|
}
|
|
630
725
|
|
|
726
|
+
declare class StripeClient {
|
|
727
|
+
private secretKey;
|
|
728
|
+
constructor(config: ProviderConfig | {
|
|
729
|
+
apiKey?: string;
|
|
730
|
+
serverKey?: string;
|
|
731
|
+
secretKey?: string;
|
|
732
|
+
});
|
|
733
|
+
private getBaseUrl;
|
|
734
|
+
/**
|
|
735
|
+
* Helper HTTP Request ke Stripe API
|
|
736
|
+
*/
|
|
737
|
+
request(method: "GET" | "POST" | "DELETE", endpoint: string, body?: any): Promise<any>;
|
|
738
|
+
/**
|
|
739
|
+
* Ambil detail Checkout Session
|
|
740
|
+
*/
|
|
741
|
+
retrieveCheckoutSession(sessionId: string): Promise<any>;
|
|
742
|
+
/**
|
|
743
|
+
* Ambil detail Payment Intent
|
|
744
|
+
*/
|
|
745
|
+
retrievePaymentIntent(paymentIntentId: string): Promise<any>;
|
|
746
|
+
/**
|
|
747
|
+
* Cek saldo akun Stripe (Balance)
|
|
748
|
+
*/
|
|
749
|
+
checkBalance(): Promise<any>;
|
|
750
|
+
/**
|
|
751
|
+
* Buat refund dana
|
|
752
|
+
*/
|
|
753
|
+
createRefund(paymentIntentId: string, amount?: number): Promise<any>;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
declare class PaypalClient {
|
|
757
|
+
private config;
|
|
758
|
+
constructor(config: ProviderConfig);
|
|
759
|
+
private getBaseUrl;
|
|
760
|
+
private getAccessToken;
|
|
761
|
+
/** Ambil detail order PayPal berdasarkan Order ID */
|
|
762
|
+
getOrder(orderId: string): Promise<any>;
|
|
763
|
+
/** Capture order PayPal (mengeksekusi pembayaran yang sudah diapprove buyer) */
|
|
764
|
+
captureOrder(orderId: string): Promise<any>;
|
|
765
|
+
/** Refund capture PayPal */
|
|
766
|
+
refundCapture(captureId: string, amount?: number, currency?: string): Promise<any>;
|
|
767
|
+
/** Cek saldo akun PayPal merchant (hanya tersedia di account via Seller REST API) */
|
|
768
|
+
checkBalance(): Promise<any>;
|
|
769
|
+
/** Verifikasi webhook via PayPal Webhook Verification API */
|
|
770
|
+
verifyWebhookSignature(webhookId: string, body: any, headers: Record<string, string>): Promise<boolean>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
declare class AdyenClient {
|
|
774
|
+
private config;
|
|
775
|
+
constructor(config: ProviderConfig);
|
|
776
|
+
private getBaseUrl;
|
|
777
|
+
private buildHeaders;
|
|
778
|
+
/** Ambil detail payment berdasarkan PSP Reference */
|
|
779
|
+
getPaymentDetails(pspReference: string): Promise<any>;
|
|
780
|
+
/** Batalkan payment (sebelum capture) */
|
|
781
|
+
cancelPayment(pspReference: string, merchantAccount?: string): Promise<any>;
|
|
782
|
+
/** Refund payment yang sudah di-capture */
|
|
783
|
+
refundPayment(pspReference: string, amount: number, currency: string, merchantAccount?: string): Promise<any>;
|
|
784
|
+
/** Capture authorized payment */
|
|
785
|
+
capturePayment(pspReference: string, amount: number, currency: string, merchantAccount?: string): Promise<any>;
|
|
786
|
+
/** Ambil daftar payment methods yang tersedia */
|
|
787
|
+
getAvailablePaymentMethods(merchantAccount: string, countryCode: string, currency: string, amount: number): Promise<any>;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
declare class CheckoutComClient {
|
|
791
|
+
private config;
|
|
792
|
+
constructor(config: ProviderConfig);
|
|
793
|
+
private getBaseUrl;
|
|
794
|
+
private buildHeaders;
|
|
795
|
+
/** Ambil detail payment berdasarkan Payment ID */
|
|
796
|
+
getPaymentDetails(paymentId: string): Promise<any>;
|
|
797
|
+
/** Void (batalkan) payment yang belum di-capture */
|
|
798
|
+
voidPayment(paymentId: string, reference?: string): Promise<any>;
|
|
799
|
+
/** Refund payment yang sudah di-capture */
|
|
800
|
+
refundPayment(paymentId: string, amount?: number, reference?: string): Promise<any>;
|
|
801
|
+
/** Cek saldo merchant di Checkout.com */
|
|
802
|
+
checkBalance(): Promise<any>;
|
|
803
|
+
/** Ambil daftar payment links */
|
|
804
|
+
listPaymentLinks(): Promise<any>;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
declare class RazorpayClient {
|
|
808
|
+
private config;
|
|
809
|
+
constructor(config: ProviderConfig);
|
|
810
|
+
private getBaseUrl;
|
|
811
|
+
private buildHeaders;
|
|
812
|
+
/** Ambil detail payment */
|
|
813
|
+
fetchPayment(paymentId: string): Promise<any>;
|
|
814
|
+
/** Capture authorized payment */
|
|
815
|
+
capturePayment(paymentId: string, amount: number, currency?: string): Promise<any>;
|
|
816
|
+
/** Buat refund untuk payment */
|
|
817
|
+
createRefund(paymentId: string, amount?: number, notes?: Record<string, string>): Promise<any>;
|
|
818
|
+
/** Cek saldo akun Razorpay */
|
|
819
|
+
checkBalance(): Promise<any>;
|
|
820
|
+
/** Ambil daftar semua payment */
|
|
821
|
+
listPayments(from?: number, to?: number, count?: number): Promise<any>;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
declare class SquareClient {
|
|
825
|
+
private config;
|
|
826
|
+
constructor(config: ProviderConfig);
|
|
827
|
+
private getBaseUrl;
|
|
828
|
+
private buildHeaders;
|
|
829
|
+
/** Ambil detail payment Square */
|
|
830
|
+
getPayment(paymentId: string): Promise<any>;
|
|
831
|
+
/** Batalkan payment Square */
|
|
832
|
+
cancelPayment(paymentId: string): Promise<any>;
|
|
833
|
+
/** Refund payment Square */
|
|
834
|
+
refundPayment(paymentId: string, amount: number, currency: string, idempotencyKey: string, reason?: string): Promise<any>;
|
|
835
|
+
/** Ambil saldo location Square */
|
|
836
|
+
retrieveBalance(locationId?: string): Promise<any>;
|
|
837
|
+
/** List semua locations merchant */
|
|
838
|
+
listLocations(): Promise<any>;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
declare class PayuClient {
|
|
842
|
+
private config;
|
|
843
|
+
private accessToken;
|
|
844
|
+
constructor(config: ProviderConfig);
|
|
845
|
+
private getBaseUrl;
|
|
846
|
+
private getToken;
|
|
847
|
+
/** Ambil detail order PayU */
|
|
848
|
+
getOrder(orderId: string): Promise<any>;
|
|
849
|
+
/** Batalkan order PayU */
|
|
850
|
+
cancelOrder(orderId: string): Promise<any>;
|
|
851
|
+
/** Refund order PayU */
|
|
852
|
+
refundOrder(orderId: string, amount?: number, description?: string): Promise<any>;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
declare class BraintreeClient {
|
|
856
|
+
private config;
|
|
857
|
+
constructor(config: ProviderConfig);
|
|
858
|
+
private getBaseUrl;
|
|
859
|
+
private buildHeaders;
|
|
860
|
+
/** Generate Client Token untuk frontend Drop-in UI */
|
|
861
|
+
getClientToken(customerId?: string): Promise<string>;
|
|
862
|
+
/** Ambil detail transaction */
|
|
863
|
+
findTransaction(transactionId: string): Promise<any>;
|
|
864
|
+
/** Refund transaction Braintree */
|
|
865
|
+
refundTransaction(transactionId: string, amount?: number): Promise<any>;
|
|
866
|
+
/** Void (batalkan) transaction sebelum settlement */
|
|
867
|
+
voidTransaction(transactionId: string): Promise<any>;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
declare class TwoCheckoutClient {
|
|
871
|
+
private config;
|
|
872
|
+
constructor(config: ProviderConfig);
|
|
873
|
+
private getBaseUrl;
|
|
874
|
+
private buildHeaders;
|
|
875
|
+
/** Ambil detail order 2Checkout berdasarkan Reference Number */
|
|
876
|
+
getOrder(refNo: string): Promise<any>;
|
|
877
|
+
/** Refund order 2Checkout */
|
|
878
|
+
refundOrder(refNo: string, amount: number, comment?: string): Promise<any>;
|
|
879
|
+
/** Ambil detail subscription */
|
|
880
|
+
getSubscription(subscriptionRef: string): Promise<any>;
|
|
881
|
+
/** List semua orders merchant */
|
|
882
|
+
listOrders(page?: number, limit?: number): Promise<any>;
|
|
883
|
+
}
|
|
884
|
+
|
|
631
885
|
declare class PaymentManager {
|
|
632
886
|
private providers;
|
|
633
887
|
constructor();
|
|
@@ -653,6 +907,24 @@ declare class PaymentManager {
|
|
|
653
907
|
getNicepayClient(config: ProviderConfig): NicepayClient;
|
|
654
908
|
getOyProvider(): OyProvider;
|
|
655
909
|
getOyClient(config: ProviderConfig): OyClient;
|
|
910
|
+
getStripeProvider(): StripeProvider;
|
|
911
|
+
getStripeClient(config: ProviderConfig): StripeClient;
|
|
912
|
+
getPaypalProvider(): PaypalProvider;
|
|
913
|
+
getPaypalClient(config: ProviderConfig): PaypalClient;
|
|
914
|
+
getAdyenProvider(): AdyenProvider;
|
|
915
|
+
getAdyenClient(config: ProviderConfig): AdyenClient;
|
|
916
|
+
getCheckoutComProvider(): CheckoutComProvider;
|
|
917
|
+
getCheckoutComClient(config: ProviderConfig): CheckoutComClient;
|
|
918
|
+
getRazorpayProvider(): RazorpayProvider;
|
|
919
|
+
getRazorpayClient(config: ProviderConfig): RazorpayClient;
|
|
920
|
+
getSquareProvider(): SquareProvider;
|
|
921
|
+
getSquareClient(config: ProviderConfig): SquareClient;
|
|
922
|
+
getPayuProvider(): PayuProvider;
|
|
923
|
+
getPayuClient(config: ProviderConfig): PayuClient;
|
|
924
|
+
getBraintreeProvider(): BraintreeProvider;
|
|
925
|
+
getBraintreeClient(config: ProviderConfig): BraintreeClient;
|
|
926
|
+
getTwoCheckoutProvider(): TwoCheckoutProvider;
|
|
927
|
+
getTwoCheckoutClient(config: ProviderConfig): TwoCheckoutClient;
|
|
656
928
|
createInvoice(providerName: string, params: CreateInvoiceParams, config: ProviderConfig): Promise<InvoiceResponse>;
|
|
657
929
|
verifyCallback(providerName: string, body: any, config: ProviderConfig): Promise<VerifyCallbackResult>;
|
|
658
930
|
getPaymentMethods(providerName: string, params: GetPaymentMethodsParams, config: ProviderConfig): Promise<GetPaymentMethodsResult>;
|
|
@@ -676,6 +948,10 @@ declare function resolveConfigFromEnv(customConfig?: BuayarConfig): BuayarConfig
|
|
|
676
948
|
*
|
|
677
949
|
* Antarmuka tingkat tinggi untuk membuat transaksi, query channel pembayaran,
|
|
678
950
|
* pengecekan status, dan verifikasi webhook universal tanpa perlu rombak kode.
|
|
951
|
+
*
|
|
952
|
+
* Mendukung 19 Payment Gateway: Midtrans, Duitku, iPaymu, Xendit, DOKU, PrismaLink,
|
|
953
|
+
* Faspay, Finpay, Nicepay, OY! Bisnis, Stripe, PayPal, Adyen, Checkout.com,
|
|
954
|
+
* Razorpay, Square, PayU, Braintree, 2Checkout/Verifone.
|
|
679
955
|
*/
|
|
680
956
|
declare class Buayar {
|
|
681
957
|
private manager;
|
|
@@ -690,7 +966,7 @@ declare class Buayar {
|
|
|
690
966
|
*/
|
|
691
967
|
setConfig(config: Partial<BuayarConfig>): void;
|
|
692
968
|
/**
|
|
693
|
-
* Dapatkan nama provider aktif
|
|
969
|
+
* Dapatkan nama provider aktif
|
|
694
970
|
*/
|
|
695
971
|
get provider(): string;
|
|
696
972
|
/**
|
|
@@ -730,6 +1006,15 @@ declare class Buayar {
|
|
|
730
1006
|
getFinpayClient(configOverride?: Partial<ProviderConfig>): FinpayClient;
|
|
731
1007
|
getNicepayClient(configOverride?: Partial<ProviderConfig>): NicepayClient;
|
|
732
1008
|
getOyClient(configOverride?: Partial<ProviderConfig>): OyClient;
|
|
1009
|
+
getStripeClient(configOverride?: Partial<ProviderConfig>): StripeClient;
|
|
1010
|
+
getPaypalClient(configOverride?: Partial<ProviderConfig>): PaypalClient;
|
|
1011
|
+
getAdyenClient(configOverride?: Partial<ProviderConfig>): AdyenClient;
|
|
1012
|
+
getCheckoutComClient(configOverride?: Partial<ProviderConfig>): CheckoutComClient;
|
|
1013
|
+
getRazorpayClient(configOverride?: Partial<ProviderConfig>): RazorpayClient;
|
|
1014
|
+
getSquareClient(configOverride?: Partial<ProviderConfig>): SquareClient;
|
|
1015
|
+
getPayuClient(configOverride?: Partial<ProviderConfig>): PayuClient;
|
|
1016
|
+
getBraintreeClient(configOverride?: Partial<ProviderConfig>): BraintreeClient;
|
|
1017
|
+
getTwoCheckoutClient(configOverride?: Partial<ProviderConfig>): TwoCheckoutClient;
|
|
733
1018
|
}
|
|
734
1019
|
declare const buayar: Buayar;
|
|
735
1020
|
|
|
@@ -798,6 +1083,10 @@ declare const CANONICAL_TO_OY: Record<string, {
|
|
|
798
1083
|
bank_code?: string;
|
|
799
1084
|
channel?: string;
|
|
800
1085
|
}>;
|
|
1086
|
+
/**
|
|
1087
|
+
* Mapping dari Canonical Payment Method ke payment_method_types Stripe
|
|
1088
|
+
*/
|
|
1089
|
+
declare const CANONICAL_TO_STRIPE: Record<string, string>;
|
|
801
1090
|
/**
|
|
802
1091
|
* Ubah method code apapun (baik canonical maupun kode raw provider) ke kode Duitku yang valid
|
|
803
1092
|
*/
|
|
@@ -852,6 +1141,10 @@ declare function toOyPaymentMethod(code?: string): {
|
|
|
852
1141
|
bank_code?: string;
|
|
853
1142
|
channel?: string;
|
|
854
1143
|
} | undefined;
|
|
1144
|
+
/**
|
|
1145
|
+
* Ubah method code apapun ke format Stripe
|
|
1146
|
+
*/
|
|
1147
|
+
declare function toStripePaymentMethod(code?: string): string | undefined;
|
|
855
1148
|
/**
|
|
856
1149
|
* Ubah method code apapun ke format canonical standar Buayar
|
|
857
1150
|
*/
|
|
@@ -979,6 +1272,94 @@ declare function generateOyHeaders(username: string, apiKey: string): Record<str
|
|
|
979
1272
|
*/
|
|
980
1273
|
declare function verifyOyWebhook(headers: Record<string, string | string[] | undefined>, expectedUsername: string): boolean;
|
|
981
1274
|
|
|
1275
|
+
/**
|
|
1276
|
+
* Serializer helper untuk format URL-encoded form data Stripe
|
|
1277
|
+
* Mendukung nested object dan array seperti line_items[0][price_data][unit_amount]
|
|
1278
|
+
*/
|
|
1279
|
+
declare function serializeStripeParams(obj: any, prefix?: string): string;
|
|
1280
|
+
/**
|
|
1281
|
+
* Verifikasi webhook signature Stripe (stripe-signature header)
|
|
1282
|
+
* Format header: t=1492774577,v1=5257a869e7ecebeda32affa62cd323fa9d214e1b50613e039f08f6362ced773d
|
|
1283
|
+
*/
|
|
1284
|
+
declare function verifyStripeWebhook(rawPayload: string | any, signatureHeader: string, webhookSecret: string, toleranceSeconds?: number): boolean;
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Encode Basic Auth untuk PayPal REST API (client_id:client_secret)
|
|
1288
|
+
*/
|
|
1289
|
+
declare function buildPaypalBasicAuth(clientId: string, clientSecret: string): string;
|
|
1290
|
+
/**
|
|
1291
|
+
* Verifikasi PayPal webhook signature (simplified HMAC via transmission-sig header).
|
|
1292
|
+
* Full cert-chain verification tersedia via POST /v1/notifications/verify-webhook-signature.
|
|
1293
|
+
*/
|
|
1294
|
+
declare function verifyPaypalWebhookSimple(transmissionId: string, timestamp: string, webhookId: string, body: string, transmissionSig: string, certUrl: string): boolean;
|
|
1295
|
+
/**
|
|
1296
|
+
* Serialize object ke URL-encoded query string (shallow)
|
|
1297
|
+
*/
|
|
1298
|
+
declare function serializePaypalParams(obj: Record<string, any>): string;
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Verifikasi Adyen webhook signature (HMAC-SHA256).
|
|
1302
|
+
* Adyen menggunakan sorted key-value string dari notification item.
|
|
1303
|
+
*/
|
|
1304
|
+
declare function verifyAdyenWebhook(notificationItem: any, hmacKey: string): boolean;
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* Verifikasi Checkout.com webhook signature (HMAC-SHA256).
|
|
1308
|
+
* Header: Cko-Signature: sha256=<hex_digest>
|
|
1309
|
+
*/
|
|
1310
|
+
declare function verifyCheckoutComWebhook(body: string, signatureHeader: string, secret: string): boolean;
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Verifikasi Razorpay webhook signature (HMAC-SHA256).
|
|
1314
|
+
* Header: X-Razorpay-Signature
|
|
1315
|
+
*/
|
|
1316
|
+
declare function verifyRazorpayWebhook(rawBody: string, signature: string, webhookSecret: string): boolean;
|
|
1317
|
+
/**
|
|
1318
|
+
* Buat Basic Auth header untuk Razorpay (key_id:key_secret)
|
|
1319
|
+
*/
|
|
1320
|
+
declare function buildRazorpayBasicAuth(keyId: string, keySecret: string): string;
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Verifikasi Square webhook signature (HMAC-SHA256).
|
|
1324
|
+
* Header: x-square-hmacsha256-signature
|
|
1325
|
+
* Signature = Base64(HMAC-SHA256(signatureKey, notificationUrl + body))
|
|
1326
|
+
*/
|
|
1327
|
+
declare function verifySquareWebhook(rawBody: string, signatureHeader: string, signatureKey: string, notificationUrl: string): boolean;
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Verifikasi PayU webhook signature (MD5 atau SHA-256 dari OpenPayU-Signature header).
|
|
1331
|
+
* Format header: sender=checkout;signature=<md5_hash>;algorithm=MD5;version=2.1
|
|
1332
|
+
*/
|
|
1333
|
+
declare function verifyPayuWebhook(rawBody: string, signatureHeader: string, md5Key: string): boolean;
|
|
1334
|
+
/**
|
|
1335
|
+
* Build Basic Auth untuk PayU Token endpoint
|
|
1336
|
+
*/
|
|
1337
|
+
declare function buildPayuBasicAuth(clientId: string, clientSecret: string): string;
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Verifikasi Braintree webhook signature (SHA1 HMAC dari bt_payload).
|
|
1341
|
+
* Header contains: bt_signature=public_key|sha1_hmac & bt_payload=base64_encoded
|
|
1342
|
+
*/
|
|
1343
|
+
declare function verifyBraintreeWebhook(btSignature: string, btPayload: string, privateKey: string): boolean;
|
|
1344
|
+
/**
|
|
1345
|
+
* Build Basic Auth untuk Braintree API (public_key:private_key)
|
|
1346
|
+
*/
|
|
1347
|
+
declare function buildBraintreeBasicAuth(publicKey: string, privateKey: string): string;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Build 2Checkout API Authentication header.
|
|
1351
|
+
* Format: code=MERCHANT_CODE date=DATE hash=HMAC-SHA256(MERCHANT_CODE + date + secretKey)
|
|
1352
|
+
*/
|
|
1353
|
+
declare function buildTwoCheckoutAuth(merchantCode: string, secretKey: string): {
|
|
1354
|
+
header: string;
|
|
1355
|
+
date: string;
|
|
1356
|
+
};
|
|
1357
|
+
/**
|
|
1358
|
+
* Verifikasi 2Checkout IPN/webhook (MD5 hash).
|
|
1359
|
+
* hash = MD5(secretWord + saleId + productId + invoiceId)
|
|
1360
|
+
*/
|
|
1361
|
+
declare function verifyTwoCheckoutWebhook(secretWord: string, saleId: string, productId: string, invoiceId: string, providedHash: string): boolean;
|
|
1362
|
+
|
|
982
1363
|
/**
|
|
983
1364
|
* Generate MD5 hash string (lowercase)
|
|
984
1365
|
*/
|
|
@@ -1005,4 +1386,4 @@ declare function safeCompare(a: string, b: string): boolean;
|
|
|
1005
1386
|
*/
|
|
1006
1387
|
declare function getPaymentMethodCategory(code: string, name?: string): "Virtual Account" | "QRIS" | "E-Wallet" | "Retail / Gerai" | "Kartu Kredit" | "Paylater / Cicilan" | "Lainnya";
|
|
1007
1388
|
|
|
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 };
|
|
1389
|
+
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 CheckTransactionParams, type CheckTransactionResult, CheckoutComClient, CheckoutComProvider, 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, PaypalClient, PaypalProvider, PayuClient, PayuProvider, PrismalinkClient, PrismalinkProvider, type ProviderConfig, RazorpayClient, RazorpayProvider, 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 };
|