Skip to content

Commit b9f0713

Browse files
committed
add jsdoc comments to interfaces
1 parent 6b7dcc8 commit b9f0713

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

packages/paypal-js/types/v6/components/paypal-legacy-billing-agreements.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,41 @@ export type PayPalLegacyBillingAgreementsSession = Omit<
4343
) => Promise<void>;
4444
};
4545

46+
/**
47+
* Interface for PayPal legacy billing agreement functionality.
48+
*
49+
* @deprecated This interface provides legacy billing agreement methods that should not be used for new implementations.
50+
* Use the newer vault setup token approach with {@link PayPalPaymentsInstance.createPayPalSavePaymentSession} instead.
51+
*
52+
* @interface PayPalLegacyBillingInstance
53+
* @description Provides methods for creating billing agreements without requiring an immediate purchase.
54+
* This legacy interface allows merchants to set up recurring payment agreements with customers
55+
* that can be used for future transactions.
56+
*
57+
* @example
58+
* ```typescript
59+
* // Legacy billing agreement setup (deprecated)
60+
* const billingAgreementWithoutPurchaseSession = sdkInstance.createPayPalBillingAgreementWithoutPurchase({
61+
* billingToken: 'your-billing-token',
62+
* onApprove: (data) => {
63+
* console.log('Billing agreement approved:', data);
64+
* },
65+
* onCancel: () => {
66+
* console.log('Billing agreement canceled');
67+
* },
68+
* onError: (data) => {
69+
* console.error('Billing agreement error:', data);
70+
* }
71+
* });
72+
*
73+
* // Start the billing agreement flow
74+
* await billingAgreementWithoutPurchaseSession.start({
75+
* mode: 'popup'
76+
* });
77+
* ```
78+
*
79+
* @see {@link PayPalPaymentsInstance.createPayPalSavePaymentSession} For the recommended modern approach
80+
*/
4681
export interface PayPalLegacyBillingInstance {
4782
/**
4883
* Creates a PayPal billing agreement session without requiring an immediate purchase.

packages/paypal-js/types/v6/components/paypal-payments.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,33 @@ export type PayLaterOneTimePaymentSessionOptions =
121121
export type PayPalCreditOneTimePaymentSessionOptions =
122122
PayPalOneTimePaymentSessionOptions;
123123

124+
/**
125+
* PayPal Payments Instance interface for creating and managing different types of PayPal payment sessions.
126+
*
127+
* This interface provides methods to create various PayPal payment flows including:
128+
* - One-time payments with standard PayPal
129+
* - Save payment methods for future use (vaulting)
130+
* - PayPal Pay Later financing options
131+
* - PayPal Credit transactions
132+
*
133+
* Each method returns a payment session object that can be used to initiate the corresponding
134+
* payment flow with different presentation modes (popup, modal, redirect, etc.).
135+
*
136+
* @interface PayPalPaymentsInstance
137+
*
138+
* @example
139+
* ```typescript
140+
* // Create a one-time payment session
141+
* const paypalCheckout = sdkInstance.createPayPalOneTimePaymentSession({
142+
* onApprove: (data) => console.log('Payment approved:', data),
143+
* onCancel: () => console.log('Payment canceled'),
144+
* onError: (data) => console.error('Payment error:', data)
145+
* });
146+
*
147+
* // Start the payment flow
148+
* await paypalCheckout.start({ mode: 'auto' });
149+
* ```
150+
*/
124151
export interface PayPalPaymentsInstance {
125152
/**
126153
* Creates a PayPal one-time payment session for processing single payments through PayPal.

packages/paypal-js/types/v6/components/venmo-payments.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ export type VenmoOneTimePaymentSession = Omit<BasePaymentSession, "start"> & {
2626
) => Promise<void>;
2727
};
2828

29+
/**
30+
* Interface for managing Venmo payment operations within the PayPal SDK.
31+
* This interface provides methods for creating and managing Venmo payment sessions,
32+
* allowing merchants to integrate Venmo as a payment method in their applications.
33+
*
34+
* The {@link VenmoPaymentsInstance} enables seamless integration with Venmo's payment flow,
35+
* providing a secure and user-friendly way to process payments through the Venmo platform.
36+
*
37+
* @interface VenmoPaymentsInstance
38+
*/
2939
export interface VenmoPaymentsInstance {
3040
/**
3141
* Creates a Venmo one-time payment session for processing payments through Venmo.

0 commit comments

Comments
 (0)