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 11, 2024
1 parent 48f3edd commit 7f9ca03
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions types/lib/amazon-pay.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,43 @@ 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
merchantId?: string;
};

export type AmazonPayEvent = 'token' | 'error' | 'close';
export type AmazonPayRenderButtonOptions = {
productType?: string;
placement?: string;
buttonColor?: string;
}

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 7f9ca03

Please sign in to comment.