Initialization - Transfer Experience

Start the SDK and navigate the user to a specific transfer

Definition

extension ReadyRemit {
    public func showTransfer(
        transferId: String,
        configuration: ReadyRemitConfiguration = .init(),
        themeConfiguration: String? = nil,
        fetchAccessTokenDetails: @escaping () async throws -> AccessTokenDetails,
        verifyFundsAndCreateTransfer: @escaping (TransferRequest) async throws(ReadyRemitError) -> TransferDetails,
        onLaunch: (() -> Void)? = .none,
        onDismiss: (() -> Void)? = .none,
        onLoad: @escaping (AnyView) -> Void
    ) {
        ...
        // onLaunch() is called when sdkView appears
        onLoad(sdkView)
    }
}

Parameters

PropertyTypeDescription
transferIdStringThe id of the transfer to navigate to
configurationReadyRemitConfigurationThe options available for customizing a branded experience
themeConfigurationString?(Optional) A JSON string that customizes the visual appearance of the SDK.
fetchAccessTokenDetails() async throws -> AccessTokenDetailsCalled to acquire an access token for the SDK to communicate with the ReadyRemit API on behalf of the sender
verifyFundsAndCreateTransfer(TransferRequest) async throws(ReadyRemitError) -> TransferDetailsCalled to verify sender funds and create the transfer
onLaunch(() -> Void)?Called when the SDK has fully launched
onDismiss(() -> Void)?Called when the SDK has been closed
onLoad(AnyView) -> VoidCalled when the SDK has completed setup returning the SDK View

Sample Usages

private let configuration: ReadyRemitConfiguration = .init()

private func fetchAccessTokenDetails() async throws -> AccessTokenDetails {
    ...
}

private func verifyFundsAndCreateTransfer(
    transferRequest: ReadyRemit.TransferRequest
) async throws(ReadyRemitError) -> TransferDetails {
    ...
}

private func onLaunch() {
    print("ReadyRemit SDK launched")
}

private func onDismiss() {
    print("ReadyRemit SDK dismissed")
}

private func onLoad() { [weak self] sdkView
    // navigate to sdkView
}

ReadyRemit.shared.showTransfer(
    transferId: "123",
    configuration: configuration,
    fetchAccessTokenDetails: fetchAccessTokenDetails,
    verifyFundsAndCreateTransfer: verifyFundsAndCreateTransfer,
    onLaunch: onLaunch,
    onDismiss: onDismiss,
    onLoad: onLoad
)
private let themeConfiguration = """
{
  "foundations": {
    "colorPrimary": { "light": "#42CB91", "dark": "#42CB91" },
    "fontFamily": "inter"
  },
  "components": {
    "button": {
      "buttonRadius": 8,
      "buttonTextCase": "capitalize"
    }
  }
}
"""

ReadyRemit.shared.showTransfer(
    transferId: "123",
    themeConfiguration: themeConfiguration,
    fetchAccessTokenDetails: fetchAccessTokenDetails,
    verifyFundsAndCreateTransfer: verifyFundsAndCreateTransfer,
    onLoad: { sdkView in
        // navigate to sdkView
    }
)