Verify Funds and Create Transfer
Process transfer submission requests
Overview
+-------------+ +----------+ +------------+
| Customer |----(1)--->| Customer |----(2)--->| ReadyRemit |
| Application |<---(7)----| API (4) |<---(3)----| API |
+-------------+ +----------+ +------------+
| | |
| | | +------------+
| | ---------(5)--->| ReadyRemit |
| <----------(6)----| API |
| +------------+
|
| +------------+
-----------(8)--->| ReadyRemit |
| SDK |
+------------+- Customer application makes a network request to the Customer API to initiate the creation of a transfer
- Customer API makes a network request to the ReadyRemit API to read quote details
- ReadyRemit API returns the quote details or an error
- Customer API performs additional prerequisites, such as verification of funds
- Customer API makes a network request to the ReadyRemit API to create a transfer
- ReadyRemit API returns the transfer details or an error
- Customer API returns the transfer details or an error
- Customer application returns the transfer details or throws an error
Contract
- Called when the SDK submits a transfer.
- Receives a ReadyRemitTransferRequest and must resolve to ReadyRemitTransferResponse or ReadyRemitError.
Types
See the following type documentation for details:
- ReadyRemitTransferRequest - The request object received by this callback
- ReadyRemitTransferResponse - Success response structure
- ReadyRemitError - Error response structure
export type ReadyRemitTransferRequest = {
fields?: [ReadyRemitTransferRequestField] | undefined;
quoteBy: string;
quoteHistoryId: string;
recipientAccountId?: string | undefined;
recipientId: string;
sourceAccountId?: string | undefined;
}
export type ReadyRemitTransferRequestField = {
id: string;
type: string;
value: string;
}
export interface ReadyRemitTransferResponse {
transferId: string;
}Sample Implementation
import type { ReadyRemitTransferRequest, ReadyRemitTransferResponse, ReadyRemitError } from 'react-native-ready-remit-sdk';
export const verifyFundsAndCreateTransfer = async (
request: ReadyRemitTransferRequest,
): Promise<ReadyRemitTransferResponse | ReadyRemitError> => {
const url = 'https://example.com/v1/verifyFundsAndCreateTransfer';
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request),
});
if (!response.ok) {
return { code: 'UNEXPECTED_ERROR', message: String(response.status) };
}
return (await response.json()) as ReadyRemitTransferResponse;
};
...
import React from 'react';
import { Button, View } from 'react-native';
import {
startSDK,
ReadyRemitEnvironment
} from 'react-native-ready-remit-sdk';
export default function App() {
const onPress = () => {
startSDK({
configuration: { environment: ReadyRemitEnvironment.Sandbox },
fetchAccessTokenDetails: fetchAccessTokenDetails,
verifyFundsAndCreateTransfer: verifyFundsAndCreateTransfer
...
};
return (
<View style={{ padding: 24 }}>
<Button title="Start ReadyRemit" onPress={onPress} />
</View>
);
}Updated 4 days ago
