UNPKG

@square/web-payments-sdk-types

Version:

Types for Square's Web Payments SDK

85 lines (84 loc) 2.93 kB
import type { BillingContact } from './contact'; interface BaseVerifyBuyerDetails { /** * The `Contact` information needed to help verify the buyer. Although the `billingContact` property accepts undefined values, Square verifies the identity more successfully if `Contact` information is provided. */ readonly billingContact: BillingContact; } /** * The verification details parameter passed, to the `payments.verifyBuyer()` function, for cases in which the buyer is being charged. * @example * const verificationDetails = { * amount: '1.00', * currencyCode: 'GBP', * intent: 'CHARGE', * billingContact: { * addressLines: ['123 Main Street', 'Apartment 1'], * familyName: 'Doe', * givenName: 'John', * email: 'jon.doe@square.test', * countryCode: 'GB', * phone: '3214563987', * state: 'LND', * city: 'London', * postalCode: 'WC2N 5DU', * }, * }; */ interface ChargeVerifyBuyerDetails extends BaseVerifyBuyerDetails { /** * 3-letter ISO 4217 currency code. */ readonly currencyCode: string; /** * The total cost of the purchase given as a string representation * float with decimal places representing the lowest denominations of the currency. * This follows the W3 Payment Request API standard - https://www.w3.org/TR/payment-request/#dfn-valid-decimal-monetary-value * * For example, a total of "10" is represented as `"10.00"` or `"10"` for currencies with fractional denominations (such as USD), * while the total is represented as `"10"` in currencies without fractional denominations, such as JPY. */ readonly amount: string; /** * Transactional intent of the payment */ readonly intent: 'CHARGE' | 'CHARGE_AND_STORE'; } /** * The verification details parameter, passed to the `payments.verifyBuyer()` function, for cases in which the card is being stored on file. * @example * const verificationDetails = { * intent: 'STORE', * billingContact: { * addressLines: ['123 Main Street', 'Apartment 1'], * familyName: 'Doe', * givenName: 'John', * email: 'jon.doe@square.test', * countryCode: 'GB', * phone: '3214563987', * state: 'LND', * city: 'London', * postalCode: 'WC2N 5DU', * }, * }; */ interface StoreVerifyBuyerDetails extends BaseVerifyBuyerDetails { /** * Transactional intent of the payment */ readonly intent: 'STORE'; } /** * Response details from the `await payments.verifyBuyer()` function. */ interface VerifyBuyerResponseDetails { /** * Whether the buyer went through the Card Issuer's challenge flow to verify the buyer. */ userChallenged: boolean; /** * The verification token that is passed to the Payments API. */ token: string; } export { ChargeVerifyBuyerDetails, StoreVerifyBuyerDetails, VerifyBuyerResponseDetails, };