curl -X POST \
/invoices/{id}/credit \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"positions": [
[]
],
"comment": "",
"paymentMethod": "https:\/\/example.com\/",
"customIntroduction": "",
"customClosing": ""
}'import requests
url = "https://coreapi.io/invoices/{id}/credit"
payload = {
"positions": [
{
"id": "<string>",
"quantity": 1,
"unitPrice": {}
}
],
"comment": "<string>",
"reason": "other",
"paymentMethod": "https://example.com/",
"customIntroduction": "<string>",
"customClosing": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
positions: [{id: '<string>', quantity: 1, unitPrice: {}}],
comment: '<string>',
reason: 'other',
paymentMethod: 'https://example.com/',
customIntroduction: '<string>',
customClosing: '<string>'
})
};
fetch('https://coreapi.io/invoices/{id}/credit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/invoices/{id}/credit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'positions' => [
[
'id' => '<string>',
'quantity' => 1,
'unitPrice' => [
]
]
],
'comment' => '<string>',
'reason' => 'other',
'paymentMethod' => 'https://example.com/',
'customIntroduction' => '<string>',
'customClosing' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "00000000-0000-0000-0000-000000000000",
"customer": {
"id": "00000000-0000-0000-0000-000000000000",
"customerNumber": "CUSTOMER-000",
"timeZone": "Europe/Berlin",
"firstName": "John",
"lastName": "Doe",
"currencyCode": "EUR",
"companyName": "Acme Inc.",
"datevId": "123456789",
"status": "STATUS_ACTIVE"
},
"paymentMethod": {
"id": "c1a2b3c4-d5e6-4f7a-8b9b-0c1d2e3f4a5b",
"gatewayName": "wallet",
"type": "sepa_debit",
"referenceId": "<string>",
"default": true,
"status": "active",
"source": "api",
"enabled": true,
"name": "Visa (4242)",
"data": [
"<string>"
],
"creationDate": "2024-01-15T10:30:00+00:00",
"expirationDate": "2026-12-31T23:59:59+00:00",
"sepaMandate": {},
"card": {
"brand": "Visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2022,
"cardHolder": "Max Mustermann"
},
"sepaDebit": {
"iban": "DE8937*********3232",
"bic": "COBADEFFXXX",
"mandateReference": "MNDT-2021-123456",
"signingDate": "2021-01-01T00:00:00+00:00"
},
"paypal": {
"email": "max@mustermann.de",
"billingAgreementId": "I-1J5gqz2eZvKYlo2C2X2X2X2X"
}
},
"referencedInvoice": "<unknown>",
"type": "TYPE_INVOICE",
"currencyCode": "EUR",
"number": "RE-0000000001",
"status": "STATUS_DRAFT",
"creationDate": "2023-11-07T05:31:56Z",
"finalizationDate": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"lastReminderDate": "2023-11-07T05:31:56Z",
"lastSentAt": "2023-11-07T05:31:56Z",
"dunningLevel": 123,
"dunningStatus": "none",
"payDate": "2023-11-07T05:31:56Z",
"invoiceAddress": "<unknown>",
"internalNote": "This invoice is with a special discount.",
"title": "<string>",
"introduction": "<string>",
"closing": "<string>",
"netAmount": {},
"grossAmount": {},
"taxAmount": {},
"discountAmount": {},
"file": {
"id": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ",
"isPrivate": true,
"mimeType": "image/jpeg",
"fileExtension": "jpg",
"fileName": "invoice.jpg",
"storageFileName": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ.jpg",
"createdAt": "2021-01-01T00:00:00+00:00"
},
"xmlFile": {
"id": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ",
"isPrivate": true,
"mimeType": "image/jpeg",
"fileExtension": "jpg",
"fileName": "invoice.jpg",
"storageFileName": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ.jpg",
"createdAt": "2021-01-01T00:00:00+00:00"
},
"positions": [
{
"id": {},
"position": 123,
"quantity": 1,
"unit": {
"id": {},
"name": "Stück"
},
"unitPrice": {},
"netAmount": {},
"grossAmount": {},
"taxAmount": {},
"discountAmount": {},
"discountPercentage": 10,
"name": "My subscription product",
"description": "* my subscription product",
"taxGroup": {
"internalDescription": "19%",
"reverseChargeType": "REVERSE_CHARGE",
"type": "standard",
"id": "00000000-0000-0000-0000-000000000000"
},
"tax": {
"code": "19",
"rate": 19,
"id": "00000000-0000-0000-0000-000000000000",
"description": "19%"
},
"type": "product",
"parent": "<unknown>",
"group": {
"id": "ad8a3b9e-5b0a-4e1a-9c1a-0b9b2b8b0b0b",
"ranking": 1,
"name": "Subscription #12345"
},
"createdAt": "2020-01-01T00:00:00+00:00",
"product": {
"type": "product",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"invoiceVisibility": "always",
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"subscriptionItem": {
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"name": "Fitness M",
"description": "Everything included",
"furtherInformation": "Additional agreements: The contract includes a free drink flatrate.",
"status": "active",
"subscriptionId": "<string>"
},
"serviceDateFrom": "2020-01-01T00:00:00+00:00",
"serviceDateTo": "2020-01-01T00:00:00+00:00"
}
],
"applicatedExchangeRates": [
{
"sourceCurrencyCode": "EUR",
"destinationCurrencyCode": "CHF",
"exchangeRate": "1.135",
"exchangeRateDate": "2023-11-07T05:31:56Z"
}
],
"eInvoiceType": "zugferd211",
"leitwegId": "1234567890123",
"customFields": {
"field1": "value1",
"field2": "value2"
},
"serviceDateFrom": "2023-11-07T05:31:56Z",
"serviceDateTo": "2023-11-07T05:31:56Z",
"unpaidAmount": {},
"usageBreakdownUrl": "<string>",
"cancellationDocument": {
"number": "R2021-0001",
"id": "8d6b0f9e-5b9a-4e1a-9f0a-5e8e1a0b1b1e"
},
"dunningDisabled": true,
"paymentProviderFeeCents": {},
"sourceType": "<unknown>",
"creditNotes": "<array>"
}Credit invoice
Credit an invoice. This will credit the given positions and send an email to the customer. This is only possible if the invoice is already finalized and paid or partial paid. This is available for invoices only.
Required permissions:invoice:creditcurl -X POST \
/invoices/{id}/credit \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"positions": [
[]
],
"comment": "",
"paymentMethod": "https:\/\/example.com\/",
"customIntroduction": "",
"customClosing": ""
}'import requests
url = "https://coreapi.io/invoices/{id}/credit"
payload = {
"positions": [
{
"id": "<string>",
"quantity": 1,
"unitPrice": {}
}
],
"comment": "<string>",
"reason": "other",
"paymentMethod": "https://example.com/",
"customIntroduction": "<string>",
"customClosing": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
positions: [{id: '<string>', quantity: 1, unitPrice: {}}],
comment: '<string>',
reason: 'other',
paymentMethod: 'https://example.com/',
customIntroduction: '<string>',
customClosing: '<string>'
})
};
fetch('https://coreapi.io/invoices/{id}/credit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/invoices/{id}/credit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'positions' => [
[
'id' => '<string>',
'quantity' => 1,
'unitPrice' => [
]
]
],
'comment' => '<string>',
'reason' => 'other',
'paymentMethod' => 'https://example.com/',
'customIntroduction' => '<string>',
'customClosing' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "00000000-0000-0000-0000-000000000000",
"customer": {
"id": "00000000-0000-0000-0000-000000000000",
"customerNumber": "CUSTOMER-000",
"timeZone": "Europe/Berlin",
"firstName": "John",
"lastName": "Doe",
"currencyCode": "EUR",
"companyName": "Acme Inc.",
"datevId": "123456789",
"status": "STATUS_ACTIVE"
},
"paymentMethod": {
"id": "c1a2b3c4-d5e6-4f7a-8b9b-0c1d2e3f4a5b",
"gatewayName": "wallet",
"type": "sepa_debit",
"referenceId": "<string>",
"default": true,
"status": "active",
"source": "api",
"enabled": true,
"name": "Visa (4242)",
"data": [
"<string>"
],
"creationDate": "2024-01-15T10:30:00+00:00",
"expirationDate": "2026-12-31T23:59:59+00:00",
"sepaMandate": {},
"card": {
"brand": "Visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2022,
"cardHolder": "Max Mustermann"
},
"sepaDebit": {
"iban": "DE8937*********3232",
"bic": "COBADEFFXXX",
"mandateReference": "MNDT-2021-123456",
"signingDate": "2021-01-01T00:00:00+00:00"
},
"paypal": {
"email": "max@mustermann.de",
"billingAgreementId": "I-1J5gqz2eZvKYlo2C2X2X2X2X"
}
},
"referencedInvoice": "<unknown>",
"type": "TYPE_INVOICE",
"currencyCode": "EUR",
"number": "RE-0000000001",
"status": "STATUS_DRAFT",
"creationDate": "2023-11-07T05:31:56Z",
"finalizationDate": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"lastReminderDate": "2023-11-07T05:31:56Z",
"lastSentAt": "2023-11-07T05:31:56Z",
"dunningLevel": 123,
"dunningStatus": "none",
"payDate": "2023-11-07T05:31:56Z",
"invoiceAddress": "<unknown>",
"internalNote": "This invoice is with a special discount.",
"title": "<string>",
"introduction": "<string>",
"closing": "<string>",
"netAmount": {},
"grossAmount": {},
"taxAmount": {},
"discountAmount": {},
"file": {
"id": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ",
"isPrivate": true,
"mimeType": "image/jpeg",
"fileExtension": "jpg",
"fileName": "invoice.jpg",
"storageFileName": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ.jpg",
"createdAt": "2021-01-01T00:00:00+00:00"
},
"xmlFile": {
"id": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ",
"isPrivate": true,
"mimeType": "image/jpeg",
"fileExtension": "jpg",
"fileName": "invoice.jpg",
"storageFileName": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ.jpg",
"createdAt": "2021-01-01T00:00:00+00:00"
},
"positions": [
{
"id": {},
"position": 123,
"quantity": 1,
"unit": {
"id": {},
"name": "Stück"
},
"unitPrice": {},
"netAmount": {},
"grossAmount": {},
"taxAmount": {},
"discountAmount": {},
"discountPercentage": 10,
"name": "My subscription product",
"description": "* my subscription product",
"taxGroup": {
"internalDescription": "19%",
"reverseChargeType": "REVERSE_CHARGE",
"type": "standard",
"id": "00000000-0000-0000-0000-000000000000"
},
"tax": {
"code": "19",
"rate": 19,
"id": "00000000-0000-0000-0000-000000000000",
"description": "19%"
},
"type": "product",
"parent": "<unknown>",
"group": {
"id": "ad8a3b9e-5b0a-4e1a-9c1a-0b9b2b8b0b0b",
"ranking": 1,
"name": "Subscription #12345"
},
"createdAt": "2020-01-01T00:00:00+00:00",
"product": {
"type": "product",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"invoiceVisibility": "always",
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"subscriptionItem": {
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"name": "Fitness M",
"description": "Everything included",
"furtherInformation": "Additional agreements: The contract includes a free drink flatrate.",
"status": "active",
"subscriptionId": "<string>"
},
"serviceDateFrom": "2020-01-01T00:00:00+00:00",
"serviceDateTo": "2020-01-01T00:00:00+00:00"
}
],
"applicatedExchangeRates": [
{
"sourceCurrencyCode": "EUR",
"destinationCurrencyCode": "CHF",
"exchangeRate": "1.135",
"exchangeRateDate": "2023-11-07T05:31:56Z"
}
],
"eInvoiceType": "zugferd211",
"leitwegId": "1234567890123",
"customFields": {
"field1": "value1",
"field2": "value2"
},
"serviceDateFrom": "2023-11-07T05:31:56Z",
"serviceDateTo": "2023-11-07T05:31:56Z",
"unpaidAmount": {},
"usageBreakdownUrl": "<string>",
"cancellationDocument": {
"number": "R2021-0001",
"id": "8d6b0f9e-5b9a-4e1a-9f0a-5e8e1a0b1b1e"
},
"dunningDisabled": true,
"paymentProviderFeeCents": {},
"sourceType": "<unknown>",
"creditNotes": "<array>"
}Autorisierungen
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Pfadparameter
Invoice identifier
Body
The new Invoice resource
The positions to cancel.
1Show child attributes
Show child attributes
Comment for the activity of crediting the invoice.
The reason for crediting the invoice.
duplicate, incorrect, product_unsatisfactory, order_change, other "other"
The payment method for the credit note. The payment method must be valid and usable.
"https://example.com/"
The custom introduction for the credit note. It will be placed over the generic template.
The custom closing for the credit note. It will be placed over the generic template.
Antwort
Invoice resource created
The unique identifier of the invoice.
"00000000-0000-0000-0000-000000000000"
The customer of the invoice.
Show child attributes
Show child attributes
The payment method which should be used to fullfill the payment of the invoice.
Show child attributes
Show child attributes
The referenced invoice of the invoice. This could be in case of a reminder, refund etc.
The type of the invoice.
TYPE_INVOICE, TYPE_CREDIT, TYPE_REFUND, TYPE_REMINDER, TYPE_CANCEL, TYPE_DUNNING "TYPE_INVOICE"
The currency code of the invoice. If multiple currency codes will be used in the positions, they will be converted to that base currency.
"EUR"
The document id of the invoice. This will be generated, when the invoice will be finalized.
"RE-0000000001"
STATUS_DRAFT, STATUS_PAID, STATUS_CANCELLED, STATUS_CLOSED, STATUS_REFUNDED, STATUS_REMINDED, STATUS_UNPAID, STATUS_NEW, STATUS_FINALIZING reminder, dunning, none "none"
The invoice address of the invoice.
The notice of the invoice.
"This invoice is with a special discount."
The net amount of the invoice.
The total net discount amount of the invoice.
Show child attributes
Show child attributes
The xml representation of the invoice in EN16931 or x-Rechnung format.
Show child attributes
Show child attributes
The positions of the invoice.
Show child attributes
Show child attributes
The applicated exchange rates of the invoice, fetched from the european central bank.
Show child attributes
Show child attributes
The einvoice generated xml file format.
factorx,zugferd211 "zugferd211"
The leitwegid used for einvoice. This is only set, when the eInvoiceType is not null.
"1234567890123"
Custom fields for the entity. The keys are the field names and the values are the field values. They need to be configured under "/custom-fields" in the API documentation. The input is validated against the configuration. For more details see Custom Fields Guide
Show child attributes
Show child attributes
{ "field1": "value1", "field2": "value2" }
The earliest service date of all positions.
The latest service date of all positions.
Public url to view the detailed usage breakdown of this invoice.
The referenced cancellation document.
Show child attributes
Show child attributes
{
"number": "R2021-0001",
"id": "8d6b0f9e-5b9a-4e1a-9f0a-5e8e1a0b1b1e"
}
Dunning is disabled for this invoice.
The total amount of fees for each payment provider, which charges fees.
Show child attributes
Show child attributes
Where the invoice was created from.
Possible values:
cart: The invoice was created from a cart.subscription: The invoice was created from a subscription billing run.manual: The invoice was created by a user.
The referenced credit notes.
War diese Seite hilfreich?