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

# Refund payment

> Refund a completed payment (full or partial)

# Refund Payment

Refunding a payment allows you to return funds to the payer for a specific transaction. Use the Refund Payment API to initiate a refund, specifying the payment ID and refund amount.


## OpenAPI

````yaml post /v1/payments/{payment_id}/refund
openapi: 3.0.3
info:
  title: Adullam Payment API
  version: 1.0.0
  description: >
    Adullam is a payment processing platform for mobile money transactions in
    West Africa.


    This API enables developers to:

    - Collect payments from customers via mobile money

    - Send money to recipients

    - Track transactions and account balance


    ## Authentication

    All endpoints (except auth endpoints) require Bearer token authentication.


    ## Base URL

    Production: `https://api.adullam.dev`


    ## Rate Limiting

    - 100 requests per minute

    - 1000 requests per hour
  contact:
    email: support@adullam.dev
    url: https://docs.adullam.dev
  license:
    name: Proprietary
    url: https://adullam.dev/terms
servers:
  - url: https://api.adullam.dev
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Partner authentication and token management
  - name: Payments
    description: Collect money from customers via mobile money
  - name: Transfers
    description: Send money to recipients via mobile money
  - name: Account
    description: Account and balance management
paths:
  /v1/payments/{payment_id}/refund:
    post:
      tags:
        - Payments
      summary: Refund payment
      description: Refund a completed payment (full or partial)
      parameters:
        - $ref: '#/components/parameters/PaymentId'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundRequest'
      responses:
        '201':
          description: Refund created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refund'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  parameters:
    PaymentId:
      name: payment_id
      in: path
      required: true
      schema:
        type: string
      description: Payment ID
      example: pay_abc123
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        format: uuid
      description: UUID for idempotent requests
      example: 550e8400-e29b-41d4-a716-446655440000
  schemas:
    RefundRequest:
      type: object
      properties:
        amount:
          type: integer
          minimum: 100
          description: Amount to refund (optional, full refund if not specified)
          example: 5000
        reason:
          type: string
          enum:
            - customer_request
            - fraud
            - duplicate
            - error
            - other
          example: customer_request
        description:
          type: string
          maxLength: 200
          example: Customer requested refund
    Refund:
      type: object
      properties:
        id:
          type: string
          example: refund_xyz789
        payment_id:
          type: string
          example: pay_abc123
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        amount:
          type: integer
          example: 5000
        currency:
          type: string
          example: XOF
        reason:
          type: string
          enum:
            - customer_request
            - fraud
            - duplicate
            - error
            - other
          example: customer_request
        description:
          type: string
          example: Customer requested refund
        ussd_reference:
          type: string
          nullable: true
          example: null
        created_at:
          type: string
          format: date-time
          example: '2024-01-15T11:00:00Z'
        completed_at:
          type: string
          format: date-time
          nullable: true
          example: null
        failure_reason:
          type: string
          nullable: true
          example: null
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - authentication_error
                - invalid_request
                - insufficient_funds
                - rate_limit_exceeded
                - channel_error
                - transaction_failed
                - server_error
              example: invalid_request
            code:
              type: string
              example: amount_too_low
            message:
              type: string
              example: Amount must be at least 100 XOF
            field:
              type: string
              nullable: true
              example: amount
            request_id:
              type: string
              example: req_abc123
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: invalid_request
              code: invalid_parameter
              message: Invalid parameter provided
              request_id: req_abc123
    Unauthorized:
      description: Unauthorized - Invalid or missing authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: authentication_error
              code: invalid_token
              message: Invalid or expired access token
              request_id: req_abc123
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: invalid_request
              code: resource_not_found
              message: The requested resource was not found
              request_id: req_abc123
    Conflict:
      description: Conflict - Idempotency key conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: invalid_request
              code: idempotency_key_conflict
              message: Idempotency key already used with different parameters
              request_id: req_abc123
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use the access token obtained from /v1/auth/token

````