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

# P2P Transfer

> Transfer funds between subscribers by card serial

<Info>
  Person-to-person transfer using the recipient's card serial number. Requires sender PIN verification.
</Info>

## Request

<ParamField header="Authorization" type="string" required>
  `Bearer olive_live_xxx` or `Bearer eyJ...` (JWT)
</ParamField>

### Body Parameters

<ParamField body="sender_id" type="string" required>
  Sender subscriber UUID
</ParamField>

<ParamField body="recipient_card_serial" type="string" required>
  Recipient's card serial (e.g., `OLIV0002`)
</ParamField>

<ParamField body="amount" type="string" required>
  Amount to transfer (e.g., `500.00` or `500`)
</ParamField>

<ParamField body="pin" type="string" required>
  Sender's 4-digit PIN
</ParamField>

<ParamField body="memo" type="string">
  Optional note/description
</ParamField>

***

## Response

<ResponseField name="success" type="boolean">
  Whether transfer succeeded
</ResponseField>

<ResponseField name="transaction_id" type="string">
  Unique transaction ID
</ResponseField>

<ResponseField name="sender_new_balance" type="string">
  Sender's balance after transfer
</ResponseField>

<ResponseField name="fee_amount" type="string">
  Fee charged to sender
</ResponseField>

***

## Examples

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://demo.api.vultlocal.com/api/v1/wallet/transfer-p2p" \
    -H "Authorization: Bearer olive_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "sender_id": "sub_abc123",
      "recipient_card_serial": "OLIV0002",
      "amount": "500.00",
      "pin": "1234",
      "memo": "Payment for lunch"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "success": true,
    "message": "Transfer successful",
    "transaction_id": "txn_abc123",
    "amount": "500.00 SLE",
    "fee_amount": "7.50 SLE",
    "sender_new_balance": "49,492.50 SLE",
    "recipient": {
      "name": "Jane Smith",
      "card_serial": "OLIV0002"
    }
  }
  ```

  ```json 400 Insufficient Balance theme={null}
  {
    "success": false,
    "error": "Insufficient balance",
    "code": "INSUFFICIENT_FUNDS",
    "available": 30000,
    "required": 50750
  }
  ```

  ```json 404 Recipient Not Found theme={null}
  {
    "error": "Recipient card not found",
    "code": "CARD_NOT_FOUND"
  }
  ```
</ResponseExample>

***

## Transfer Flow

<Steps>
  <Step title="Validate Request">
    * Verify sender PIN
    * Check sender balance >= amount + fee
    * Validate recipient card exists and is active
  </Step>

  <Step title="Compliance Check">
    Run transaction against fraud detection rules
  </Step>

  <Step title="Execute Transfer">
    Atomic operation - debit sender, credit recipient
  </Step>

  <Step title="Notify">
    WhatsApp notifications to both parties
  </Step>
</Steps>

***

## Fee Calculation

| Amount Range         | Fee  |
| -------------------- | ---- |
| 0 - 50,000 SLE       | 1.5% |
| 50,001 - 500,000 SLE | 1.0% |
| 500,001+ SLE         | 0.5% |

<Info>
  Fees are configured in [Fee Settings](/api-reference/fees/overview) and may vary.
</Info>

***

## Errors

| Status | Code                  | Description                |
| ------ | --------------------- | -------------------------- |
| 400    | `INVALID_AMOUNT`      | Amount format invalid      |
| 400    | `INSUFFICIENT_FUNDS`  | Balance too low            |
| 400    | `INVALID_PIN`         | PIN verification failed    |
| 400    | `SELF_TRANSFER`       | Cannot transfer to self    |
| 403    | `SENDER_BLOCKED`      | Sender account blocked     |
| 403    | `RECIPIENT_BLOCKED`   | Recipient account blocked  |
| 403    | `COMPLIANCE_REJECTED` | Transaction exceeds limits |
| 404    | `SENDER_NOT_FOUND`    | Sender not found           |
| 404    | `CARD_NOT_FOUND`      | Recipient card not found   |
| 500    | `INTERNAL_ERROR`      | Server error               |

***

## Related

<CardGroup cols={2}>
  <Card title="Get Balance" icon="wallet" href="/api-reference/wallet/balance">
    Check balance before transfer
  </Card>

  <Card title="Lookup Subscriber" icon="search" href="/api-reference/subscribers/lookup">
    Find subscriber by phone
  </Card>
</CardGroup>


## OpenAPI

````yaml olive-openapi.json POST /wallet/transfer-p2p
openapi: 3.0.0
info:
  description: >-
    API Gateway for OLIVE NFC Card Payment System - Comprehensive payment, card
    management, agent operations, and admin authentication. All /api/v1 routes
    require authentication using either API Key or JWT token.
  title: OLIVE NFC Card Payment API
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    email: support@olive.sl
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://olive-gateway-a6ba.onrender.com/api/v1
security: []
paths:
  /wallet/transfer-p2p:
    post:
      tags:
        - Wallet
      summary: Peer-to-peer transfer
      description: Transfer funds between OLIVE users by card serial
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handler.TransferP2PRequest'
        description: P2P transfer details
        required: true
      responses:
        '200':
          description: Transfer successful
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    handler.TransferP2PRequest:
      type: object
      required:
        - amount
        - pin
        - recipient_card_serial
        - sender_id
      properties:
        amount:
          description: Accepts decimal format like "100.00" or "100"
          type: string
          example: '100.00'
        memo:
          type: string
          example: Payment for lunch
        pin:
          type: string
          example: '1234'
        recipient_card_serial:
          description: 'Supports any alphanumeric: CARD0001, 48290173K, etc.'
          type: string
          example: CARD0002
        sender_id:
          type: string
          example: subscriber-uuid
  securitySchemes:
    ApiKeyAuth:
      description: >-
        API Key for third-party integrations (WhatsApp, Smart PAY, VULT).
        Format: 'Bearer olive_live_xxxxxxxxxxxxx'
      type: apiKey
      name: Authorization
      in: header
    BearerAuth:
      description: >-
        JWT token from admin login for administrative operations. Format:
        'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
      type: apiKey
      name: Authorization
      in: header

````