{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/lemonway/main/json-schema/lemonway-create-bnpl-payment-input-schema.json",
  "title": "CreateBnplPaymentInput",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lemonway-directkit-api-2-0-openapi.yml#/components/schemas/CreateBnplPaymentInput",
  "required": [
    "paymentPlanId",
    "delivery",
    "items",
    "customer",
    "returnUrl",
    "errorUrl",
    "cancelUrl",
    "accountId"
  ],
  "type": "object",
  "properties": {
    "paymentPlanId": {
      "format": "int64",
      "description": "Payment Plan ID",
      "type": "integer"
    },
    "captureMode": {
      "description": "Defines if the payment should be captured right away or if the capture should be deferred.\r\nPossible values: `Automatic` and `Manual`. Default is set to 'Automatic'.",
      "type": "string"
    },
    "delivery": {
      "$ref": "#/$defs/BnplDelivery"
    },
    "items": {
      "description": "Possible values:  \r\n`PhysicalGood`  \r\n`Discount`  \r\n`ShippingFee`  \r\n`DigitalGood`  \r\n`ExternalPayment`  \r\n`Insurance`",
      "type": "array",
      "items": {
        "$ref": "#/$defs/BnplPurchaseItem"
      }
    },
    "customer": {
      "$ref": "#/$defs/Customer"
    },
    "returnUrl": {
      "description": "Return success url",
      "type": "string"
    },
    "errorUrl": {
      "description": "Return error url",
      "type": "string"
    },
    "cancelUrl": {
      "description": "Return cancel url",
      "type": "string"
    },
    "reference": {
      "description": "Unique ID of the call, generated by your server. This ID can be used as a search field when looking for operation details",
      "maxLength": 50,
      "minLength": 0,
      "type": "string"
    },
    "accountId": {
      "description": "Payment Account ID to Credit",
      "maxLength": 256,
      "minLength": 0,
      "type": "string"
    },
    "totalAmount": {
      "format": "int32",
      "description": "Amount to Debit\r\nAmounts are given as integer numbers in cents",
      "type": "integer"
    },
    "commissionAmount": {
      "format": "int32",
      "description": "Your Fee\r\nAmounts are given as integer numbers in cents",
      "type": "integer"
    },
    "comment": {
      "description": "Comment Regarding the Transaction",
      "maxLength": 140,
      "minLength": 0,
      "type": "string"
    },
    "autoCommission": {
      "description": "If true:\r\n1. [amountCom] will be ignored and will be replaced with Lemonway's fee  \r\n2. You will not receive any fee",
      "type": "boolean"
    }
  },
  "$defs": {
    "BnplAddress": {
      "required": [
        "street",
        "city",
        "postCode",
        "country"
      ],
      "type": "object",
      "properties": {
        "street": {
          "description": "",
          "type": "string"
        },
        "city": {
          "description": "",
          "type": "string"
        },
        "postCode": {
          "description": "",
          "type": "string"
        },
        "country": {
          "description": "",
          "type": "string"
        }
      }
    },
    "BnplDelivery": {
      "required": [
        "deliveryMode",
        "expressDelivery",
        "deliveryAddress"
      ],
      "type": "object",
      "properties": {
        "deliveryMode": {
          "description": "Possible values:   \r\n`CollectionOfTheGoodsInTheMerchantStore`\r\n`CollectionInAThirdPartyPoint`\r\n`DeliveryToCustomerAddress`",
          "type": "string"
        },
        "expressDelivery": {
          "type": "boolean"
        },
        "deliveryAddress": {
          "$ref": "#/$defs/BnplAddress"
        },
        "deliveryPointName": {
          "description": "Pickup name or recipient name.\r\nMandatory only if DeliveryMode is not \"DeliveryToCustomerAddress\".",
          "type": "string"
        }
      }
    },
    "BnplPurchaseItem": {
      "required": [
        "type",
        "description",
        "reference",
        "quantity",
        "unitAmount",
        "merchantAccountId"
      ],
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "reference": {
          "type": "string"
        },
        "quantity": {
          "format": "int32",
          "type": "integer"
        },
        "unitAmount": {
          "format": "int32",
          "type": "integer"
        },
        "merchantAccountId": {
          "type": "string"
        }
      }
    },
    "Customer": {
      "required": [
        "accountId",
        "civility",
        "firstName",
        "lastName",
        "mobileNumber",
        "email",
        "billingAddress"
      ],
      "type": "object",
      "properties": {
        "accountId": {
          "description": "Client account Id.",
          "type": "string"
        },
        "civility": {
          "description": "Client civility.  \r\nPossible values: `Mr` and `Ms`",
          "type": "string"
        },
        "firstName": {
          "description": "Client first name.",
          "type": "string"
        },
        "lastName": {
          "description": "Client last name.",
          "type": "string"
        },
        "birthDate": {
          "description": "Client birth date.",
          "type": "string"
        },
        "mobileNumber": {
          "description": "Client phone number.",
          "type": "string"
        },
        "email": {
          "description": "Client email.",
          "type": "string"
        },
        "taxIdentificationNumber": {
          "description": "Client tax identification number.",
          "type": "string"
        },
        "billingAddress": {
          "$ref": "#/$defs/BnplAddress"
        }
      }
    }
  }
}