Neofin V1
english
  • latest
  • english
  1. Upsert a billing
Neofin V1
english
  • latest
  • english
  • Start your Neofin journey
  • Setup your environment
  • NeofinV1
    • Billing API
      • Upsert a billing
        • How to upsert a billing
        • Upsert a billing
          POST
      • Retrieve a billing
        • How to retrieve a single billing
        • Get billing by Integration Identifier
          GET
        • Get billing by Billing Number
          GET
      • Mark a billing as paid
        • How to mark a billing as paid
        • Mark a billing as paid
          PUT
      • Cancel a billing
        • How to cancel a billing
        • Cancel a billing
          PUT
      • Listing billings
        • How to list your billings
        • Billing by status
          GET
        • Billing by customer
          GET
        • Billing updated date
          GET
        • Billing Events
          GET
        • Billing Events by Integration Identifier
          GET
      • Upload attachments
        • How to upload attachments
        • Upload a Billing NF by Integration Identifier
          PUT
        • Upload a Billing Boleto by Integration Identifier
          PUT
    • Customer API
      • Upserting a customer
        • How to upsert a customer
        • Upsert a customer
          POST
      • Retrieve a customer
        • Get a customer by Integration Identifier
          GET
        • Get a customer by their document
          GET
    • Webhooks
      • How to setup your webhooks
  1. Upsert a billing

How to upsert a billing

This endpoint will receive and queue up to 50 billings at a time.
There is no rate limit.
No billing/invoice data will be returned on this request. It only gets the data, validates a few parameters and retrieves the success of the queuing process. All the billing/invoice data will only be sent by webhook (if configured, Neofin will send one webhook for each payment installment created) or retrieved by Listing billings or Retrieving a billing. If the customer who will be charged is not registered with Neofin, their registration will be carried out using the data provided when creating the invoice.
Attention
The billing only will be upserted if you pass the same Integration Identifier. Avoid use values non-static values (like a timestamp) as your Integration Identifiers.

Billing attributes#

This endpoint receives the following parameters:
ParameterTypeDescriptionExample
address_cityString - Mandatory - Not EmptyContains your customer city address."São Paulo"
address_complementString - Mandatory - Not EmptyContains the complement for your customer address."Second Floor"
address_neighborhoodString - Mandatory - Not EmptyContains the neighborhood of your customer address."Brooklyn"
address_numberString - Mandatory - Not EmptyContains the number related to your customer address."356"
address_stateAddressStateEnum - Mandatory - Not EmptyContains the State abbreviation where your customer is located."SP"
address_streetString - Mandatory - Not EmptyThe street name of your customer address."Avenida Paulista"
address_zip_codeString - Mandatory - Not EmptyThe zip code of your customer address."01405-001"
amountNumber - Mandatory - Not EmptyThe total amount of the billing/invoice in BRL cents, without comma.10050
typeBillingTypeStrEnum - Mandatory - Not EmptyPayment method type."pix"
boleto_pdfString - Optional - Not EmptyDownloadable URL path for the PDF boleto file."https://yourdomain.com.br/path_to_file/boleto.pdf"
boleto_base64String - Optional - Not EmptyBase64 that generates a PDF boleto file.-
boletoBoleto - Optional - Not EmptyDetails for generating a PDF boleto when "type" is "generic".See field descriptions
by_mailBoolean - Mandatory - Not EmptyIndicates if the billing/invoice communication should be sent by email."true"
by_whatsappBoolean - Mandatory - Not EmptyIndicates if the billing/invoice communication should be sent by WhatsApp."false"
customer_documentString - Mandatory - Not EmptyCPF (11 digits) or CNPJ (14 digits)."75730786000100"
codeString - Optional - Not EmptyTypefull line code of the generated boleto when payment_method is "generic"."45454 45454656465 5454564656 61 46445456465465"
hashString - Optional - Not Empty"Pix Copia e Cola" line code of the generated pix when payment_method is "generic"."45454 45454656465 5454564656 61 46445456465465"
customer_mailString - Mandatory - Not EmptyThe main email address where your customer will receive billing/invoice communications."customer@gmail.com"
customer_nameString - Mandatory - Not EmptyYour customer name."Maria Quinteros"
customer_phoneString - Mandatory - Not EmptyCustomer phone number including country code."+5511987654321"
customer_secondary_phoneString - Optional - EmptySecondary phone number."+5511987654321"
discount_before_paymentNumber - Mandatory - Not EmptyPercentage discount if paid before the due date.5
discount_before_payment_due_dateNumber - Mandatory - Not EmptyDays before the due date when discount applies.5
due_dateNumber - Mandatory - Not EmptyDue date as Unix Timestamp.1678316400
feesNumber - Mandatory - Not EmptyMonthly fine percentage if unpaid.1
fineNumber - Mandatory - Not EmptyFine percentage for late payment.2
installment_typeInstallmentTypeStrEnum - Optional - Not EmptyType of installment for due date calculation."monthly"
installmentsNumber - Mandatory - Not EmptyNumber of installments.2
installments_dataList [InstallmentDataEnum] - Optional - Not EmptyObject containing installment details.See JSON example
integration_identifierString - Optional - Not EmptyCustom invoice identifier."Neofin-103923"
nfe_numberString - Optional - Not EmptyInvoice/receipt identifier."123123123"
recipientsList[String] - Optional - Not EmptyEmails to receive billing in CC.["email1@company.com", "email2@company.com"]
descriptionString - Optional - Not EmptyComment or description of a billing."Thanks for paying."

AddressStateEnum#

AC: Acre
AL: Alagoas
AP: Amapá
AM: Amazonas
BA: Bahia
CE: Ceará
DF: Distrito Federal
ES: Espírito Santo
GO: Goiás
MA: Maranhão
MT: Mato Grosso
MS: Mato Grosso do Sul
MG: Minas Gerais
PA: Pará
PB: Paraíba
PR: Paraná
PE: Pernambuco
PI: Piauí
RJ: Rio de Janeiro
RN: Rio Grande do Norte
RS: Rio Grande do Sul
RO: Rondônia
RR: Roraima
SC: Santa Catarina
SP: São Paulo
SE: Sergipe
TO: Tocantins

InstallmentTypeStrEnum#

"weekly"
"biweekly"
"monthly"
"custom"

BillingTypeStrEnum#

The payment method you want to charge your customer. If you provide the "generic" payment method, we will expect your boleto issued by your bank. If that's the case, please provide the "code" and "boleto_pdf" information.
"boleto"
"pix"
"bolepix"
"tedin"
"pixin"
"credit_card"
"generic"

InstallmentData#

Fields#

FieldTypeDescription
amountNumberInstallment amount in BRL cents.
due_dateNumberDue date as a Unix Timestamp.
installment_numberNumberInstallment number.

Boleto#

If the "type" is "generic" and you cannot or do not have the means to provide a link to download the boleto through "boleto_pdf", you can use this field to enter the boleto data you generated, and we will generate a PDF in the Neofin bill format.

Fields#

FieldTypeDescription
barcode_numberStringCode required to generate the barcode.
discount_valueNumberNominal value of discount before maturity.
discount_value_2NumberNominal value of rebates.
document_due_dateStringDue date in ISO 8601 standard.
document_issue_dateStringDate of last update of the document in ISO 8601 standard.
document_numberStringDocument number informed by the bank when generating the invoice.
document_processing_dateStringDocument creation date in ISO 8601 standard.
document_valueNumberInvoice amount in decimal.
drawee_nameStringBeneficiary's name.
drawee_tax_numberStringBeneficiary document (CPF or CNPJ).
fillable_codeStringTypeable invoice line.
fine_rateNumberFine in percentage.
interest_rateNumberInterest in percentage.
recipient_bank_codeStringCode of the bank where the bill was generated.
recipient_bank_digitStringBank code digit.
recipient_bank_internal_numberStringNumber generated by the bank when creating the invoice, usually identified as "nosso número".
branchStringBank branch number.
account_numberStringBeneficiary's bank account number.
account_number_digitStringDigit of the bank account number.
charging_categoryStringCategory of the charge for classification purposes.

Usage Example#

{
   "barcode_number": "123456789012",
   "discount_value": 50,
   "discount_value_2": 10,
   "document_due_date": "2025-04-01T12:00:00Z",
   "document_issue_date": "2025-03-28T12:00:00Z",
   "document_number": "4545454545",
   "document_processing_date": "2025-03-28T12:00:00Z",
   "document_value": 150.75,
   "drawee_name": "Maria Quinteros",
   "drawee_tax_number": "75730786000100",
   "fillable_code": "1234567890",
   "fine_rate": 2,
   "interest_rate": 1,
   "recipient_bank_code": "033",
   "recipient_bank_digit": "6",
   "recipient_bank_internal_number": "12345678",
   "branch": "1234",
   "account_number": "567890",
   "account_number_digit": "1",
   "charging_category": "standard"
}

Use cases#

Automatic Installments#

If you want Neofin to automatically calculate your installments, you must send the parameters:
installments and installment_type and do not send the parameter installments_data.
Example: Today is 01/01/2024 and you want to charge R$1000,00 from a customer who is going to pay in 10 installments of R$100,00. The first due date you want to receive is 01/02/2024.
You must fill:
Neofin will create 10 payment billings of R$100,00, the first one with due date 01/02/2024, the second with due_date 01/03/2024, etc, and the last one with due_date 01/11/2023.

Custom Installments#

If you want custom installments, you must send the parameters installments,installment_type and installments_data
Example: Today is 01/01/2024 and you want to charge R$1000,00 from a customer who is going to pay in 3 installments, 1) R$100,00 with due date 01/02/2024, 2) R$200,00 with due date 10/02/2024 and 3) R$700,00 with due date 20/02/2024. The first due date you want to receive is 01/02/2024.
You must fill:
Neofin will create 3 payment billings with your installments definitions.

Payments Methods#

Boleto
Or billet, this payment method is very common in Brazil and heavily used in payments between companies (B2B). It has a barcode to be read by the payer bank mobile app or ATMs and takes 2 to 3 days for the money to be transferred between bank accounts. You should send the string 'boleto'.
Pix
Instant Payment Method created by Brazilian Central Bank. It has a QRCode read by the payer bank mobile app and the money is transferred real time between bank accounts. You should send the string pix.
Bolepix
A mix between Boleto and Pix. Both payment methods are available (BarCode and QRcode) and the payer can choose which one to use. You should send the string bolepix.
Ted In
Bank Account Transfer. The money is transferred in real time. You should send the string 'tedin'.
Pix In
Bank Account Transfer but using the Pix Key instead the Bank Account Data. The Pix Key can be a phone number, an email address, a document (CPF or CNPJ) or a random uuid. The money is transferred in real time. You should send the string 'pixin'.
Credit Card
The payer can use the credit card to pay the billing/invoice. Used in recorrence. You should send the string 'credit_card'.
Generic
Used when the charge is generated outside the Neofin platform and integrated into it for the use of the charge rule and/or negativity and protest. You should send the string 'generic'.

cURL request example#

Return example:

{
    "message": "Billings successfully queued.",
    "errors": {}
}
When upserting be aware of the editable fields:

Editable fields#

address_city
address_complement
address_neighborhood
address_number
address_state
address_street
address_zip_code
amount*
boleto: Only when the type is generic.
by_mail
by_whatsapp
customer_mail
customer_name
customer_trade_name
customer_phone
customer_secondary_phone
discount_before_payment
discount_before_payment_due_date
due_date*
fees
fine
installment_type
installments
installments_data
integration_identifier
nfe_number
recipients
type*
Previous
Setup your environment
Next
Upsert a billing
Built with