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     |
                              +------------+
  1. Customer application makes a network request to the Customer API to initiate the creation of a transfer
  2. Customer API makes a network request to the ReadyRemit API to read quote details
  3. ReadyRemit API returns the quote details or an error
  4. Customer API performs additional prerequisites, such as verification of funds
  5. Customer API makes a network request to the ReadyRemit API to create a transfer
  6. ReadyRemit API returns the transfer details or an error
  7. Customer API returns the transfer details or an error
  8. Customer application returns the transfer details or throws an error

Contract


Types

See the following type documentation for details:

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>
  );
}