@pague-dev/sdk-node 1.3.0 → 2.0.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.cjs CHANGED
@@ -226,7 +226,8 @@ function isValidWebhookEvent(event) {
226
226
  "payment_expired",
227
227
  "refund_completed",
228
228
  "withdrawal_completed",
229
- "withdrawal_failed"
229
+ "withdrawal_failed",
230
+ "withdrawal_reversed"
230
231
  ].includes(obj.event);
231
232
  }
232
233
  /**
package/dist/index.d.cts CHANGED
@@ -385,7 +385,7 @@ declare class Pdev {
385
385
  /**
386
386
  * Available webhook event types
387
387
  */
388
- type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed';
388
+ type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed' | 'withdrawal_reversed';
389
389
  /**
390
390
  * Base webhook payload structure
391
391
  */
@@ -432,8 +432,14 @@ interface PaymentCompletedData {
432
432
  interface PaymentExpiredData {
433
433
  /** Transaction identifier */
434
434
  transactionId: string;
435
+ /** Environment where the transaction occurred */
436
+ environment: 'production' | 'sandbox';
435
437
  /** Payment amount */
436
438
  amount: number;
439
+ /** Platform fees (always 0 for expired payments) */
440
+ feeAmount: number;
441
+ /** Net amount (always 0 for expired payments) */
442
+ netAmount: number;
437
443
  /** Currency code (e.g., "BRL") */
438
444
  currency: string;
439
445
  /** Payment method used (e.g., "pix") */
@@ -465,10 +471,14 @@ interface RefundCompletedData {
465
471
  netAmount: number;
466
472
  /** Currency code (e.g., "BRL") */
467
473
  currency: string;
474
+ /** Payment method of the original transaction */
475
+ paymentMethod: string;
468
476
  /** Refund status */
469
477
  status: 'completed';
470
478
  /** ISO 8601 timestamp of when refund was completed */
471
- completedAt: string;
479
+ refundedAt: string;
480
+ /** Your external reference ID from the original payment (optional) */
481
+ externalReference?: string;
472
482
  /** Custom metadata from the original payment */
473
483
  metadata?: Record<string, unknown>;
474
484
  }
@@ -520,6 +530,35 @@ interface WithdrawalFailedData {
520
530
  /** Custom metadata from the withdrawal request */
521
531
  metadata?: Record<string, unknown>;
522
532
  }
533
+ /**
534
+ * Data payload for withdrawal_reversed event
535
+ */
536
+ interface WithdrawalReversedData {
537
+ /** Reversal transaction identifier */
538
+ reversalTransactionId: string;
539
+ /** Original withdrawal transaction ID that was reversed */
540
+ originalTransactionId: string;
541
+ /** Environment where the transaction occurred */
542
+ environment: 'production' | 'sandbox';
543
+ /** Reversal amount */
544
+ amount: number;
545
+ /** Fees charged for the reversal */
546
+ feeAmount: number;
547
+ /** Net amount after fees */
548
+ netAmount: number;
549
+ /** Currency code (e.g., "BRL") */
550
+ currency: string;
551
+ /** Payment method (e.g., "pix") */
552
+ paymentMethod: string;
553
+ /** Reversal status */
554
+ status: 'completed';
555
+ /** ISO 8601 timestamp of when withdrawal was reversed */
556
+ reversedAt: string;
557
+ /** Your external reference ID from the original withdrawal (optional) */
558
+ externalReference?: string;
559
+ /** Custom metadata from the original withdrawal */
560
+ metadata?: Record<string, unknown>;
561
+ }
523
562
  /**
524
563
  * Payment completed webhook event
525
564
  */
@@ -540,10 +579,14 @@ type WithdrawalCompletedEvent = WebhookPayload<'withdrawal_completed', Withdrawa
540
579
  * Withdrawal failed webhook event
541
580
  */
542
581
  type WithdrawalFailedEvent = WebhookPayload<'withdrawal_failed', WithdrawalFailedData>;
582
+ /**
583
+ * Withdrawal reversed webhook event
584
+ */
585
+ type WithdrawalReversedEvent = WebhookPayload<'withdrawal_reversed', WithdrawalReversedData>;
543
586
  /**
544
587
  * Union type of all possible webhook events
545
588
  */
546
- type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent;
589
+ type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent | WithdrawalReversedEvent;
547
590
  /**
548
591
  * Webhook headers sent with each request
549
592
  */
@@ -633,4 +676,4 @@ interface WebhookHeaders {
633
676
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
634
677
  declare function parseWebhook(payload: string): WebhookEvent | null;
635
678
  //#endregion
636
- export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
679
+ export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalReversedData, WithdrawalReversedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
package/dist/index.d.mts CHANGED
@@ -385,7 +385,7 @@ declare class Pdev {
385
385
  /**
386
386
  * Available webhook event types
387
387
  */
388
- type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed';
388
+ type WebhookEventType = 'payment_completed' | 'payment_expired' | 'refund_completed' | 'withdrawal_completed' | 'withdrawal_failed' | 'withdrawal_reversed';
389
389
  /**
390
390
  * Base webhook payload structure
391
391
  */
@@ -432,8 +432,14 @@ interface PaymentCompletedData {
432
432
  interface PaymentExpiredData {
433
433
  /** Transaction identifier */
434
434
  transactionId: string;
435
+ /** Environment where the transaction occurred */
436
+ environment: 'production' | 'sandbox';
435
437
  /** Payment amount */
436
438
  amount: number;
439
+ /** Platform fees (always 0 for expired payments) */
440
+ feeAmount: number;
441
+ /** Net amount (always 0 for expired payments) */
442
+ netAmount: number;
437
443
  /** Currency code (e.g., "BRL") */
438
444
  currency: string;
439
445
  /** Payment method used (e.g., "pix") */
@@ -465,10 +471,14 @@ interface RefundCompletedData {
465
471
  netAmount: number;
466
472
  /** Currency code (e.g., "BRL") */
467
473
  currency: string;
474
+ /** Payment method of the original transaction */
475
+ paymentMethod: string;
468
476
  /** Refund status */
469
477
  status: 'completed';
470
478
  /** ISO 8601 timestamp of when refund was completed */
471
- completedAt: string;
479
+ refundedAt: string;
480
+ /** Your external reference ID from the original payment (optional) */
481
+ externalReference?: string;
472
482
  /** Custom metadata from the original payment */
473
483
  metadata?: Record<string, unknown>;
474
484
  }
@@ -520,6 +530,35 @@ interface WithdrawalFailedData {
520
530
  /** Custom metadata from the withdrawal request */
521
531
  metadata?: Record<string, unknown>;
522
532
  }
533
+ /**
534
+ * Data payload for withdrawal_reversed event
535
+ */
536
+ interface WithdrawalReversedData {
537
+ /** Reversal transaction identifier */
538
+ reversalTransactionId: string;
539
+ /** Original withdrawal transaction ID that was reversed */
540
+ originalTransactionId: string;
541
+ /** Environment where the transaction occurred */
542
+ environment: 'production' | 'sandbox';
543
+ /** Reversal amount */
544
+ amount: number;
545
+ /** Fees charged for the reversal */
546
+ feeAmount: number;
547
+ /** Net amount after fees */
548
+ netAmount: number;
549
+ /** Currency code (e.g., "BRL") */
550
+ currency: string;
551
+ /** Payment method (e.g., "pix") */
552
+ paymentMethod: string;
553
+ /** Reversal status */
554
+ status: 'completed';
555
+ /** ISO 8601 timestamp of when withdrawal was reversed */
556
+ reversedAt: string;
557
+ /** Your external reference ID from the original withdrawal (optional) */
558
+ externalReference?: string;
559
+ /** Custom metadata from the original withdrawal */
560
+ metadata?: Record<string, unknown>;
561
+ }
523
562
  /**
524
563
  * Payment completed webhook event
525
564
  */
@@ -540,10 +579,14 @@ type WithdrawalCompletedEvent = WebhookPayload<'withdrawal_completed', Withdrawa
540
579
  * Withdrawal failed webhook event
541
580
  */
542
581
  type WithdrawalFailedEvent = WebhookPayload<'withdrawal_failed', WithdrawalFailedData>;
582
+ /**
583
+ * Withdrawal reversed webhook event
584
+ */
585
+ type WithdrawalReversedEvent = WebhookPayload<'withdrawal_reversed', WithdrawalReversedData>;
543
586
  /**
544
587
  * Union type of all possible webhook events
545
588
  */
546
- type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent;
589
+ type WebhookEvent = PaymentCompletedEvent | PaymentExpiredEvent | RefundCompletedEvent | WithdrawalCompletedEvent | WithdrawalFailedEvent | WithdrawalReversedEvent;
547
590
  /**
548
591
  * Webhook headers sent with each request
549
592
  */
@@ -633,4 +676,4 @@ interface WebhookHeaders {
633
676
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
634
677
  declare function parseWebhook(payload: string): WebhookEvent | null;
635
678
  //#endregion
636
- export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
679
+ export { AccountDetail, AccountInfo, AccountStatus, BalanceAmount, BalanceDetail, Charge, ChargeStatus, CompanyDetail, CompanyStatus, CreateChargeOptions, CreateChargeResponse, CreateCustomerOptions, CreateCustomerResponse, CreatePixCustomer, CreatePixOptions, CreatePixResponse, CreateProjectOptions, CreateProjectResponse, CreateStaticQrCodeOptions, CreateStaticQrCodeResponse, CreateWithdrawalOptions, CreateWithdrawalResponse, Customer, DocumentType, type ErrorResponse, GetChargeResponse, GetTransactionResponse, ListChargesOptions, ListChargesResponse, ListCustomersOptions, ListCustomersResponse, ListProjectsOptions, ListProjectsResponse, NotificationType, type PaginatedResponse, type PaginationOptions, PaymentCompletedData, PaymentCompletedEvent, PaymentExpiredData, PaymentExpiredEvent, PaymentMethod, Pdev, PixCharge, PixKeyType, PixStatus, Project, RefundCompletedData, RefundCompletedEvent, type Response, SortBy, SortOrder, StaticQrCode, Transaction, TransactionPaymentMethod, TransactionStatus, TransactionType, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayload, Withdrawal, WithdrawalCompletedData, WithdrawalCompletedEvent, WithdrawalFailedData, WithdrawalFailedEvent, WithdrawalReversedData, WithdrawalReversedEvent, WithdrawalStatus, parseWebhook, verifyWebhookSignature };
package/dist/index.mjs CHANGED
@@ -226,7 +226,8 @@ function isValidWebhookEvent(event) {
226
226
  "payment_expired",
227
227
  "refund_completed",
228
228
  "withdrawal_completed",
229
- "withdrawal_failed"
229
+ "withdrawal_failed",
230
+ "withdrawal_reversed"
230
231
  ].includes(obj.event);
231
232
  }
232
233
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pague-dev/sdk-node",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "Node.js SDK for the pague.dev API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",