> ## Documentation Index
> Fetch the complete documentation index at: https://docs.girostack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wallet Transfer

> This endpoint enables users to initiate a wallet-to-wallet transfer.

`POST {{baseurl}}/transactions/transfer`

<Tabs>
  <Tab title="Staging">
    ```
       https://gw.stg.girostack.com/v1
    ```
  </Tab>

  <Tab title="Production">
    ```
       https://gw.prod.girostack.com/v1
    ```
  </Tab>
</Tabs>

<Card title="Headers">
  <ParamField body="x-giro-key" type="string" required>
    Pass your account's secret key as the value.
  </ParamField>
</Card>

<Card title="Body Params">
  <ParamField body="source" type="string" required>
    Value should be the publicId of the benefactor's wallet
  </ParamField>

  <ParamField body="sourceType" type="string" required>
    Value should be the `VirtualAccount`
  </ParamField>

  <ParamField body="destination" type="string" required>
    Value should be the publicId of the beneficiary's wallet
  </ParamField>

  <ParamField body="destinationType" type="string" required>
    Value should be the `VirtualAccount`
  </ParamField>

  <ParamField body="amount" type="number" required>
    Value should be in kobo. Minimum transfer is 100 naira
  </ParamField>

  <ParamField body="currency" type="string" required>
    Value should be NGN
  </ParamField>

  <ParamField body="narration" type="string" required />

  <ParamField body="reference" type="string" />

  <ParamField body="nameEnquiryRef" type="string" />
</Card>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST '{{API_BASE_URL}}/transactions/transfer' \
  --header 'x-giro-key: {{SECRET_KEY}}' \
  --header 'Content-Type: application/json' \
  --data '{
      "source": "vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61",
      "sourceType": "VirtualAccount",
      "destination": "vba-05bess59-49c4-4651-be00-d524549e2a40",
      "destinationType": "VirtualAccount",
      "amount": 25000,
      "currency": "NGN",
      "narration": "Workspace"
  }'
  ```

  ```javascript Node.JS theme={null}
  const fetch = require("node-fetch");

  const url = "{{API_BASE_URL}}/transactions/transfer";
  const headers = {
    "x-giro-key": "{{SECRET_KEY}}",
    "Content-Type": "application/json",
  };
  const body = JSON.stringify({
    source: "vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61",
    sourceType: "VirtualAccount",
    destination: "vba-05bess59-49c4-4651-be00-d524549e2a40",
    destinationType: "VirtualAccount",
    amount: 25000,
    currency: "NGN",
    narration: "Workspace",
  });

  fetch(url, {
    method: "POST",
    headers: headers,
    body: body,
  })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => '{{API_BASE_URL}}/transactions/transfer',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => array(
      'x-giro-key: {{SECRET_KEY}}',
      'Content-Type: application/json'
    ),
    CURLOPT_POSTFIELDS => json_encode(array(
      'source': 'vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61',
      'sourceType': 'VirtualAccount',
      'destination': 'vba-05bess59-49c4-4651-be00-d524549e2a40',
      'destinationType': 'VirtualAccount',
      'amount': 25000,
      'currency': 'NGN',
      'narration': 'Workspace'
    ))
  ));

  $response = curl_exec($curl);
  $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

  if (curl_errno($curl)) {
    echo 'Error: ' . curl_error($curl);
  } else {
    echo "Response Code: $httpcode\n";
    echo $response;
  }

  curl_close($curl);
  ?>
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "meta": {
      "statusCode": 200,
      "success": true,
      "message": "successful"
    },
    "data": {
      "_id": "66e2a48a7648f2b0f28e86742",
      "publicId": "trx-8d4gt32e00-fc44-4bfe-95a9-348a2r39d09888",
      "auth": "65b12bbf512f9932b67f53d7",
      "account": "65b12bbf36e38c6bfbe35f95",
      "deletedAt": null,
      "tags": [],
      "currency": "NGN",
      "entry": "debit",
      "destination": "vba-22seceea-1bd6-4e85-89fa-2ca0b1c57d61",
      "live": true,
      "destinationType": "VirtualAccount",
      "destinationData": {
        "id": 4353,
        "publicId": "vba-22seceea-1bd6-4e85-89fa-2ca0b1c57d61",
        "bankName": "Source MFB",
        "bankCode": "090641",
        "accountName": "Jane Doe",
        "accountNumber": "7086576668",
        "processor": "giro",
        "clientIds": {}
      },
      "source": "vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61",
      "sourceType": "VirtualAccount",
      "sourceData": {
        "id": 113,
        "publicId": "vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61",
        "bankName": "Source MFB",
        "bankCode": "090641",
        "accountName": "Giro Expenses",
        "accountNumber": "6153332037",
        "currency": "NGN",
        "reference": null,
        "processor": "source"
      },
      "amount": 25000,
      "balance": 5000000,
      "clientTransaction": {
        "fee": 0,
        "actualAmount": 25000
      },
      "fee": 0,
      "feeReference": "fee-73887083e-c99b-42ee-85ec-4577998336454",
      "actualAmount": 25000,
      "narration": "Workspace",
      "reference": "TRF-7107555149278192088783030331355765593680-17261292800944",
      "debitReference": null,
      "tRef": "GIR-6291285234044666400580911355723887500713-1726129289945",
      "linkRef": "TRFLNK-3205567866441776185720553998786846299624-1726129289944",
      "status": "pending",
      "processor": "giro",
      "meta": {
        "isThirdParty": false,
        "rate": {
          "rateId": 1,
          "rate": 1,
          "sourceCurrency": "NGN",
          "destinationCurrency": "NGN",
          "convertedAmount": 25000
        },
        "credit": {
          "sourceType": "VirtualAccount",
          "sourceData": {
            "id": 113,
            "publicId": "vba-19aeceea-1bd6-4e85-89fa-2ca0b1c57d61",
            "bankName": "Source MFB",
            "bankCode": "090641",
            "accountName": "Giro Expenses",
            "accountNumber": "6153332037",
            "currency": "NGN",
            "reference": null,
            "processor": "source"
          },
          "source": "vba-00b8fe5c-aeff-45f5-a338-6b082d35714b",
          "destination": "vba-22seceea-1bd6-4e85-89fa-2ca0b1c57d61",
          "destinationType": "VirtualAccount",
          "destinationData": {
            "id": 4353,
            "publicId": "vba-22seceea-1bd6-4e85-89fa-2ca0b1c57d61",
            "bankName": "Source MFB",
            "bankCode": "090641",
            "accountName": "Jane Doe",
            "accountNumber": "7086576668",
            "processor": "giro",
            "clientIds": {}
          },
          "amount": 25000,
          "currency": "NGN",
          "actualAmount": 25000,
          "fee": 0,
          "narration": "Workspace",
          "balance": 5000000
        }
      },
      "currencyPair": "NGN/NGN",
      "batchId": null,
      "updatedAt": "2024-09-12T08:25:00.610Z",
      "createdAt": "2024-09-12T08:21:29.945Z",
      "metadata": {}
    }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "meta": {
      "statusCode": 400,
      "error": {
        "statusCode": 400,
        "message": "Bad request / Validation error",
        "messages": {
          "destination": {
            "isNotEmpty": "destination should not be empty",
            "isString": "destination must be a string"
          }
        }
      }
    }
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "meta": {
      "statusCode": 404,
      "error": {
        "statusCode": 404,
        "message": "Source not found"
      }
    }
  }
  ```

  ```json 404 Destination Not Found theme={null}
  {
    "meta": {
      "statusCode": 404,
      "error": {
        "statusCode": 404,
        "message": "Destination not found"
      }
    }
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "meta": {
      "statusCode": 403,
      "error": {
        "statusCode": 403,
        "message": "Insufficient fund"
      }
    }
  }
  ```
</ResponseExample>
