# Credit note from proof of payment

Creating credit note from existing proof of payment.

It will create a credit note from the given proof of payment. It will
automatically take all proof of payment items and add them to the credit
note.

Endpoint: POST /api/proof-payments/{code}/credit-note
Version: 1.0.0
Security: shoptetAccessToken, shoptetPrivateApiToken

## Path parameters:

  - `code` (string, required)
    Proof of payment code
    Example: "P-2014000004-01"

## Header parameters:

  - `Content-Type` (string, required)

## Request fields (application/json):

  - `data` (object, required)

  - `data.creditNoteCode` (string)
    Credit note code. Optional, generated by eshop settings if not set.

  - `data.varSymbol` (number)
    Variable symbol. Optional, generated by eshop settings if not set.

  - `data.dueDate` (string,null)
    Due date. Optional, generated by eshop settings if not set.

  - `data.taxDate` (string,null)
    Date of taxation. Optional, default is today.

  - `data.constSymbol` (string)
    Constant symbol. Optional

  - `data.specSymbol` (number)
    Specific symbol. Optional

  - `data.billingMethodId` (integer)
    Billing method identifier - see also [Invoice billing methods](#section/code-lists/invoice-billing-methods) code list. Optional.

  - `data.orderCode` (string)
    Order Code. Optional, defaults to proof payment's order code if not set.

  - `data.reasonRemark` (string,null)
    Reason for credit note; default reason can be applied if not send.

## Response 201 fields (application/json):

  - `data` (object, required)

  - `data.creditNote` (object, required)

  - `data.creditNote.code` (string, required)
    variant code (product) (can be null)

  - `data.creditNote.isValid` (boolean, required)
    is the credit note valid?

  - `data.creditNote.invoiceCode` (string,null, required)
    invoice number (can be null). Caution! This does not have to be just a number, it can also contain letters, a dash, etc.

  - `data.creditNote.orderCode` (string,null, required)
    purchase order number (can be null). Caution! This does not have to be just a number, it can also contain letters, a dash, etc.

  - `data.creditNote.proofPaymentCode` (string,null, required)
    proof payment code (can be null). Caution! This does not have to be just a number, it can also contain letters, a dash, etc.

  - `data.creditNote.creationTime` (string,null, required)
    date of issue, in ISO 8601 format

  - `data.creditNote.changeTime` (string,null, required)
    date of change, in ISO 8601 format

  - `data.creditNote.dueDate` (string,null, required)
    due date in ISO 8601 format (can be null)

  - `data.creditNote.taxDate` (string,null, required)
    taxation date in ISO 8601 format (can be null)

  - `data.creditNote.varSymbol` (number, required)
    variable symbol

  - `data.creditNote.constSymbol` (integer,null, required)
    constant symbol (can be null)

  - `data.creditNote.specSymbol` (number,null, required)
    specific symbol (can be null)

  - `data.creditNote.restocked` (boolean)
    Items in credit note were restocked?

  - `data.creditNote.stockAmountChangeType` (string,null, required)
    type of change in stock quantity (can be null)

  - `data.creditNote.weight` (string,null, required)
    weight in kg, unpacked, 3 decimal places. Maximum value 999999.

  - `data.creditNote.completePackageWeight` (string,null, required)
    weight in kg, unpacked, 3 decimal places. Maximum value 999999.

  - `data.creditNote.billingMethod` (any, required)
    information about the method of payment

  - `data.creditNote.billingAddress` (object, required)
    invoicing address

  - `data.creditNote.billingAddress.company` (string,null, required)
    name of purchaser''s company (or null)

  - `data.creditNote.billingAddress.fullName` (string,null, required)
    name of purchaser (or null)

  - `data.creditNote.billingAddress.street` (string,null, required)
    street of purchaser (or null)

  - `data.creditNote.billingAddress.houseNumber` (string,null, required)
    street number (or null)

  - `data.creditNote.billingAddress.city` (string,null, required)
    city/town (village) (or null)

  - `data.creditNote.billingAddress.district` (string,null, required)
    county (or null)

  - `data.creditNote.billingAddress.additional` (string,null, required)
    additional address information (or null)

  - `data.creditNote.billingAddress.zip` (string,null, required)
    ZIP or postal code (or null)

  - `data.creditNote.billingAddress.countryCode` (string,null, required)
    tree-character ISO country code (ISO 4217)

  - `data.creditNote.billingAddress.regionName` (string,null, required)
    region name (or null)

  - `data.creditNote.billingAddress.regionShortcut` (string,null, required)
    region abbreviation (or null)

  - `data.creditNote.billingAddress.companyId` (string,null, required)
    Company registration number. (can be null)

  - `data.creditNote.billingAddress.vatId` (string,null, required)
    VAT identification number. (can be null)

  - `data.creditNote.billingAddress.vatIdValidationStatus` (any)
    Info, whether VAT ID has been verified, enum [unverified, verified, waiting]
    Enum: "unverified", "verified", "waiting", null

  - `data.creditNote.billingAddress.taxId` (string,null, required)
    TAX identification number. For Czech address, taxId is same as vatId. (can be null)

  - `data.creditNote.deliveryAddress` (object,null, required)
    delivery address (can be null)

  - `data.creditNote.deliveryAddress.company` (string,null, required)
    name of purchaser''s company (or null)

  - `data.creditNote.deliveryAddress.fullName` (string,null, required)
    name of purchaser (or null)

  - `data.creditNote.deliveryAddress.street` (string,null, required)
    street of purchaser (or null)

  - `data.creditNote.deliveryAddress.houseNumber` (string,null, required)
    street number (or null)

  - `data.creditNote.deliveryAddress.city` (string,null, required)
    city/town (village) (or null)

  - `data.creditNote.deliveryAddress.district` (string,null, required)
    county (or null)

  - `data.creditNote.deliveryAddress.additional` (string,null, required)
    additional address information (or null)

  - `data.creditNote.deliveryAddress.zip` (string,null, required)
    ZIP or postal code (or null)

  - `data.creditNote.deliveryAddress.countryCode` (string,null, required)
    tree-character ISO country code (ISO 4217)

  - `data.creditNote.deliveryAddress.regionName` (string,null, required)
    region name (or null)

  - `data.creditNote.deliveryAddress.regionShortcut` (string,null, required)
    region abbreviation (or null)

  - `data.creditNote.addressesEqual` (boolean, required)
    Are delivery and invoicing address the same?

  - `data.creditNote.price` (object, required)

  - `data.creditNote.price.vat` (string,null, required)
    VAT value, two decimal places

  - `data.creditNote.price.toPay` (string,null, required)
    total price to pay

  - `data.creditNote.price.currencyCode` (string, required)
    Currency code. List of available currencies within the e-shop can be found in endpoint GET /api/eshop.

  - `data.creditNote.price.withoutVat` (string,null, required)
    price excluding tax

  - `data.creditNote.price.withVat` (string,null, required)
    price including tax

  - `data.creditNote.price.exchangeRate` (string, required)
    currency rate of the receipt for the default currency of the shop. This value is saved together with the price and reflects the historical value valid in the instant of the order creation. If the shop changes the default currency, the value still refers to the original currency!

  - `data.creditNote.price.invoicingExchangeRate` (string)
    currency rate of the receipt for the default currency of the shop. This value is saved together with the price and reflects the historical value valid in the instant of the order creation. If the shop changes the default currency, the value still refers to the original currency!

  - `data.creditNote.price.partialPaymentAmount` (string,null)
    can be value expressed in percents or as exact money value expression (with up to two decimal places) - depends on partialPaymentType value

  - `data.creditNote.price.partialPaymentType` (string)
    'percents' = partial payment as percentage from total price | 'absolute' = exact expression of partial payment in money

  - `data.creditNote.customer` (object, required)

  - `data.creditNote.customer.guid` (any, required)
    customer identifier (can be null)

  - `data.creditNote.customer.phone` (string,null, required)
    customer phone (can be null)

  - `data.creditNote.customer.email` (string,null, required)
    customer e-mail (can be null)

  - `data.creditNote.customer.remark` (string,null, required)
    remark for the customer (can be null)

  - `data.creditNote.eshop` (object, required)

  - `data.creditNote.eshop.bankAccount` (string,null, required)
    e-shop bank account (can be null)

  - `data.creditNote.eshop.iban` (string,null, required)
    e-shop IBAN (can be null)

  - `data.creditNote.eshop.bic` (string,null, required)
    bank code - SWIFT (can be null)

  - `data.creditNote.eshop.vatPayer` (boolean, required)
    VAT payer (can be null)

  - `data.creditNote.items` (array, required)

  - `data.creditNote.items.productGuid` (any, required)
    global unique permanent product identifier (can be null)

  - `data.creditNote.items.code` (string,null, required)
    variant code (product) (can be null)

  - `data.creditNote.items.itemType` (string, required)
    item type

  - `data.creditNote.items.name` (string,null, required)
    product name (can be null)

  - `data.creditNote.items.variantName` (string,null, required)
    variant name (can be null)

  - `data.creditNote.items.brand` (string,null, required)
    brand name (can be null)

  - `data.creditNote.items.amount` (string,null, required)
    quantity

  - `data.creditNote.items.amountUnit` (string,null, required)
    unit of quantity (can be null)

  - `data.creditNote.items.remark` (string,null, required)
    remark (can be null)

  - `data.creditNote.items.priceRatio` (string, required)
    discount - 0.7800 = discount 22%; 1.0000 = no discount

  - `data.creditNote.items.weight` (any, required)

  - `data.creditNote.items.additionalField` (string,null, required)
    additional info (can be null)

  - `data.creditNote.items.itemPrice` (object, required)
    item price

  - `data.creditNote.items.itemPrice.withVat` (string,null, required)
    price including tax

  - `data.creditNote.items.itemPrice.withoutVat` (string,null, required)
    price excluding tax

  - `data.creditNote.items.itemPrice.vat` (string,null, required)
    VAT value, two decimal places

  - `data.creditNote.items.itemPrice.vatRate` (string, required)
    VAT rate

  - `data.creditNote.items.unitPrice` (object, required)
    unit price

  - `data.creditNote.items.purchasePrice` (any, required)
    purchase price of the part, can be null.

  - `data.creditNote.items.displayPrices` (array)
    in some cases, one item is displayed as multiple lines in the administration or a printout. This array contains one or more rows representing the printout version of the item.

  - `data.creditNote.items.itemId` (integer, required)
    item identifier for manipulation with this item

  - `data.creditNote.items.surchargeParameters` (array)

  - `data.creditNote.items.surchargeParameters.parameterName` (object)
    surcharge parameter name's information

  - `data.creditNote.items.surchargeParameters.parameterName.code` (string,null)
    parameters name code, can be null if already deleted

  - `data.creditNote.items.surchargeParameters.parameterName.name` (string)
    parameters name

  - `data.creditNote.items.surchargeParameters.parameterName.subscription` (boolean,null)
    indicates whether this surcharge parameter is a subscription (recurring payment)

  - `data.creditNote.items.surchargeParameters.parameterValue` (object)
    surcharge parameter value's information

  - `data.creditNote.items.surchargeParameters.parameterValue.valueIndex` (string,null)
    parameters value code, can be null if already deleted

  - `data.creditNote.items.surchargeParameters.parameterValue.description` (string)
    parameters value name

  - `data.creditNote.items.surchargeParameters.parameterValue.price` (string,null)
    parameters value additional price

  - `data.creditNote.items.specificSurchargeParameters` (array)

  - `data.creditNote.items.specificSurchargeParameters.relationId` (string, required)
    id which identifies relation between item and surcharge. Can be used to delete surcharge parameter related to item.

  - `data.creditNote.items.specificSurchargeParameters.name` (string, required)
    full name of surcharge parameter.

  - `data.creditNote.items.specificSurchargeParameters.price` (string,null, required)
    price of surcharge parameter

  - `data.creditNote.items.itemPriceVatBreakdown` (array,null)
    Detailed VAT list displaying tax amounts for each VAT rate used in the document. Applied for non product items.

  - `data.creditNote.documentRemark` (string,null, required)
    remark on the document (can be null)

  - `data.creditNote.vatPayer` (boolean, required)
    is the tradesman a VAT payer? (can be null)

  - `data.creditNote.vatMode` (string,null)
    VAT mode, can be null, possible values: Normal, One Stop Shop, Mini One Stop Shop, Reverse charge, Outside the EU

  - `data.creditNote.reasonRemark` (string,null)
    Reason for credit note; default reason can be applied if not send.

  - `errors` (array,null, required)

  - `errors.errorCode` (string, required)
    Short text error identification

  - `errors.message` (string, required)
    Descriptive error message

  - `errors.instance` (string, required)
    Identification of the entity referenced

  - `metadata` (object, required)

  - `metadata.requestId` (string, required)
    Request identifier. Useful for logging/reporting purposes.

## Response 404 fields (application/json):

  - `data` (object,null)

  - `errors` (array,null)

  - `metadata` (object)

## Response 409 fields (application/json):

  - `data` (object,null)

  - `errors` (array,null)

  - `metadata` (object)

## Response 422 fields (application/json):

  - `data` (object,null)

  - `errors` (array,null)

  - `metadata` (object)


