authorizenet-react
Version:
React components for Authorize.Net payments
60 lines (59 loc) • 1.46 kB
TypeScript
export interface CardOptions {
style?: {
base?: {
color?: string;
fontSize?: string;
fontFamily?: string;
"::placeholder"?: {
color?: string;
};
};
invalid?: {
color?: string;
};
};
targetOrigin?: string;
}
export interface HostedFormOptions {
buttonText?: string;
buttonColor?: string;
backgroundColor?: string;
formHeaderText?: string;
logoUrl?: string;
height?: string;
}
export interface AuthorizeNetElements {
card: CardElement;
}
export interface CardElement {
mount(element: HTMLElement): void;
unmount(): void;
on(event: string, handler: (event: any) => void): void;
update(options: Partial<CardOptions>): void;
}
export interface CardData {
cardNumber: string;
month: string;
year: string;
cardCode: string;
}
export interface AuthorizeNetContextValue {
createToken(): Promise<{
opaqueData: {
dataDescriptor: string;
dataValue: string;
};
}>;
isScriptLoaded: boolean;
setCardData: (data: CardData | null) => void;
apiLoginId: string;
clientKey: string;
environment: "sandbox" | "production";
}
export interface AuthorizeNetProviderProps {
apiLoginId: string;
clientKey: string;
children: React.ReactNode;
environment?: "sandbox" | "production";
className?: string;
}