Customer Credit invoice is a document automatically generated by VTEX after the customer makes a purchase using Customer Credit as a payment method and the order is billed.
In cases of installment purchases, invoices are generated according to the number of installments. For example, a purchase made with payment in 10 installments on Customer Credit will generate 10 invoices related to the same order number.
The Order invoice and the Customer Credit invoice are different documents. The Order invoice is issued for all purchases made in a store, regardless of the payment method selected. The Customer Credit invoice is additionally issued only for purchases made using the Customer Credit payment method. Learn more about invoiced orders in How to invoice an order.
This guide describes how to manage Customer Credit invoices in your store by performing the following actions through the endpoints of the Customer Credit API:
-
Check information:
For more information about Customer Credit functionalities, access Customer Credit - Overview and Customer Credit - Getting Started.
Checking Customer Credit invoice details
When you want to check details about a specific Customer Credit invoice, you can use the Retrieve invoice by ID endpoint. In this request, you must send the Customer Credit account and invoice identification (creditAccountId
and invoiceId
) as path parameters.
See an example below using the account 11111111111_CPF
and invoice 7583E36F101C461094AB6CA68FA8EE2C-01
.
GET - Retrieve invoice by ID
https://{accountName}.{environment}.com.br/api/creditcontrol/accounts/11111111111_CPF/invoices/7583E36F101C461094AB6CA68FA8EE2C-01
Response body example
_17{_17 "id": "7583E36F101C461094AB6CA68FA8EE2C-01",_17 "friendlyId": "IBjuAsrJ-1",_17 "status": "Opened",_17 "value": 9.63,_17 "accountId": "11111111111_CPF",_17 "creditValue": 0.0,_17 "createdAt": "2024-03-03T06:52:53.1314379Z",_17 "updatedAt": "2024-04-05T06:52:56.2329924Z",_17 "originalDueDate": "2024-04-02T06:52:53.1314379Z",_17 "dueDate": "2024-04-02T06:52:53.1314379Z",_17 "installment": 1,_17 "orderId": "1413870513134-01",_17 "transactionId": "7583E36F101C461094AB6CA68FA8EE2C",_17 "numberOfInstallments": 1,_17 "creditAccountId": "11111111111_CPF"_17}
You can also check some details of a Customer Credit invoice details using the VTEX Admin. To do that, go to Apps > Customer Credit > Invoices, and click on the desired invoice.
Checking invoice details on a Customer Credit account
To check details of all invoices issued on a Customer Credit account, you can use the Retrieve invoices by Customer Credit account ID endpoint. In this request, you must send the account identification (creditAccountId
) as a path parameter.
See an example below using the account 111111111_CPF
:
GET - Retrieve invoices by Customer Credit account ID
https://{accountName}.{environment}.com.br/api/creditcontrol/accounts/11111111111_CPF/invoices/
Response body example
_45{_45 "data": [_45 {_45 "id": "ED01C38CD4C949C2BCDFDB2C461C80F1-01",_45 "friendlyId": "MWKd4GUB-1",_45 "status": "Paid",_45 "value": 8.01,_45 "accountId": "11111111111_CPF",_45 "creditValue": 0.0,_45 "createdAt": "2024-02-26T14:39:54.6205024Z",_45 "resolvedAt": "2024-02-26T14:47:15.8495716Z",_45 "updatedAt": "2024-02-26T14:47:15.8964469Z",_45 "originalDueDate": "2024-03-27T14:39:54.6205024Z",_45 "dueDate": "2024-03-27T14:39:54.6205024Z",_45 "installment": 1,_45 "orderId": "1413590513132-01",_45 "transactionId": "ED01C38CD4C949C2BCDFDB2C461C80F1",_45 "numberOfInstallments": 1,_45 "creditAccountId": "11111111111_CPF"_45 },_45 {_45 "id": "7583E36F101C461094AB6CA68FA8EE2C-01",_45 "friendlyId": "IBjuAsrJ-1",_45 "status": "Opened",_45 "value": 9.63,_45 "accountId": "11111111111_CPF",_45 "creditValue": 0.0,_45 "createdAt": "2024-03-03T06:52:53.1314379Z",_45 "updatedAt": "2024-04-05T06:52:56.2329924Z",_45 "originalDueDate": "2024-04-02T06:52:53.1314379Z",_45 "dueDate": "2024-04-02T06:52:53.1314379Z",_45 "installment": 1,_45 "orderId": "1413870513134-01",_45 "transactionId": "7583E36F101C461094AB6CA68FA8EE2C",_45 "numberOfInstallments": 1,_45 "creditAccountId": "11111111111_CPF"_45 }_45 ],_45 "summary": {_45 "total": 9.63,_45 "count": 2,_45 "totalPaid": 8.01,_45 "totalCancelled": 0.0_45 }_45}
You can also use VTEX Admin to check the list of all invoices issued to a Customer Credit account. To do that, go to Apps > Customer Credit > Accounts, and click on the desired invoice.
Checking details of all Customer Credit invoices in a VTEX store
To list all invoices created in Customer Credit accounts of a VTEX store, you can use the Search all invoices endpoint.
GET - Search all invoices
https://{accountName}.{environment}.com.br/api/creditcontrol/invoices/
Response body example
_57{_57 "data": [_57 {_57 "id": "8C7A5F6F57AE4464B3D1F15A0E47C536-01",_57 "status": "Opened",_57 "value": 15.0,_57 "accountId": "09173503401_CPF",_57 "creditValue": 0.0,_57 "createdAt": "2018-10-24T15:34:14.5879054Z",_57 "updatedAt": "2018-10-24T15:34:14.6503743Z",_57 "originalDueDate": "2018-11-23T15:34:14.5879054Z",_57 "dueDate": "2018-11-23T15:34:14.5879054Z",_57 "installment": 1,_57 "orderId": "500001",_57 "transactionId": "8C7A5F6F57AE4464B3D1F15A0E47C536",_57 "creditAccountId": "09173503401_CPF"_57 },_57 {_57 "id": "8C7A5F6F57AE4464B3D1F15A0E47C536-01",_57 "status": "Paid",_57 "value": 15.0,_57 "accountId": "09173503401_CPF",_57 "creditValue": 0.0,_57 "createdAt": "2018-10-24T15:34:14.5879054Z",_57 "resolvedAt": "2021-03-05T15:01:23.0768211Z",_57 "updatedAt": "2021-03-05T15:01:23.1236966Z",_57 "originalDueDate": "2018-11-23T15:34:14.5879054Z",_57 "dueDate": "2018-11-23T15:34:14.5879054Z",_57 "installment": 1,_57 "orderId": "500001",_57 "transactionId": "8C7A5F6F57AE4464B3D1F15A0E47C536",_57 "creditAccountId": "09173503401_CPF"_57 },_57 {_57 "id": "A69BD96CDA1F402B939913B81C6346B2-01",_57 "status": "Opened",_57 "value": 35.0,_57 "accountId": "09173503401_CPF",_57 "creditValue": 0.0,_57 "createdAt": "2018-10-25T01:01:07.3570738Z",_57 "updatedAt": "2018-10-25T01:01:07.5133444Z",_57 "originalDueDate": "2018-11-24T01:01:07.3570738Z",_57 "dueDate": "2018-11-24T01:01:07.3570738Z",_57 "installment": 1,_57 "orderId": "500004",_57 "transactionId": "A69BD96CDA1F402B939913B81C6346B2",_57 "creditAccountId": "09173503401_CPF"_57 }_57………_57 ],_57 "summary": {_57 "total": 2388.95,_57 "count": 121,_57 "totalPaid": 1379.11,_57 "totalCancelled": 1.24_57 }_57}
Updating invoice details on a Customer Credit account
Through the Change invoice endpoint, you can update an invoice status, create an observation note, or add a link to assist your customer in the payment process.
See the example below, modifying the status, creating a observation note and adding the payment link to the invoice 7583E36F101C461094AB6CA68FA8EE2C-01
of account 111111111_CPF
:
PUT - Change invoice
https://{accountName}.{environment}.com.br/api/creditcontrol/accounts/11111111111_CPF/invoices/7583E36F101C461094AB6CA68FA8EE2C-01
Request body example
_10{_10 "status": "Paid",_10 "observation": "BF 2024 customer invoice.",_10 "paymentLink": "https://paymentlink.com"_10}
The success of this call is confirmed by the 200 OK status and the empty response body.
To confirm the information was updated, use the Retrieve invoice by ID endpoint.
Response body example
_20{_20 "id": "7583E36F101C461094AB6CA68FA8EE2C-01",_20 "friendlyId": "IBjuAsrJ-1",_20 "status": "Paid",_20 "value": 9.63,_20 "accountId": "11111111111_CPF",_20 "creditValue": 0.0,_20 "createdAt": "2024-03-03T06:52:53.1314379Z",_20 "resolvedAt": "2024-05-08T18:43:14.7046593Z",_20 "updatedAt": "2024-05-08T18:43:14.8765325Z",_20 "paymentLink": "https://www.paymentlink.com",_20 "originalDueDate": "2024-04-02T06:52:53.1314379Z",_20 "dueDate": "2024-04-02T06:52:53.1314379Z",_20 "installment": 1,_20 "orderId": "1413870513134-01",_20 "observation": "BF 2024 customer invoice.",_20 "transactionId": "7583E36F101C461094AB6CA68FA8EE2C",_20 "numberOfInstallments": 1,_20 "creditAccountId": "11111111111_CPF"_20}
You can also access your store Admin (Apps > Customer Credit > Account Details), select the desired account and invoice to confirm that the information was updated.
Postponing the due date of a Customer Credit invoice
To change the original due date of an invoice in Customer Credit, allowing the customer more time to complete the payment, you can use the endpoint Postpone an invoice.
However, before defining how many additional days of payment you will provide to the customer, you need to enable the option to postpone payment in your store's settings. To do this, you must use the endpoint Create or change store configuration.
The following parameters of this endpoint are responsible for enabling the option to postpone payment of invoices in the store:
invoicePostponementLimit
: The maximum number of times allowed to extend an invoice.maxPostponementDays
: The maximum number of days an invoice can be extended.postponementEnabled
: Allow extension of invoices in the store.
The settings available in the Create or change store configuration endpoint apply to all Customer Credit accounts registered in a VTEX store. It is not possible to customize these settings for each specific Customer Credit account of a given store.
See the example below, where a store is configured to allow invoice expiration dates to be extended up to 3 times and for a maximum period of 30 days in total.
PUT - Create or change store configuration
https://{accountName}.{environment}.com.br/api/creditcontrol/storeconfig
Request body example
_10{_10 "invoicePostponementLimit": 3,_10 "maxPostponementDays": 30,_10 "postponementEnabled": true_10}
The response to this request provides updated information about postponing invoices and other settings already applied in the store.
Response body example
_26{_26 "dailyInterestRate": 0.01,_26 "invoicePostponementLimit": 3,_26 "taxRate": 0.4,_26 "maxPostponementDays": 30,_26 "defaultCreditValue": 150,_26 "maxPreAuthorizationGrowthRate": 0.1,_26 "myCreditsEnabled": true,_26 "toleranceEnabled": true,_26 "automaticCheckingAccountCreationEnabled": true,_26 "postponementEnabled": true,_26 "notificationsSettings": {_26 "daysPrior": [_26 {_26 "days": 1,_26 "timeOfDay": "16:00:00"_26 }_26 ],_26 "daysAfter": [_26 {_26 "days": 0,_26 "timeOfDay": "12:00:00"_26 }_26 ]_26 }_26}
For more information about other configuration fields available for Customer Credit in a store, access the Create or change store configuration endpoint reference.
Once invoice postponement is enabled, you can postpone a specific invoice. See the example below in which 5 additional days will be granted to pay an invoice with an original due date of May 20, 2024.
PUT - Postpone an invoice
https://{accountName}.{environment}.com.br/api/creditcontrol/accounts/11111111111_CPF/invoices/7583E36F101C461094AB6CA68FA8EE2C-01/postponement
Request body example
_10{_10 "dueDays": 5_10}
The success of this call is confirmed by the 200 OK status and the empty response body.
To confirm that the new invoice due date has been modified, use the Retrieve invoice by ID endpoint and check the updated information in the dueDate
field.
GET - Retrieve invoice by ID
https://{accountName}.{environment}.com.br/api/creditcontrol/accounts/11111111111_CPF/invoices/7583E36F101C461094AB6CA68FA8EE2C-01
Response body example
_17{_17 "id": "7583E36F101C461094AB6CA68FA8EE2C-01",_17 "friendlyId": "IBjuAsrJ-1",_17 "status": "Opened",_17 "value": 9.63,_17 "accountId": "11111111111_CPF",_17 "creditValue": 0.0,_17 "createdAt": "2024-03-03T06:52:53.1314379Z",_17 "updatedAt": "2024-04-05T06:52:56.2329924Z",_17 "originalDueDate": "2024-05-20T06:52:53.1314379Z",_17 "dueDate": "2024-05-25T06:52:53.1314379Z",_17 "installment": 1,_17 "orderId": "1413870513134-01",_17 "transactionId": "7583E36F101C461094AB6CA68FA8EE2C",_17 "numberOfInstallments": 1,_17 "creditAccountId": "11111111111_CPF"_17}
You can also verify the new invoice due date through your store Admin (Apps > Customer Credit > Account Details).
Confirming payment of a Customer Credit invoice
To confirm payment of a Customer Credit invoice, you can use the Mark an invoice as paid endpoint.
See example of payment of invoice 7583E36F101C461094AB6CA68FA8EE2C-01
in account 111111111_CPF
:
POST - Mark an invoice as paid
https://{accountName}.{environment}.com.br/api/creditcontrol/accounts/11111111111_CPF/invoices/7583E36F101C461094AB6CA68FA8EE2C-01/payments
Response body example
_20{_20 "id": "7583E36F101C461094AB6CA68FA8EE2C-01",_20 "friendlyId": "IBjuAsrJ-1",_20 "status": "Paid",_20 "value": 9.63,_20 "accountId": "11111111111_CPF",_20 "creditValue": 0.0,_20 "createdAt": "2024-03-03T06:52:53.1314379Z",_20 "resolvedAt": "2024-05-08T18:43:14.7046593Z",_20 "updatedAt": "2024-05-08T18:43:14.8765325Z",_20 "paymentLink": "https://www.paymentlink.com",_20 "originalDueDate": "2024-04-02T06:52:53.1314379Z",_20 "dueDate": "2024-04-02T06:52:53.1314379Z",_20 "installment": 1,_20 "orderId": "1413870513134-01",_20 "observation": "BF 2024 customer invoice.",_20 "transactionId": "7583E36F101C461094AB6CA68FA8EE2C",_20 "numberOfInstallments": 1,_20 "creditAccountId": "11111111111_CPF"_20}
You can also confirm the invoice payment through your store Admin (Apps > Customer Credit > Account Details).
Cancelling a Customer Credit invoice
If you wish to cancel a Customer Credit invoice that has been issued but no longer needs to be paid, for example when an order is cancelled, you can use the Cancel invoice endpoint.
An invoice that already has a paid status can no longer be canceled.
See an example of canceling the invoice 7583E36F101C461094AB6CA68FA8EE2C-01
on account 111111111_CPF
:
DEL - Cancel invoice
https://{accountName}.{environment}.com.br/api/creditcontrol/accounts/11111111111_CPF/invoices/7583E36F101C461094AB6CA68FA8EE2C-01
The success of this call is confirmed by the 200 OK status and the empty response body.
To confirm the invoice was canceled, use the Retrieve invoice by ID endpoint.
Response body example
_20{_20 "id": "7583E36F101C461094AB6CA68FA8EE2C-01",_20 "friendlyId": "IBjuAsrJ-1",_20 "status": "Cancelled",_20 "value": 9.63,_20 "accountId": "11111111111_CPF",_20 "creditValue": 0.0,_20 "createdAt": "2024-03-03T06:52:53.1314379Z",_20 "resolvedAt": "2024-05-08T18:43:14.7046593Z",_20 "updatedAt": "2024-05-08T18:43:14.8765325Z",_20 "paymentLink": "https://www.paymentlink.com",_20 "originalDueDate": "2024-04-02T06:52:53.1314379Z",_20 "dueDate": "2024-04-02T06:52:53.1314379Z",_20 "installment": 1,_20 "orderId": "1413870513134-01",_20 "observation": "BF 2024 customer invoice.",_20 "transactionId": "7583E36F101C461094AB6CA68FA8EE2C",_20 "numberOfInstallments": 1,_20 "creditAccountId": "11111111111_CPF"_20}
You can also confirm the invoice cancellation through your store Admin (Apps > Customer Credit > Account Details).