diff --git a/src/types.ts b/src/types.ts index 79d3b96..d6cbdb8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -426,9 +426,9 @@ export interface CommonOptions { /** Controls the language of the text in the widget method */ locale?: Locale | 'auto' /** Callback will be called when the payment is completed successfully */ - onSuccess?: () => void + onSuccess?: (payload: { orderId: string }) => void /** Callback if transaction is failed to complete, the reason should be available in the message parameter */ - onError?: (error: RevolutCheckoutError) => void + onError?: (error: RevolutCheckoutError, payload: { orderId: OrderToken | undefined }) => void /** Callback if an user did not complete the transaction and canceled the authorisation or closed the checkout window */ onCancel?: () => void /** Indicates in which case this saved payment method can be used for payments */ @@ -636,9 +636,10 @@ export type RevolutPayEvents = payload: | { type: 'success' + orderId: string } - | { type: 'error'; error: RevolutCheckoutError } - | { type: 'cancel'; dropOffState: RevolutPayDropOffState } + | { type: 'error'; error: RevolutCheckoutError; orderId: string } + | { type: 'cancel'; dropOffState: RevolutPayDropOffState; orderId?: string } } | { type: 'click'