Skip to main content

Documentation

Moving Funds Between Wallets

Send money within Rapyd’s ecosystem. | Enterprise

The Rapyd platform makes it simple for your customers to transfer money from their own Rapyd Wallet to the wallet of another customer. Common use cases may include:

  • A customer wants to transfer funds to a another customer's wallet

  • A seller on a marketplace chooses to transfer funds to another seller's wallet

  • A company wallet transfers funds to an employee's wallet for a faster transaction than disburse.

For example, one customer on your platform wants to move funds to another customer on your platform.

Customer 1 provides you with customer 2’s identifying information, the amount and currency to transfer. Your ERP system asks Rapyd to transfer the money to customer 2. When the transfer is initiated, your ERP asks customer 2 to accept the transfer. Rapyd completes the transfer, and your ERP notifies both customers that the money was transferred.

Note

Why transfer funds between Rapyd Wallets instead of Disburse? Speed, Simplicity and Costs. Creating a wallet ecosystem allows you to more seamlessly pay your workers, speeds processing time and avoids costly transaction fees from third parties.

Let’s look at the highlights of your workflow.

On your website or mobile application, the customer selects Transfer Funds to Another Wallet and clicks Confirm.

initiate-the-transfer.jpg
  1. The website or mobile app asks the customer for details of the transfer.

  2. Customer 1 provides the details.

  3. The back end asks Rapyd to initiate the transfer.

  4. Rapyd processes the request and notifies you that the transfer has been initiated.

  5. Your back end sends confirmation to the customer who requested the transfer.

complete-the-transfer.jpg
  1. You notify the recipient that money is being sent, and you ask the recipient to accept.

  2. The recipient clicks Accept .

  3. Your back end asks Rapyd to finalize the transfer.

  4. Rapyd transfers the money and notifies you that the transfer is complete.

  5. You notify both customers that the transfer is complete.

Prerequisites

To run the examples of this use case, you must create the following wallet IDs in your own sandbox :

  • source_ewallet - Run Create Wallet for the customer's wallet. Use the wallet ID you get in the response.

  • destination_ewallet - Run Create Wallet for the customer's wallet. Use the 'id' you get in the response.

For more information, see Creating a Rapyd Wallet.

When the customer asks to transfer funds to the customer's wallet, you ask Rapyd to initiate the transfer process. This is the first step in a two-step process.

For that, you'll use Transfer Funds Between Wallets with the following parameters:

Description of Parameters

Body Parameter

Description

amount

Enter 100 as the amount to transfer from the customer's wallet.

currency

Enter USD as the currency code for US dollars.

source_ewallet

Enter the ID that you received when you created the customer's wallet in your sandbox. For purposes of this use case lesson, we are using ewallet_56a273c10570528c608f2c6bcdc8ea41, which is the wallet ID we created in our sandbox.

destination_ewallet

Enter the 'id' that you received when you created customer 2's wallet in your sandbox. For purposes of this use case lesson, we are using ewallet_43b888d4c038a219c52f45e754139f74, which is the wallet ID we created in our sandbox.

Transfer Funds Between Wallets Request

You ask Rapyd to transfer the money to customer 2's wallet.

    • Request

      • // Request URL: POST https://sandboxapi.rapyd.net/v1/account/transfer
        
        // Message body:
        {
                "amount": 100,
                "currency": "USD",
                "source_ewallet": "ewallet_56a273c10570528c608f2c6bcdc8ea41",
                "destination_ewallet": "ewallet_43b888d4c038a219c52f45e754139f74",
        }
    • .NET Core

      • using System;
        using System.Text.Json;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        var requestObj = new
                        {
                            amount = 100,
                            currency = "USD",
                            source_ewallet = "ewallet_56a273c10570528c608f2c6bcdc8ea41",
                            destination_ewallet = "ewallet_43b888d4c038a219c52f45e754139f74",
                        };
        
                        string request = JsonSerializer.Serialize(requestObj);
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("POST", "/v1/account/transfer", request);
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const body = {
              source_ewallet: 'ewallet_56a273c10570528c608f2c6bcdc8ea41',
              destination_ewallet: 'ewallet_43b888d4c038a219c52f45e754139f74',
              amount: 100,
              currency: 'USD'
            };
            const result = await makeRequest('POST', '/v1/account/transfer', body);
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        $body = [
            'amount' => 100,
            'currency' => 'USD',
            'source_ewallet' => 'ewallet_56a273c10570528c608f2c6bcdc8ea41',
            'destination_ewallet' => 'ewallet_43b888d4c038a219c52f45e754139f74'
        ];
        
        try {
            $object = make_request('post', '/v1/account/transfer', $body);
            var_dump($object);
        } catch (Exception $e) {
            echo "Error: $e";
        }
        ?>
Transfer Funds Between Wallets Response

Let's take a look at the response.

    • Response

      • {
            "status": {
                "error_code": "",
                "status": "SUCCESS",
                "message": "",
                "response_code": "",
                "operation_id": "1e6a07d6-7b06-4d6b-88b6-552fd4c2ec60"
            },
            "data": {
                "id": "af468df8-6f4e-11ea-833c-02e199f7f6f5",
                "status": "PEN",
                "amount": 100,
                "currency_code": "USD",
                "transfer_response_at": 0,
                "created_at": 1585219432,
                 
        //   ...
                  
            }
        }

The data section of this response shows:

  • The id of the transfer transaction is af468df8-6f4e-11ea-833c-02e199f7f6f5. When you run this example in your own sandbox, you will get a different ID, which you will need for a later step in this use case.

  • The status is PEN (Pending). The money has not yet been transferred.

  • The amount is 100.

  • The currency_code is USD.

Pending Transactions on a Wallet Ledger

To see the status of the transactions, refer to the status field. The source_ewallet_id or the destination_ewallet_id identify the source and destination wallet of the transaction.

When customer 2 indicates that she accepts the transfer, you ask Rapyd to complete the transaction.

For that, you'll use Set Transfer Response with the following parameters:

Description of Parameters

Body Parameter

Description

id

Enter the transfer transaction 'id' that you received when you created the transfer transaction in your sandbox. For purposes of this use case lesson, we are using af468df8-6f4e-11ea-833c-02e199f7f6f5, which is the transfer transaction ID we created in our sandbox.

status

Enter accept to indicate that customer 2 accepts the transfer.

Set Transfer Response Request

You ask Rapyd to complete the transfer of $100.00 from the customer's wallet to customer 2's wallet.

    • Request

      • // Request URL: POST https://sandboxapi.rapyd.net/v1/account/transfer/response
        
        // Message body:
        {
            "id": "af468df8-6f4e-11ea-833c-02e199f7f6f5",
            "status": "accept"
        }
    • .NET Core

      • using System;
        using System.Text.Json;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        var requestObj = new
                        {
                            id = "af468df8-6f4e-11ea-833c-02e199f7f6f5",
                            status = "accept",
                        };
        
                        string request = JsonSerializer.Serialize(requestObj);
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("POST", "/v1/account/transfer/response", request);
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const body = {
              id: 'af468df8-6f4e-11ea-833c-02e199f7f6f5',
              status: 'accept'
            };
            const result = await makeRequest('POST', '/v1/account/transfer/response', body);
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        $body = [
            'id' => 'af468df8-6f4e-11ea-833c-02e199f7f6f5',
            'status' => 'accept',
        ];
        
        try {
            $object = make_request('post', '/v1/account/transfer/response', $body);
            var_dump($object);
        } catch (Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        transfer = 'af468df8-6f4e-11ea-833c-02e199f7f6f5'
        
        body = {
            "id": transfer,
            "status": "accept"
        }
        
        results = make_request(method='post', path='/v1/account/transfer/response', body=body)
        pprint(results)
Set Transfer Response Response

Let's take a look at the response.

    • Response

      • {
            "status": {
                "error_code": "",
                "status": "SUCCESS",
                "message": "",
                "response_code": "",
                "operation_id": "4b8e014f-38ff-48dc-812b-547bd1f65874"
            },
            "data": {
                "id": "af468df8-6f4e-11ea-833c-02e199f7f6f5",
                "status": "CLO",
                "amount": 100,
                "currency_code": "USD",
                "destination_phone_number": null,
                "transfer_response_at": 1585219599,
                "created_at": 1585219432,
                 
        //   ...
                  
            }
        }

The data section of this response shows that the status is now CLO (closed). This indicates that the money has been transferred to customer 2's wallet.

Your website notifies both wallet contacts that the transfer is complete.