Initialization - Transfer Experience
Start the SDK and navigate the user to a specific transfer
Definition
extension ReadyRemit {
public func showTransfer(
transferId: String,
configuration: Configuration = .init(),
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)
}
}Properties
| Property | Type | Description |
|---|---|---|
| transferId | String | The id of the transfer to navigate to |
| configuration | ReadyRemitConfiguration | The options available for customizing a branded experience |
| fetchAccessTokenDetails | () async throws -> AccessTokenDetails | Called to acquire an access token for the SDK to communicate with the ReadyRemit API on behalf of the sender |
| verifyFundsAndCreateTransfer | (TransferRequest) async throws(ReadyRemitError) -> TransferDetails | Called 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) -> Void | Called when the SDK has completed setup returning the SDK View |
Sample Usage
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
)Updated 5 months ago
