Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add orderId to success/error callbacks #88

Merged
merged 4 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading