@paydock/client-sdk
Version:
Paydock client sdk
245 lines • 15.9 kB
TypeScript
export { ApplePayWalletButtonExpress } from "./services/apple-pay/apple-pay.wallet-button-express";
export { PaypalWalletButtonExpress } from "./services/paypal/paypal.wallet-button-express";
/**
* Interface for configuration metadata specific to ApplePay integration in the wallet checkout and payment process.
* For further information about ApplePay Capabilities refer to [the documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities).
* Apple will determinate if the device has an ApplePay wallet available and at least one active payment.
* If the determinated value is credentials_status_unknown, the payment possbily should might be not able to be finished on the web, and the buyer must complete it on a compatible device, like Iphone or Ipad.
*
* @interface ApplePayWalletMeta
*
* @type {object}
* @param {string} amount_label - Label shown next to the total amount to be paid, used in ApplePay popups.
* @param {string} country - Country of the user in 2 letter ISO code format, required for ApplePay.
* @param {string} currency - Currency of the transaction. ISO 4217 currency code format.
* @param {number} amount - Total transaction amount number. **Note:** this amount will be presented in the payment sheet regardless of amount sent in the Wallet Initialization Backend to Backend call. Use `setMeta` method to keep it up to date.
* @param {Array<'supports3DS' | 'supportsEMV' | 'supportsCredit' | 'supportsDebit'>} [merchant_capabilities] - Array of capabilities that the merchant supports, influencing the transaction processing features available.
* @param {Array<'visa' | 'masterCard' | 'amex' | 'chinaUnionPay' | 'discover' | 'interac' | 'jcb' | 'privateLabel'>} [supported_networks] - List of payment networks supported by the merchant for ApplePay transactions.
* @param {Array<'email' | 'name' | 'phone' | 'postalAddress'>} [required_billing_contact_fields] - Contact fields required from the user for billing purposes, improving transaction verification and fraud prevention. Phone and email are currently not returned by Apple.
* @param {Array<'email' | 'phone'>} [required_shipping_contact_fields] - Shipping contact fields that are mandatory to complete the transaction. Use email and phone to collect from customer wallet in the abscense of billing one. Required for onShippingAddressChange callback.
* @param {string[]} [supported_countries] - List of countries where ApplePay is supported by the merchant, restricting usage to specified regions.
* @param {object} [style] - Styling configuration for ApplePay buttons displayed during checkout.
* @param {ApplePayButtonType} [style.button_type] - Enum type to select the type of ApplePay button (e.g., 'buy', 'donate', etc.), providing user interface customization.
* @param {ApplePayButtonStyle} [style.button_style] - Style applied to the ApplePay button, which can include color and form factor adjustments according to the brand's visual guidelines.
* @param {'available' | 'store_pickup'} [shipping_editing_mode] - ApplePay - available for allowing editing shipping, store_pickup for not allowing editing shipping.
* @param {object} [shipping_data] - ApplePay - Preloaded data used for populate shipping address information
* @param {string} [shipping_data.email_address] - ApplePay - The shipping address email
* @param {Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>} [apple_pay_capabilities] Device capabilities needed for wallet button to be available.
**/
/**
* Interface for configuration metadata specific to PayPal integration in the wallet checkout and payment process.
* For in-depth information, please refer to the [Paypal documentation](https://developer.paypal.com/docs/multiparty/checkout/standard/customize/buttons-style-guide/).
* @interface PaypalWalletMeta
*
* @type {object}
* @param {number} amount - Total amount of the transaction. Represents the money to be charged.
* @param {string} currency - Currency of the transaction in ISO 4217 currency code format.
* @param {boolean} [pay_later] - Flag to enable Pay Later feature of PayPal, allowing Pay in 4. Default false.
* @param {boolean} [hide_message] Used to hide Pay Later message in PayPal Smart Checkout WalletButton integration. Optional for [PayPal]. N/A for other wallets.
* @param {boolean} [standalone] - Flag to specify if the PayPal standalone button should be used. Default false.
* @param {boolean} [capture] - Flag to specify if the transaction amount should be captured immediately or authorized for later capture. Default false.
* @param {object} [style] - Styling configurations for the PayPal widget.
* @param {('vertical' | 'horizontal')} [style.layout] - Layout orientation of the PayPal button.
* @param {('gold' | 'blue' | 'silver' | 'black' | 'white')} [style.color] - Color theme of the PayPal button.
* @param {('rect' | 'pill' | 'sharp')} [style.shape] - Shape of the PayPal button.
* @param {number} [style.borderRadius] - Border radius for the button, allowing customization of corner roundness.
* @param {number} [style.height] - Height of the PayPal button, allowing for size customization.
* @param {boolean} [style.disableMaxWidth] - Flag to disable the maximum width constraint of the button.
* @param {('paypal' | 'checkout' | 'buynow' | 'pay' | 'installment')} [style.label] - Label text displayed on the PayPal button.
* @param {boolean} [style.tagline] - Flag to include or exclude a tagline beneath the button text.
* @param {object} [style.messages] - Messaging options related to the PayPal button to enhance user interaction.
* @param {('text' | 'flex')} [style.messages.layout] - Layout type for the messages displayed near the PayPal button.
* @param {object} [style.messages.logo] - Configuration for the logo to be displayed with the PayPal button.
* @param {('primary' | 'alternative' | 'inline' | 'none')} [style.messages.logo.type] - Type of logo to display.
* @param {('left' | 'right' | 'top')} [style.messages.logo.position] - Position of the logo relative to the button or message.
* @param {object} [style.messages.text] - Text styling within the message component.
* @param {('black' | 'white' | 'monochrome' | 'grayscale')} [style.messages.text.color] - Color of the message text.
* @param {(10 | 11 | 12 | 13 | 14 | 15 | 16)} [style.messages.text.size] - Font size of the message text.
* @param {('left' | 'center' | 'right')} [style.messages.text.align] - Text alignment within the message area.
* @param {('blue' | 'black' | 'white' | 'white-no-border' | 'gray' | 'monochrome' | 'grayscale')} [style.messages.color] - Background color of the message area.
* @param {('1x1' | '1x4' | '8x1' | '20x1')} [style.messages.ratio] - Aspect ratio of the message area, affecting its layout and display.
**/
/**
* List of available event's name in the wallet button lifecycle
* @const EVENT
*
* @type {object}
* @param {string} UNAVAILABLE=unavailable
* @param {string} ERROR=error
* @param {string} PAYMENT_SUCCESSFUL=paymentSuccessful
* @param {string} PAYMENT_ERROR=paymentError
* @param {string} PAYMENT_IN_REVIEW=paymentInReview
* @param {string} ON_CLICK=onClick
* @param {string} ON_CHECKOUT_CLOSE=onCheckoutClose
* @param {string} ON_SHIPPING_ADDRESS_CHANGE=onShippingAddressChange
* @param {string} ON_SHIPPING_OPTIONS_CHANGE=onShippingOptionsChange
*/
/**
* Interface for OnClickEventData
* @interface OnClickEventData
*
* @type {object}
* @param {string} event - Event Name is 'onClick'
**/
/**
* Interface for OnCloseEventData
* @interface OnCloseEventData
*
* @type {object}
* @param {string} event - Event Name is 'onCheckoutClose'
* @param {string} [chargeId] - chargeId in case it's already set after onClick event
**/
/**
* Interface for OnPaymentSuccessfulEventData. For final secure results, fetch backend to backend data.
* @interface OnPaymentSuccessfulEventData
*
* @type {object}
* @param {string} event - Event Name is 'paymentSuccessful'
* @param {string} chargeId - chargeId set after onClick event
* @param {string} data.id - Charge ID returned by server
* @param {string} data.amount - Charge amount returned by server
* @param {string} data.currency - Charge currency returned by server
* @param {string} data.status - Charge status returned by server
**/
/**
* Interface for OnPaymentInReviewEventData. For final secure results, fetch backend to backend data.
* @interface OnPaymentInReviewEventData
*
* @type {object}
* @param {string} event - Event Name is 'paymentInReview'
* @param {string} chargeId - chargeId set after onClick event
* @param {string} data.id - Charge ID returned by server
* @param {string} data.amount - Charge amount returned by server
* @param {string} data.currency - Charge currency returned by server
* @param {string} data.status - Charge status returned by server
**/
/**
* Interface for OnPaymentErrorEventData. For final secure results, fetch backend to backend data.
* @interface OnPaymentErrorEventData
*
* @type {object}
* @param {string} event - Event Name is 'paymentError'
* @param {string} chargeId - chargeId set after onClick event
* @param {string} [data.message] - Error message
* @param {string} [data.code] - Error code
**/
/**
* Interface for OnUnavailableEventData
* @interface OnUnavailableEventData
*
* @type {object}
* @param {string} event - Event Name is 'unavailable'
**/
/**
* Interface for OnErrorEventData
* @interface OnErrorEventData
*
* @type {object}
* @param {string} event - Event Name is 'error'
* @param {string} [chargeId] - chargeId in case it's already set after onClick event
* @param {Error} [data] Error object if present
**/
/**
* Interface for OnShippingAddressChangeEventData.
* @interface OnShippingAddressChangeEventData
*
* @type {object}
* @param {string} event - Event Name is 'onShippingAddressChange'
* @param {string} chargeId - chargeId set after onClick event
* @param {string} data.address_city - PayPal and ApplePay - Shipping address city
* @param {string} data.address_state - PayPal and ApplePay - Shipping address state
* @param {string} data.address_postcode - PayPal and ApplePay - Shipping address postcode
* @param {string} data.address_country - PayPal and ApplePay - Shipping address country code
* @param {string} [data.address_line1] - ApplePay - Shipping address line 1
* @param {string} [data.address_line2] - ApplePay - Shipping address line 2
* @param {string} [data.contact.phone] - ApplePay - Shipping contact phone
* @param {string} [data.contact.email] - ApplePay - Shipping contact email
* @param {string} [data.contact.first_name] - ApplePay - Shipping contact first name
* @param {string} [data.contact.last_name] - ApplePay - Shipping contact last name
**/
/**
* Interface for OnShippingAddressChangeEventResponse.
* @interface OnShippingAddressChangeEventResponse
*
* @type {object}
* @param {string} [token] - Updated Wallet Token if any
* @param {string} [label] - ApplePay - Required. Label to show to the customer.
* @param {string} [amount] - ApplePay - Required. New amount for shipping option.
* @param {string} [error] - PayPal and ApplePay - Error object in case of error when processing shipping address in if new address unsupported or any other possible error.
* @param {string} error.code - PayPal and ApplePay - Error code, mandatory in case of error.
* Possible values for Paypal are 'address_error', 'country_error', 'state_error', 'zip_error' or any other string if none applies.
* For ApplePay values are 'address_error', 'shipping_contact_invalid' and 'billing_contact_invalid'.
* @param {string} [error.field] - ApplePay - Error field in case of specifically showing it. Possible values for Apple Pay are 'phone', 'email', 'name', 'phonetic_name', 'address_lines', 'locality', 'postal_code', 'administrative_area', 'country', 'country_code'.
* @param {string} [error.message] - ApplePay - Custom user facing error message.
**/
/**
* Interface for IApplePayShippingOption.
* Used for adding new shippings options when customer updates the shipping address.
* @interface IApplePayShippingOption
*
* @type {object}
* @param {string} [id] - Updated Wallet Token if any
* @param {string} [label] - ApplePay - Required. Label to show to the customer.
* @param {string} [amount] - ApplePay - Required. New amount for shipping option.
* @param {string} [detail] - ApplePay - Optional detail for shipping option.
* @param {object} [date_components_range] - ApplePay - Object that contains the dates for shipping
* @param {object} [date_components_range.start_date_components] - ApplePay - Contains the start date object
* @param {string} [date_components_range.start_date_components.years] - ApplePay - Contains the start date year
* @param {string} [date_components_range.start_date_components.months] - ApplePay - Contains the start date month
* @param {string} [date_components_range.start_date_components.days] - ApplePay - Contains the start date day
* @param {string} [date_components_range.start_date_components.hours] - ApplePay - Contains the start date hour
* @param {object} [date_components_range.end_date_components] - ApplePay - Contains the end date year
* @param {string} [date_components_range.end_date_components.years] - ApplePay - Contains the end date year
* @param {string} [date_components_range.end_date_components.months] - ApplePay - Contains the end date month
* @param {string} [date_components_range.end_date_components.days] - ApplePay - Contains the end date day
* @param {string} [date_components_range.end_date_components.hours] - ApplePay - Contains the end date hour
**/
/**
* Interface for OnShippingOptionChangeEventData.
* @interface OnShippingOptionChangeEventData
*
* @type {object}
* @param {string} event - Event Name is 'onShippingOptionsChange'
* @param {string} chargeId - chargeId set after onClick event
* @param {string} [data.shipping_option_id] - PayPal and ApplePay - Selected shipping option id
* @param {string} [data.amount] - Paypal and ApplePay - Selected shipping option amount
* @param {string} [data.label] - ApplePay - Selected shipping option label
* @param {string} [data.detail] - ApplePay - Selected shipping option detail
**/
/**
* Interface for OnShippingOptionChangeEventResponse.
* @interface OnShippingOptionChangeEventResponse
*
* @type {object}
* @param {string} [token] - Updated Wallet Token if any
* @param {string} [label] - ApplePay - Required. Label to show to the customer.
* @param {string} [amount] - ApplePay - Required. New amount for shipping option.
* @param {string} [error] - PayPal - Error object in case of error when processing shipping option selection.
* @param {string} error.code - Possible values for Paypal are 'method_unavailable', 'store_unavailable' or any other string if none applies.
**/
/**
* Interface for IApplePayError.
* @interface IApplePayError
*
* @type {object}
* @param {'shipping_contact_invalid' | 'billing_contact_invalid' | 'address_unserviceable' | 'coupon_code_invalid' | 'coupon_code_expired' | 'unknown'} code The error code for this instance.
* @param {ContactFieldType} contact_field The error code for this instance.
* @param {string|undefined} message TA localized, user-facing string that describes the error.
**/
/**
* List of available contact fields for ContactFieldType
* @const ContactFieldType
*
* @type {object}
* @param {string} phone
* @param {string} email
* @param {string} name
* @param {string} phonetic_name
* @param {string} address_lines
* @param {string} address_city
* @param {string} address_postcode
* @param {string} address_state
* @param {string} address_country
* @param {string} address_country_code
*/
//# sourceMappingURL=index.d.ts.map