Skip to content

Commit

Permalink
add attach/renderButton to instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Anderson committed Jan 12, 2024
1 parent 48f3edd commit d23da62
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions types/lib/amazon-pay.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,40 @@ export type AmazonPayOptions = {
region: string;

/**
* The customer's locale. This is used to set the language rendered in the UI.
* Specify which Payment Gateway in Recurly must handle the payment.
*/
locale: string;
gatewayCode?: string

/**
* The currency of the payment.
* Sets button to Sandbox environment
*/
currency: string;
sandbox?: boolean;
};

/**
* Specify which Payment Gateway in Recurly must handle the payment.
*/
gatewayCode?: string
export type AmazonPayRenderButtonOptions = {
productType?: string;
placement?: string;
buttonColor?: string;
};

export type AmazonPayEvent = 'token' | 'error' | 'close';
export type AmazonPayEvent = 'ready' | 'token' | 'error' | 'close' | 'done';

export interface AmazonPayInstance extends Emitter<AmazonPayEvent> {
/**
* Invokes the Amazon Payment Modal
*/
start: (amazonPayOptions: AmazonPayOptions) => void;

/**
* Attaches an Element to the DOM, as a child of the specified parent target.
*
*/
attach: (defaultEventName: string, gatewayCode?: string) => AmazonPayInstance;

/**
* Renders Amazon Pay button to the page
*/
renderButton: (element: string | HTMLElement, amazonPayRenderButtonOptions: AmazonPayOptions & AmazonPayRenderButtonOptions) => AmazonPayInstance;
}

export type AmazonPay = (amazonPayOptions?: AmazonPayOptions) => AmazonPayInstance;

0 comments on commit d23da62

Please sign in to comment.