{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pluggy/json-schema/pluggy-smart-transfer-payment-schema.json",
  "title": "SmartTransferPayment",
  "description": "Smart transfer payment",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pluggy-smart-transfer-api-openapi.yml#/components/schemas/SmartTransferPayment",
  "properties": {
    "id": {
      "type": "string",
      "description": "Payment primary identifier"
    },
    "preauthorizationId": {
      "type": "string",
      "description": "Payment primary identifier"
    },
    "status": {
      "$ref": "#/$defs/SmartTransferPaymentStatus"
    },
    "amount": {
      "type": "number",
      "description": "Payment amount"
    },
    "description": {
      "type": "string",
      "description": "Payment description"
    },
    "recipient": {
      "description": "Recipient of the transfer. May be null until the payment is associated with one.",
      "anyOf": [
        {
          "$ref": "#/$defs/PaymentRecipient"
        },
        {
          "type": "null"
        }
      ]
    },
    "clientPaymentId": {
      "type": "string",
      "description": "Client payment identifier"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date when the payment was created"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date when the payment was updated"
    },
    "errorDetail": {
      "type": "object",
      "description": "Error detail",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "INFRASTRUCTURE_FAILURE",
            "PAYMENT_DIFFERENT_FROM_CONSENT",
            "UNKNOWN_ERROR",
            "INVALID_PAYMENT_DETAIL",
            "PAYMENT_REJECTED_BY_HOLDER",
            "PAYMENT_REJECTED_BY_SPI"
          ],
          "description": "Error code. \n- INFRASTRUCTURE_FAILURE: Indicates a failure in the infrastructure of the institution holding the information or resources.\n- PAYMENT_DIFFERENT_FROM_CONSENT: Payment data differs from consent data.\n- UNKNOWN_ERROR: Unknown error.\n- INVALID_PAYMENT_DETAIL: The payment detail is invalid.\n- PAYMENT_REJECTED_BY_HOLDER: The payment was rejected by the account holder.\n- PAYMENT_REJECTED_BY_SPI: The payment was rejected by the SPI."
        },
        "description": {
          "type": "string",
          "description": "Error description"
        },
        "detail": {
          "type": "string",
          "description": "Error detail"
        }
      }
    }
  },
  "type": "object",
  "required": [
    "id",
    "preauthorizationId",
    "status",
    "amount",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "PaymentInstitution": {
      "description": "Response with information related to a payment institution",
      "properties": {
        "id": {
          "type": "string",
          "description": "Primary identifier"
        },
        "name": {
          "type": "string",
          "description": "Payment institution name"
        },
        "tradeName": {
          "type": "string",
          "description": "Payment institution trade name"
        },
        "ispb": {
          "type": "string",
          "description": "Payment institution ISPB"
        },
        "compe": {
          "type": "string",
          "description": "Payment institution COMPE"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "Date when the payment institution was created"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Date when the payment institution was updated"
        }
      },
      "type": "object",
      "required": [
        "id",
        "name",
        "ispb",
        "tradeName",
        "createdAt",
        "updatedAt"
      ]
    },
    "PaymentRecipient": {
      "description": "Bank-account payment recipient. Returned by `/payments/recipients` endpoints and embedded inside payment requests when the request targets a registered recipient.",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "BANK_ACCOUNT"
          ],
          "description": "Recipient discriminator. Always `BANK_ACCOUNT` for this schema."
        },
        "id": {
          "type": "string",
          "description": "Primary identifier"
        },
        "taxNumber": {
          "type": "string",
          "description": "Account owner tax number. Can be CPF or CNPJ (only numbers)."
        },
        "name": {
          "type": "string",
          "description": "Account owner name."
        },
        "paymentInstitution": {
          "allOf": [
            {
              "$ref": "#/$defs/PaymentInstitution"
            }
          ],
          "description": "Institution that holds the recipient's bank account."
        },
        "isDefault": {
          "type": "boolean",
          "description": "Indicates if the recipient is the default one"
        },
        "account": {
          "$ref": "#/$defs/PaymentRecipientAccount"
        },
        "pixKey": {
          "type": [
            "string",
            "null"
          ],
          "description": "Pix key associated with the payment recipient"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "Date when the payment recipient was created"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Date when the payment recipient was last updated"
        }
      },
      "type": "object",
      "required": [
        "type",
        "id",
        "name",
        "taxNumber",
        "paymentInstitution",
        "isDefault",
        "account",
        "createdAt",
        "updatedAt"
      ]
    },
    "PaymentRecipientAccount": {
      "description": "Payment receiver bank account information",
      "properties": {
        "branch": {
          "type": "string",
          "description": "Receiver bank account branch (agency)"
        },
        "number": {
          "type": "string",
          "description": "Receiver bank account number"
        },
        "type": {
          "type": "string",
          "description": "Receiver bank account type, could be: 'CHECKING_ACCOUNT', 'SAVINGS_ACCOUNT' or 'GUARANTEED_ACCOUNT'"
        }
      },
      "type": "object",
      "required": [
        "branch",
        "number",
        "type"
      ]
    },
    "SmartTransferPaymentStatus": {
      "type": "string",
      "description": "Lifecycle of a Smart Transfer payment. Narrower than `PaymentIntentStatus`: Smart Transfer payments operate under an already-authorized preauthorization, so consent-collection statuses (`STARTED`, `ENQUEUED`, `CONSENT_AWAITING_AUTHORIZATION`) and consent-revocation statuses (`REJECTED`, `REVOKED`, `CONSUMED`) do not apply.\n- `CONSENT_AUTHORIZED`: the payment was accepted under the preauthorization and is ready to be processed.\n- `CONSENT_REJECTED`: the preauthorization was rejected at execution time.\n- `PAYMENT_PENDING`: the payment was submitted to the institution and is awaiting confirmation.\n- `PAYMENT_PARTIALLY_ACCEPTED`: the payment was accepted but still needs an additional authorization.\n- `PAYMENT_SETTLEMENT_PROCESSING`: the settlement is being processed.\n- `PAYMENT_SETTLEMENT_DEBTOR_ACCOUNT`: the funds were debited from the payer account; awaiting clearing.\n- `PAYMENT_COMPLETED`: the payment was confirmed by the institution.\n- `PAYMENT_REJECTED`: the payment was rejected after consent was authorized.\n- `ERROR`: an unexpected error occurred during the flow.\n- `CANCELED`: the payment was canceled.",
      "enum": [
        "CONSENT_AUTHORIZED",
        "CONSENT_REJECTED",
        "PAYMENT_PENDING",
        "PAYMENT_PARTIALLY_ACCEPTED",
        "PAYMENT_SETTLEMENT_PROCESSING",
        "PAYMENT_SETTLEMENT_DEBTOR_ACCOUNT",
        "PAYMENT_COMPLETED",
        "PAYMENT_REJECTED",
        "ERROR",
        "CANCELED"
      ]
    }
  }
}