• useOnramp hook

    Returns {
        configure: (
            config: Configuration,
        ) => Promise<{ error?: StripeError<OnrampError> }>;
        hasLinkAccount: (email: string) => Promise<HasLinkAccountResult>;
        registerLinkUser: (info: LinkUserInfo) => Promise<RegisterLinkUserResult>;
        registerWalletAddress: (
            walletAddress: string,
            network: CryptoNetwork,
        ) => Promise<{ error?: StripeError<OnrampError> }>;
        attachKycInfo: (
            kycInfo: KycInfo,
        ) => Promise<{ error?: StripeError<OnrampError> }>;
        presentKycInfoVerification: (
            updatedAddress: null | Address,
        ) => Promise<VerifyKycResult>;
        updatePhoneNumber: (
            phone: string,
        ) => Promise<{ error?: StripeError<OnrampError> }>;
        authenticateUser: () => Promise<AuthenticateUserResult>;
        authenticateUserWithToken: (
            linkAuthTokenClientSecret: string,
        ) => Promise<{ error?: StripeError<OnrampError> }>;
        verifyIdentity: () => Promise<{ error?: StripeError<OnrampError> }>;
        collectPaymentMethod: {
            (
                paymentMethod: "BankAccount" | "Card",
                platformPayParams?: undefined,
            ): Promise<CollectPaymentMethodResult>;
            (
                paymentMethod: "PlatformPay",
                platformPayParams: PaymentMethodParams,
            ): Promise<CollectPaymentMethodResult>;
        };
        createCryptoPaymentToken: () => Promise<CreateCryptoPaymentTokenResult>;
        performCheckout: (
            onrampSessionId: string,
            provideCheckoutClientSecret: () => Promise<null | string>,
        ) => Promise<{ error?: StripeError<OnrampError> }>;
        authorize: (linkAuthIntentId: string) => Promise<AuthorizeResult>;
        getCryptoTokenDisplayData: (
            token: CryptoPaymentToken,
        ) => Promise<PaymentDisplayDataResult>;
        logOut: () => Promise<{ error?: StripeError<OnrampError> }>;
        isAuthError: (error: any) => boolean;
    }

    • configure: (config: Configuration) => Promise<{ error?: StripeError<OnrampError> }>

      Creates a CryptoOnrampCoordinator to facilitate authentication, identity verification, payment collection, and checkouts.

    • hasLinkAccount: (email: string) => Promise<HasLinkAccountResult>

      Whether or not the provided email is associated with an existing Link consumer.

    • registerLinkUser: (info: LinkUserInfo) => Promise<RegisterLinkUserResult>

      Registers a new Link user with the provided details.

    • registerWalletAddress: (
          walletAddress: string,
          network: CryptoNetwork,
      ) => Promise<{ error?: StripeError<OnrampError> }>

      Registers the given crypto wallet address to the current Link account. Requires an authenticated Link user.

    • attachKycInfo: (kycInfo: KycInfo) => Promise<{ error?: StripeError<OnrampError> }>

      Attaches the specific KYC info to the current Link user. Requires an authenticated Link user.

    • presentKycInfoVerification: (updatedAddress: null | Address) => Promise<VerifyKycResult>

      Presents UI to verify KYC information for the current Link user. Requires the user to be authenticated with prior calls to either authenticateUser or authorize, and also requires prior KYC info attachement via attachKycInfo.

    • updatePhoneNumber: (phone: string) => Promise<{ error?: StripeError<OnrampError> }>

      Updates the user's phone number in their Link account.

    • authenticateUser: () => Promise<AuthenticateUserResult>

      Presents Link UI to authenticate an existing Link user. hasLinkAccount must be called before this.

    • authenticateUserWithToken: (
          linkAuthTokenClientSecret: string,
      ) => Promise<{ error?: StripeError<OnrampError> }>

      Authenticates the user with an encrypted Link auth token. This token can be obtained by exchanging a previously consented Link OAuth token from your backend using Stripe's /v1/link/auth_token API. The response of this backend API includes information on token expiry.

    • verifyIdentity: () => Promise<{ error?: StripeError<OnrampError> }>

      Creates an identity verification session and launches the document verification flow. Requires an authenticated Link user.

    • collectPaymentMethod: {
          (
              paymentMethod: "BankAccount" | "Card",
              platformPayParams?: undefined,
          ): Promise<CollectPaymentMethodResult>;
          (
              paymentMethod: "PlatformPay",
              platformPayParams: PaymentMethodParams,
          ): Promise<CollectPaymentMethodResult>;
      }

      Presents UI to collect/select a payment method of the given type.

      The payment method type to collect.

      • 'Card' and 'BankAccount' present Link for collection.
      • 'PlatformPay' presents Apple Pay / Google Pay using the provided parameters.

      Platform-specific parameters (required when paymentMethod is 'PlatformPay').

      • iOS: provide applePay params
      • Android: provide googlePay params

      Promise that resolves to an object with displayData or error

    • createCryptoPaymentToken: () => Promise<CreateCryptoPaymentTokenResult>

      Creates a crypto payment token for the payment method currently selected on the coordinator. Call after a successful collectPaymentMethod(...).

    • performCheckout: (
          onrampSessionId: string,
          provideCheckoutClientSecret: () => Promise<null | string>,
      ) => Promise<{ error?: StripeError<OnrampError> }>

      Performs the checkout flow for a crypto onramp session, handling any required authentication steps.

    • authorize: (linkAuthIntentId: string) => Promise<AuthorizeResult>

      Authorizes a Link auth intent and authenticates the user if necessary.

    • getCryptoTokenDisplayData: (token: CryptoPaymentToken) => Promise<PaymentDisplayDataResult>

      Retrieves display data (icon, label, sublabel) for the given payment method details. Suitable for rendering in the UI to summarize the selected payment method.

    • logOut: () => Promise<{ error?: StripeError<OnrampError> }>

      Logs out the current user from their Link account.

    • isAuthError: (error: any) => boolean

      Determines whether an error is an authentication-related error that requires re-authentication. Useful for implementing automatic re-authentication flows when sessions expire or become invalid.