Skip to content

Commit 71135dd

Browse files
authored
Merge pull request #103 from revolut-engineering/REVG-2150
REVG-2150 Expose embedded checkout
2 parents 4c25567 + 988234b commit 71135dd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/types.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,32 @@ export interface PaymentsModulePaymentRequest {
718718
destroy: () => void
719719
}
720720

721+
export interface EmbeddedCheckoutInstance {
722+
/** Manually destroy the instance */
723+
destroy: () => void
724+
}
725+
726+
export interface EmbeddedCheckoutOptions {
727+
/** Empty element inside payment page */
728+
target: HTMLElement
729+
/** A function to create a Revolut order at a later time within the flow */
730+
createOrder: () => Promise<{ publicId: string }>
731+
/** Callback will be called when the payment is completed successfully */
732+
onSuccess?: (payload: { orderId: string }) => void
733+
/** Callback if transaction is failed to complete, the reason should be available in the message parameter */
734+
onError?: (payload: { error: RevolutCheckoutError; orderId: string }) => void
735+
/** Callback if an user did not complete the transaction and canceled the authorisation */
736+
onCancel?: (payload: { orderId: string | undefined }) => void
737+
/** Customer's email */
738+
email?: string
739+
/** Contains customer's billing address */
740+
billingAddress?: Address
741+
}
742+
743+
export interface EmbeddedCheckout {
744+
(options: EmbeddedCheckoutOptions): EmbeddedCheckoutInstance
745+
}
746+
721747
export interface RevolutCheckoutInstance {
722748
/**
723749
* Show full-screen payment form with card field and user email.
@@ -745,6 +771,8 @@ export interface RevolutCheckoutInstance {
745771
payments: (
746772
option: RevolutPaymentsModuleOptions
747773
) => RevolutPaymentsModuleInstance
774+
/** Accept payments via checkout widget */
775+
embeddedCheckout: EmbeddedCheckout
748776
}
749777

750778
export interface RevolutPaymentsModuleInstance {

0 commit comments

Comments
 (0)