Skip to content

Commit

Permalink
Add orderId to success/error callbacks (#88)
Browse files Browse the repository at this point in the history
* Add orderId to success/error callbacks

---------

Co-authored-by: Andrei Bents <[email protected]>
  • Loading branch information
andrewbents and Andrei Bents authored Nov 6, 2024
1 parent 040890f commit f26a2a1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,12 @@ 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: string | 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 */
Expand Down Expand Up @@ -636,9 +639,14 @@ export type RevolutPayEvents =
payload:
| {
type: 'success'
orderId: string
}
| { type: 'error'; error: RevolutCheckoutError; orderId: string }
| {
type: 'cancel'
dropOffState: RevolutPayDropOffState
orderId?: string
}
| { type: 'error'; error: RevolutCheckoutError }
| { type: 'cancel'; dropOffState: RevolutPayDropOffState }
}
| {
type: 'click'
Expand Down

0 comments on commit f26a2a1

Please sign in to comment.