openapi: 3.1.0
info:
  title: Payment webhooks
  version: "1"
  description: Notifications Datman sends to your webhook URL when a payment's
    status changes.
tags:
  - name: Webhooks
    description: Callbacks that Datman sends to your webhook URL.
paths: {}
webhooks:
  paymentStatus:
    post:
      operationId: paymentStatusWebhook
      summary: Payment status notification
      description: Datman sends a JSON POST to your configured webhook URL when the
        status of a payment changes. Verify the `HMACSignature` header before
        trusting the payload.
      tags:
        - Webhooks
      security: []
      parameters:
        - name: HMACSignature
          in: header
          required: false
          description: HMAC-SHA256 of the JSON body using your webhook secret, hex-encoded.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PaymentStatusWebhook"
            examples:
              paymentAuthorised:
                summary: Payment authorised
                value:
                  order_id: ORD-100245
                  amount: "24.50"
                  currency: GBP
                  customer_id: CUST-55021
                  xref: O88213045M663412T4821937
                  status: authorisation
                  success: "true"
                  date: 2026-10-15T12:34:56+01:00
                  three_ds_authenticated: "true"
                  three_ds_authenticated_response: Y
                  card_bin: "411111"
                  last4_digits: "1111"
                  shopper_ip: 203.0.113.42
                  shopper_email: jane.doe@example.com
                  expiry_date: 03/2030
                  avs_result: 4 AVS not supported for this card type
                  cvc_result: 1 Matches
                  card_type: visa
              paymentRefused:
                summary: Payment refused
                value:
                  order_id: ORD-100246
                  amount: "24.50"
                  currency: GBP
                  customer_id: CUST-55021
                  xref: O88213046M663412T4821938
                  status: authorisation
                  success: "false"
                  date: 2026-10-15T12:34:56+01:00
                  three_ds_authenticated: "false"
                  three_ds_authenticated_response: N
                  card_bin: "411111"
                  last4_digits: "1111"
                  shopper_ip: 203.0.113.42
                  shopper_email: jane.doe@example.com
                  expiry_date: 03/2030
                  avs_result: 4 AVS not supported for this card type
                  cvc_result: 2 Does not match
                  card_type: visa
                  reason: CVC Declined
      responses:
        "200":
          description: Acknowledge receipt of the notification.
components:
  schemas:
    SplitFeeStatus:
      type: object
      properties:
        outcome:
          type: string
        message:
          type: string
    PaymentStatusWebhook:
      type: object
      properties:
        order_id:
          type: string
          description: Your original order reference.
        amount:
          type: string
          description: Amount in major units with two decimals (e.g. "10.00").
        currency:
          type: string
          description: ISO 4217 currency code.
        customer_id:
          type: string
          description: Your original shopper reference.
        xref:
          type: string
          description: Datman transaction reference in the form
            O{order_id}M{merchant_id}T{payment_id}.
        status:
          type: string
          description: Lower-cased payment event code (e.g. "authorisation", "capture").
        success:
          type: string
          enum:
            - "true"
            - "false"
          description: Whether the event succeeded, as a string.
        date:
          type: string
          description: Event date/time.
        three_ds_authenticated:
          type: string
        three_ds_authenticated_response:
          type: string
        card_bin:
          type: string
        last4_digits:
          type: string
        shopper_ip:
          type: string
        shopper_email:
          type: string
        expiry_date:
          type: string
        avs_result:
          type: string
        cvc_result:
          type: string
        card_type:
          type: string
          description: Card brand / payment method variant.
        reason:
          type: string
          description: Failure reason; present only when `success` is "false".
        split_fee_status:
          $ref: "#/components/schemas/SplitFeeStatus"
          description: Split fee outcome; present only on capture events for orders with
            split fees.
