@zendfi/sdk 0.5.2 → 0.5.3

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.
@@ -532,6 +532,8 @@ interface ConfirmPaymentIntentRequest {
532
532
  auto_gasless?: boolean;
533
533
  /** Additional metadata */
534
534
  metadata?: Record<string, unknown>;
535
+ /** Session token for spending limit enforcement (optional) */
536
+ session_token?: string;
535
537
  }
536
538
  /**
537
539
  * Payment Intent Event
@@ -807,6 +809,233 @@ interface AgentAnalytics {
807
809
  volume_usd: number;
808
810
  }>;
809
811
  }
812
+ /**
813
+ * Session key creation request (custodial mode)
814
+ * Backend generates and stores the keypair
815
+ */
816
+ interface CreateSessionKeyRequest {
817
+ /** User's main wallet address */
818
+ user_wallet: string;
819
+ /** Spending limit in USDC */
820
+ limit_usdc: number;
821
+ /** Duration in days (1-30) */
822
+ duration_days?: number;
823
+ /** Device fingerprint for security */
824
+ device_fingerprint: string;
825
+ }
826
+ /**
827
+ * Session key creation response (custodial mode)
828
+ */
829
+ interface CreateSessionKeyResponse {
830
+ /** UUID of the created session key */
831
+ session_key_id: string;
832
+ /** User's main wallet address */
833
+ user_wallet: string;
834
+ /** Spending limit in USDC */
835
+ limit_usdc: number;
836
+ /** Expiration timestamp */
837
+ expires_at: string;
838
+ /** Whether user needs to sign approval transaction */
839
+ requires_approval: boolean;
840
+ /** Base64 encoded approval transaction (user must sign) */
841
+ approval_transaction: string;
842
+ /** Setup instructions */
843
+ instructions: SessionKeyInstructions;
844
+ }
845
+ interface SessionKeyInstructions {
846
+ step_1: string;
847
+ step_2: string;
848
+ step_3: string;
849
+ wallet_support: string[];
850
+ }
851
+ /**
852
+ * Device-bound session key creation request (non-custodial mode)
853
+ * Client generates keypair and encrypts it before sending
854
+ */
855
+ interface CreateDeviceBoundSessionKeyRequest {
856
+ /** User's main wallet address */
857
+ user_wallet: string;
858
+ /** Spending limit in USDC */
859
+ limit_usdc: number;
860
+ /** Duration in days (1-30) */
861
+ duration_days: number;
862
+ /** Client-encrypted session keypair (base64) */
863
+ encrypted_session_key: string;
864
+ /** Encryption nonce (base64, 12 bytes) */
865
+ nonce: string;
866
+ /** Public key of the session keypair */
867
+ session_public_key: string;
868
+ /** Device fingerprint (SHA-256 hex, 64 chars) */
869
+ device_fingerprint: string;
870
+ /** Optional recovery QR data */
871
+ recovery_qr_data?: string;
872
+ }
873
+ /**
874
+ * Device-bound session key creation response
875
+ */
876
+ interface CreateDeviceBoundSessionKeyResponse {
877
+ /** UUID of the created session key */
878
+ session_key_id: string;
879
+ /** Always "device_bound" */
880
+ mode: string;
881
+ /** Always false for device-bound */
882
+ is_custodial: boolean;
883
+ /** User's main wallet address */
884
+ user_wallet: string;
885
+ /** Session wallet public key */
886
+ session_wallet: string;
887
+ /** Spending limit in USDC */
888
+ limit_usdc: number;
889
+ /** Expiration timestamp */
890
+ expires_at: string;
891
+ /** Always true for device-bound */
892
+ requires_client_signing: boolean;
893
+ /** Security details */
894
+ security_info: SessionKeySecurityInfo;
895
+ }
896
+ interface SessionKeySecurityInfo {
897
+ encryption_type: string;
898
+ device_bound: boolean;
899
+ backend_can_decrypt: boolean;
900
+ recovery_qr_saved: boolean;
901
+ }
902
+ /**
903
+ * Session key status response
904
+ */
905
+ interface SessionKeyStatus {
906
+ /** UUID of the session key */
907
+ session_key_id: string;
908
+ /** Whether the key is currently active */
909
+ is_active: boolean;
910
+ /** Whether the approval transaction was confirmed */
911
+ is_approved: boolean;
912
+ /** Total spending limit in USDC */
913
+ limit_usdc: number;
914
+ /** Amount already spent in USDC */
915
+ used_amount_usdc: number;
916
+ /** Remaining balance in USDC */
917
+ remaining_usdc: number;
918
+ /** Expiration timestamp */
919
+ expires_at: string;
920
+ /** Days until expiry */
921
+ days_until_expiry: number;
922
+ /** Security status */
923
+ security_status: SecurityStatus;
924
+ }
925
+ interface SecurityStatus {
926
+ device_fingerprint_matched: boolean;
927
+ recent_security_events: number;
928
+ last_used_at: string | null;
929
+ }
930
+ /**
931
+ * Top-up request for adding funds to a session key
932
+ */
933
+ interface TopUpSessionKeyRequest {
934
+ /** User's main wallet address */
935
+ user_wallet: string;
936
+ /** Amount to add in USDC */
937
+ amount_usdc: number;
938
+ /** Device fingerprint for security */
939
+ device_fingerprint: string;
940
+ }
941
+ /**
942
+ * Top-up response with unsigned transaction
943
+ */
944
+ interface TopUpSessionKeyResponse {
945
+ /** UUID of the session key */
946
+ session_key_id: string;
947
+ /** Previous limit before top-up */
948
+ previous_limit: number;
949
+ /** New limit after top-up */
950
+ new_limit: number;
951
+ /** Amount being added */
952
+ added_amount: number;
953
+ /** Base64 encoded top-up transaction (user must sign) */
954
+ top_up_transaction: string;
955
+ /** Block height for transaction validity */
956
+ last_valid_block_height: number;
957
+ /** Instructions for the user */
958
+ instructions: string;
959
+ }
960
+ /**
961
+ * Submit signed transaction request
962
+ */
963
+ interface SubmitSignedTransactionRequest {
964
+ /** Base64 encoded signed transaction */
965
+ signed_transaction: string;
966
+ /** Optional session key ID (for some endpoints) */
967
+ session_key_id?: string;
968
+ }
969
+ /**
970
+ * Submit transaction response
971
+ */
972
+ interface SubmitTransactionResponse {
973
+ success: boolean;
974
+ signature: string;
975
+ message: string;
976
+ /** For top-up submissions */
977
+ new_limit?: number;
978
+ }
979
+ /**
980
+ * Session key list response
981
+ */
982
+ interface SessionKeyListResponse {
983
+ session_keys: SessionKeyStatus[];
984
+ stats: SessionKeyStats;
985
+ merchant_id: string;
986
+ }
987
+ interface SessionKeyStats {
988
+ total_keys: number;
989
+ active_keys: number;
990
+ total_limit_usdc: number;
991
+ total_used_usdc: number;
992
+ }
993
+ /**
994
+ * Agent payment request - simplified payment via session
995
+ */
996
+ interface AgentPaymentRequest {
997
+ /** Session token for spending limit enforcement */
998
+ session_token: string;
999
+ /** Amount in USD */
1000
+ amount: number;
1001
+ /** Payment description */
1002
+ description?: string;
1003
+ /** Recipient merchant ID (optional if paying to session owner) */
1004
+ recipient_merchant_id?: string;
1005
+ /** Token to use (default: USDC) */
1006
+ token?: PaymentToken;
1007
+ /** Auto-detect if gasless is needed */
1008
+ auto_gasless?: boolean;
1009
+ /** Additional metadata */
1010
+ metadata?: Record<string, any>;
1011
+ }
1012
+ /**
1013
+ * Agent payment response
1014
+ */
1015
+ interface AgentPaymentResponse {
1016
+ /** UUID of the created payment */
1017
+ payment_id: string;
1018
+ /** Payment status */
1019
+ status: 'pending' | 'processing' | 'confirmed' | 'failed' | 'awaiting_signature';
1020
+ /** Amount in USD */
1021
+ amount_usd: number;
1022
+ /** Whether gasless mode was used */
1023
+ gasless_used: boolean;
1024
+ /** Transaction signature (if confirmed) */
1025
+ transaction_signature?: string;
1026
+ /** Confirmation time in milliseconds */
1027
+ confirmed_in_ms?: number;
1028
+ /** Receipt URL */
1029
+ receipt_url?: string;
1030
+ /** If true, client must sign the transaction */
1031
+ requires_signature: boolean;
1032
+ /** Base64 encoded unsigned transaction (if requires_signature) */
1033
+ unsigned_transaction?: string;
1034
+ /** URL to submit signed transaction */
1035
+ submit_url?: string;
1036
+ /** Next steps for the client */
1037
+ next_steps: string;
1038
+ }
810
1039
 
811
1040
  /**
812
1041
  * ZendFi Webhook Handlers
@@ -866,4 +1095,4 @@ interface WebhookResult {
866
1095
  }
867
1096
  declare function processWebhook(a: any, b?: any, c?: any): Promise<WebhookResult>;
868
1097
 
869
- export { type PaymentLinkCode as $, type AgentApiKey as A, type CreateInvoiceRequest as B, type CreateAgentApiKeyRequest as C, type DisputeEscrowRequest as D, type EnableAutonomyRequest as E, type Invoice as F, type WebhookPayload as G, processWebhook as H, type InstallmentPlan as I, type WebhookResult as J, type WebhookEventHandler as K, type ListPaymentsRequest as L, type Brand as M, type PaymentId as N, type SessionId as O, type PaymentIntent as P, type AgentKeyId as Q, type RefundEscrowRequest as R, type SmartPaymentRequest as S, type MerchantId as T, type InvoiceId as U, type VerifyWebhookRequest as V, type WebhookHandlerConfig as W, type SubscriptionId as X, type EscrowId as Y, type ZendFiConfig as Z, type InstallmentPlanId as _, type WebhookHandlers as a, type IntentId as a0, asPaymentId as a1, asSessionId as a2, asAgentKeyId as a3, asMerchantId as a4, asInvoiceId as a5, asSubscriptionId as a6, asEscrowId as a7, asInstallmentPlanId as a8, asPaymentLinkCode as a9, asIntentId as aa, type Environment as ab, type ApiKeyMode as ac, type Currency as ad, type PaymentToken as ae, type PaymentStatus as af, type SubscriptionStatus as ag, type InstallmentPlanStatus as ah, type EscrowStatus as ai, type InvoiceStatus as aj, type SplitStatus as ak, type WebhookEvent as al, type SplitRecipient as am, type InstallmentScheduleItem as an, type CreateInstallmentPlanResponse as ao, type ReleaseCondition as ap, type InvoiceLineItem as aq, type ApiKeyScope as ar, type SessionLimits as as, type PaymentIntentStatus as at, type CaptureMethod as au, type UserProfile as av, type PPPConfig as aw, type AutonomousDelegate as ax, type RevokeAutonomyRequest as ay, type SmartPaymentStatus as az, type CreateAgentSessionRequest as b, type AgentSession as c, type AgentAnalytics as d, type CreatePaymentIntentRequest as e, type ConfirmPaymentIntentRequest as f, type PaymentIntentEvent as g, type PPPFactor as h, type PricingSuggestionRequest as i, type PricingSuggestion as j, type EnableAutonomyResponse as k, type AutonomyStatus as l, type SmartPaymentResponse as m, type CreatePaymentRequest as n, type Payment as o, type PaginatedResponse as p, type CreateSubscriptionPlanRequest as q, type SubscriptionPlan as r, type CreateSubscriptionRequest as s, type Subscription as t, type CreatePaymentLinkRequest as u, type PaymentLink as v, type CreateInstallmentPlanRequest as w, type CreateEscrowRequest as x, type Escrow as y, type ApproveEscrowRequest as z };
1098
+ export { processWebhook as $, type AgentApiKey as A, type PaginatedResponse as B, type CreateAgentApiKeyRequest as C, type CreateSubscriptionPlanRequest as D, type EnableAutonomyRequest as E, type SubscriptionPlan as F, type CreateSubscriptionRequest as G, type Subscription as H, type CreatePaymentLinkRequest as I, type PaymentLink as J, type CreateInstallmentPlanRequest as K, type ListPaymentsRequest as L, type InstallmentPlan as M, type CreateEscrowRequest as N, type Escrow as O, type PaymentIntent as P, type ApproveEscrowRequest as Q, type RefundEscrowRequest as R, type SmartPaymentRequest as S, type TopUpSessionKeyRequest as T, type DisputeEscrowRequest as U, type CreateInvoiceRequest as V, type WebhookHandlerConfig as W, type Invoice as X, type VerifyWebhookRequest as Y, type ZendFiConfig as Z, type WebhookPayload as _, type WebhookHandlers as a, type WebhookResult as a0, type WebhookEventHandler as a1, type Brand as a2, type PaymentId as a3, type SessionId as a4, type AgentKeyId as a5, type MerchantId as a6, type InvoiceId as a7, type SubscriptionId as a8, type EscrowId as a9, type CreateInstallmentPlanResponse as aA, type ReleaseCondition as aB, type InvoiceLineItem as aC, type ApiKeyScope as aD, type SessionLimits as aE, type PaymentIntentStatus as aF, type CaptureMethod as aG, type UserProfile as aH, type PPPConfig as aI, type AutonomousDelegate as aJ, type RevokeAutonomyRequest as aK, type SmartPaymentStatus as aL, type SessionKeyInstructions as aM, type SessionKeySecurityInfo as aN, type SecurityStatus as aO, type SessionKeyStats as aP, type InstallmentPlanId as aa, type PaymentLinkCode as ab, type IntentId as ac, asPaymentId as ad, asSessionId as ae, asAgentKeyId as af, asMerchantId as ag, asInvoiceId as ah, asSubscriptionId as ai, asEscrowId as aj, asInstallmentPlanId as ak, asPaymentLinkCode as al, asIntentId as am, type Environment as an, type ApiKeyMode as ao, type Currency as ap, type PaymentToken as aq, type PaymentStatus as ar, type SubscriptionStatus as as, type InstallmentPlanStatus as at, type EscrowStatus as au, type InvoiceStatus as av, type SplitStatus as aw, type WebhookEvent as ax, type SplitRecipient as ay, type InstallmentScheduleItem as az, type CreateAgentSessionRequest as b, type AgentSession as c, type AgentPaymentRequest as d, type AgentPaymentResponse as e, type AgentAnalytics as f, type CreatePaymentIntentRequest as g, type ConfirmPaymentIntentRequest as h, type PaymentIntentEvent as i, type PPPFactor as j, type PricingSuggestionRequest as k, type PricingSuggestion as l, type EnableAutonomyResponse as m, type AutonomyStatus as n, type SmartPaymentResponse as o, type CreateSessionKeyRequest as p, type CreateSessionKeyResponse as q, type CreateDeviceBoundSessionKeyRequest as r, type CreateDeviceBoundSessionKeyResponse as s, type SubmitSignedTransactionRequest as t, type SubmitTransactionResponse as u, type SessionKeyStatus as v, type SessionKeyListResponse as w, type TopUpSessionKeyResponse as x, type CreatePaymentRequest as y, type Payment as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendfi/sdk",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Zero-config TypeScript SDK for ZendFi crypto payments",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",