Overview

Setup

Invoice

Invoice Overview

The Invoice Object

Creating Invoices

Creating Invoice with due, fine, interest, expiration parameters

Creating Invoice with discounts, description, tags parameters

Creating Invoice with rules parameter

Consulting Invoices

Updating Invoices

Canceling an Invoice

Reversing Partially an Invoice

Reversing Fully an Invoice

Receiving Invoice Webhook

Pix Invoice

The Invoice resource facilitates receiving Pix payments from your clients.

Alongside specifying the invoice amount, you can customize the due date, expiration date, fines, interest, discounts, and descriptions, enabling a comprehensive billing model.

You can also reverse paid invoices partially or fully.

NOTE: Read Core Concepts before continuing this guide.

RESOURCE SUMMARY
Generate a customized Invoice to receive Pix payments.

Setup

For each environment: (Sandbox or Production)

1. Create an account at Stark Bank.

2. Create a webhook with the following subscriptions to receive events in your desired URL:

invoice

2.1. Via Internet Banking:

Integrations > Webhook > New Webhook

2.2. Via API:

Use the POST /webhook route to create the webhook

Invoice Overview

Invoice is a resource that can be used to receive Pix payments from your clients.

In addition to choosing the Invoice amount, you will be able to include due date, expiration date, fine, interest, discount, and description for a comprehensive billing model.

Invoice Overview

In this section, we will demonstrate how to create an Invoice via API to initiate charges for your customers. To create an Invoice request, it is necessary to provide mandatory information.

NOTE: To ensure that the payer's taxId matches the final user's registration in your system, there are two options.

You can reverse the Invoice if the taxIds do not match, or use the rules parameter in the creation of the Invoice to restrict who can pay this invoice.

The Invoice Status

Each Invoice has a status that can change over time according to its life cycle:

invoice-status

StatusDescription
CreatedThe Invoice was successfully created in Stark Bank.
PaidThe Invoice was paid by the payer.
CanceledThe Invoice was canceled by you or by the system.
OverdueThe Invoice has passed the due date and is now subject to fine and interest.
ExpiredThe Invoice has passed the expiration date and can no longer be paid.

The Invoice Logs

Every time either you or Stark Bank makes a change to an Invoice, we create a Log. Logs are pretty useful for understanding the life cycle of each Invoice and the changes that happened to it. Here you can see the flow of possible logs:

invoice-log

A paid Invoice can be either partially or fully reversed back to its payer. Multiple reversals can be made for the same invoice and each time, the following flow of logs will occur:

invoice-log-reversal

Log typeStatusDescription
CreatedCreatedThe Invoice was successfully created in Stark Bank.
PaidPaidThe Invoice was paid by the payer.
CreditedPaidThe Invoice payment was credited to your account.
CanceledCanceledThe Invoice was canceled.
OverdueOverdueThe Invoice has passed the due date.
VoidedCanceledThe Invoice was voided.
ReversedPaidThe Invoice payment was partially or fully reversed to the payer.
UpdatedPaidThe Invoice was updated after payment (e.g., amount reduction).
ExpiredExpiredThe Invoice has passed the expiration date and can no longer be paid.

The Invoice Object

Attributes

id STRING

Unique id for the invoice.

amount INTEGER

Amount in cents that was received. Example: 100 (R$1.00).

brcode STRING

BR Code for the invoice Pix payment.

created STRING

Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00".

descriptions LIST OF OBJECTS

List of description objects with key and value.

discountAmount INTEGER

Discount amount in cents.

discounts LIST OF OBJECTS

List of discount objects with percentage and due.

due STRING

Payment due datetime. Example: "2020-04-23T23:00:00.000000+00:00".

expiration INTEGER

Time in seconds from due datetime until expiration.

fee INTEGER

Fee charged in cents.

fine FLOAT

Percentage charged if paid after due datetime.

fineAmount INTEGER

Fine amount in cents.

interest FLOAT

Monthly percentage charged if paid after due datetime.

interestAmount INTEGER

Interest amount in cents.

link STRING

Public URL to the invoice page.

name STRING

Payer full name.

nominalAmount INTEGER

Invoice amount in cents without fine or interest.

pdf STRING

Public URL to the invoice PDF.

rules LIST OF OBJECTS

List of rule objects with key and value.

splits LIST OF OBJECTS

List of Split objects with receiverId and amount.

status STRING

Current invoice status. Options: "created", "paid", "canceled", "overdue", "expired".

tags LIST OF STRINGS

Tags associated with the invoice.

taxId STRING

Payer CPF or CNPJ.

transactionIds LIST OF STRINGS

Ledger transaction IDs linked to the invoice.

updated STRING

Last update datetime. Example: "2020-04-23T23:00:00.000000+00:00".

Creating Invoices

In order to create the Invoice, certain mandatory parameters are required for the request to be made, such as amount, taxId, and name.

In addition to these mandatory points, there are optional fields to enhance your invoice, such as due, fine, interest, expiration, discounts, descriptions, tags, and rules. For more details, you can refer to the documentation in the Invoice section.

Python

import starkbank
from datetime import datetime

invoices = starkbank.invoice.create([
    starkbank.Invoice(
        amount=400000,
        name="Arya Stark",
        tax_id="012.345.678-90",
    )
])

for invoice in invoices:
    print(invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoices = await starkbank.invoice.create([{
        amount: 400000,
        taxId: '012.345.678-90',
        name: 'Arya Stark'
    }]);

    for (let invoice of invoices) {
        console.log(invoice);
    }
})();
  

PHP

use StarkBank\Invoice;

$invoices = [
    new Invoice([
        "amount" => 400000,
        "taxId" => "012.345.678-90",
        "name" => "Arya Stark"
    ])
];

$invoice = Invoice::create($invoices);

print_r($invoice);
  

Java

import com.starkbank.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

List<Invoice> invoices = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("amount", 400000);
data.put("taxId", "012.345.678-90");
data.put("name", "Arya Stark");

invoices.add(new Invoice(data));
invoices = Invoice.create(invoices);

for (Invoice invoice : invoices) {
    System.out.println(invoice);
}
  

Ruby

require('starkbank')

invoices = StarkBank::Invoice.create(
    [
        StarkBank::Invoice.new(
            amount: 400000,
            name: 'Arya Stark',
            tax_id: '012.345.678-90'
        )
    ]
)

invoices.each do |invoice|
    puts invoice
end
  

Elixir

invoice = StarkBank.Invoice.create!(
    [
        %StarkBank.Invoice{
            amount: 400000,
            tax_id: "012.345.678-90",
            name: "Arya Stark"
        }
    ]
) |> IO.inspect()
  

C#

using System;
using System.Collections.Generic;

List<StarkBank.Invoice> invoices = StarkBank.Invoice.Create(
    new List<StarkBank.Invoice> {
        new StarkBank.Invoice(
            amount: 400000,
            name: "Arya Stark",
            taxID: "012.345.678-90"
        )
    }
);

foreach (StarkBank.Invoice invoice in invoices)
{
    Console.WriteLine(invoice);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
    "time"
)

func main() {

    invoices, err := invoice.Create(
        []invoice.Invoice{
            {
                Amount:       400000,
                Name:         "Arya Stark",
                TaxId:        "012.345.678-90"
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    for _, invoice := range invoices {
        fmt.Printf("%+v", invoice)
    }
}
  

Clojure

(def invoices (starkbank.invoice/create
[{
    :amount 400000,
    :tax-id "012.345.678-90",
    :name "Arya Stark"
}]))

(doseq [invoice invoices]
    (println invoice)
)
  

Curl

curl --location --request POST '{{baseUrl}}/v2/invoice' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "invoices": [
        {
            "amount": 400000,
            "name": "Arya Stark",
            "taxId": "012.345.678-90"
        }
    ]
}'
  
RESPONSE

Python

Invoice(
    amount=400000,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[],
    discount_amount=0,
    discounts=[],
    due=2021-05-12 15:23:26,
    expiration=5097600,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.0,
    fine_amount=0,
    id=4600131349381120,
    interest=1.3,
    interest_amount=1.0,
    name=Arya Stark,
    nominal_amount=400000,
    status=created,
    tags=[],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
  id: '4600131349381120',
  amount: 400000,
  due: '2021-05-12T16:27:37.585000+00:00',
  taxId: '012.345.678-90',
  name: 'Arya Stark',
  expiration: 5097600,
  fine: 2.0,
  interest: 1.0,
  discounts: [ ],
  tags: [ ],
  transactionIds: [  ],
  descriptions: [ ],
  fee: 0,
  pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
  link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
  nominalAmount: 400000,
  fineAmount: 0,
  interestAmount: 0,
  discountAmount: 0,
  brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
  status: 'created',
  created: '2020-10-26T17:10:57.606357+00:00',
  updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 400000
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 5097600
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.0
    [interest] => 1.0
    [discounts] => Array
        (
        )

    [tags] => Array
        (
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => created
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

Invoice({
    "amount": 400000,
    "due": "2021-05-12T15:23:26.000000+00:00",
    "taxId": "012.345.678-90",
    "name": "Arya Stark",
    "expiration": 5097600,
    "fee": 0,
    "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    "fine": 2.0,
    "interest": 1.0,
    "descriptions": []
    "discounts": [],
    "tags": [],
    "transactionIds": [],
    "nominalAmount": 400000,
    "fineAmount": 0,
    "interestAmount": 0,
    "discountAmount": 0,
    "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    "status": "created",
    "created": "2020-10-26T17:32:00.997116+00:00",
    "updated": "2020-10-26T17:32:00.997126+00:00",
    "id": "4600131349381120"
})
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 400000,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 5097600,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.0,
    interest: 1.0,
    discounts: [],
    tags: [],
    transaction_ids: [],
    descriptions: [],
    nominal_amount: 23571,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: created,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 400000,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [],
    discount_amount: 0,
    discounts: [],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 5097600,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.0,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.0,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "created",
    tags: [],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 5097600,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,0,
    Interest: 1,0,
    Descriptions: { },
    Discounts: { },
    Tags: { },
    TransactionIds: {  },
    Amount: 400000,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: created,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
    )
  

Go

{
    Id:4600131349381120 
    Amount:400000 
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000 
    Expiration:123456789 
    Fine:2.0 
    Interest:1.0 
    Discounts:[]
    Tags:[] 
    Descriptions:[]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978 
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978 
    NominalAmount:400000 
    FineAmount:0 
    InterestAmount:0 
    DiscountAmount:0 
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79 
    Status:created 
    Fee:0 
    TransactionIds:[] 
    Created:2020-10-26 17:10:54.16799 +0000 +0000 
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 400000, 
    :interest-amount 0, 
    :fee 0, 
    :tags [war supply invoice #1234], 
    :transaction-ids [], 
    :updated 2020-10-26T06:09:07.540753+00:00, 
    :name Iron Bank S.A., 
    :expiration 5097600, 
    :tax-id 012.345.678-90, 
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978, 
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978, 
    :nominal-amount 400000, 
    :created 2020-10-26T06:09:07.540724+00:00, 
    :discounts [
        {
            :percentage 5.0, 
            :due 2021-03-12T22:32:35.418698+00:00
        } 
    ], 
    :due 2021-05-12T19:32:35.418698+00:00,
    :status created,
    :interest 1.3, 
    :id 4600131349381120,
    :fine 2.5,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions [
        {
            :key Product X,
            :value big
        }
    ]
}
  

Curl

{
    "message": "Invoice(s) successfully created",
    "invoices": [
        {
            "id": "4600131349381120",
            "status": "created",
            "amount": 400000,
            "nominalAmount": 400000,
            "fineAmount": 0,
            "interestAmount": 0,
            "discountAmount": 0,
            "expiration": 5097600,
            "discounts": [],
            "descriptions": [],
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "fee": 0,
            "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
            "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
            "fine": 2.0,
            "interest": 1.0,
            "tags": [],
            "transactionIds": [],
            "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
            "created": "2020-10-26T01:50:50.264656+00:00",
            "updated": "2020-10-26T01:50:50.264656+00:00",
            "due": "2020-05-12T17:59:26.000000+00:00"
        }
    ]
}
  

Creating Invoice with due, fine, interest, expiration parameters

Due: By adding this parameter, you can set the due date of the requested payment in ISO format.

Example: "2020-11-25T17:59:26.000000+00:00." Default value: 2 days after creation.

Fine: By adding this parameter, you can add a fine to the invoiced amount if the customer pays after the due date and time.

Interest: By adding this parameter, you can add monthly interest, in percentage, charged if the customer pays after the due date.

Expiration: By adding this parameter, you can add time in seconds counted from the due date until the invoice expiration.

After expiration, the invoice can no longer be paid.

Default value: 5097600 (59 days).

Python

import starkbank
from datetime import datetime

invoices = starkbank.invoice.create([
    starkbank.Invoice(
        amount=400000,
        due=datetime(2021, 5, 12, 15, 23, 26, 689377),
        expiration=123456789,
        fine=2.5,
        interest=1.3,
        name="Arya Stark",
        tax_id="012.345.678-90"
    )
])

for invoice in invoices:
    print(invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoices = await starkbank.invoice.create([{
        amount: 400000,
        due: '2021-05-12T15:23:37.585+00:00',
        expiration: 123456789,
        taxId: '012.345.678-90',
        name: 'Arya Stark',
        fine: 2.5,
        interest: 1.3,
    }]);

    for (let invoice of invoices) {
        console.log(invoice);
    }
})();
  

PHP

use StarkBank\Invoice;

$invoices = [
    new Invoice([
        "amount" => 400000,
        "due" => "2021-05-12T18:00:00.000000+00:00",
        "expiration" => 123456789,
        "taxId" => "012.345.678-90",
        "name" => "Arya Stark",
        "fine" => 2.5,
        "interest" => 1.3
    ])
];

$invoice = Invoice::create($invoices);

print_r($invoice);
  

Java

import com.starkbank.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

List<HashMap<String, Object>> descriptions = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("key", "Arya");
data.put("value", "Not today");
descriptions.add(data);

List<HashMap<String, Object>> rules = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("key", "allowedTaxIds");
data.put("value", new String[]{"012.345.678-90", "45.059.493/0001-73"});
rules.add(data);

List<HashMap<String, Object>> discounts = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("percentage", 10);
data.put("due", "2021-03-12T17:59:26.000000+00:00");
discounts.add(data);

List<Invoice> invoices = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("amount", 400000);
data.put("due", "2021-05-12T17:59:26.000000+00:00");
data.put("expiration", 123456789);
data.put("taxId", "012.345.678-90");
data.put("name", "Arya Stark");
data.put("fine", 2.5);
data.put("interest", 1.3);

invoices.add(new Invoice(data));
invoices = Invoice.create(invoices);

for (Invoice invoice : invoices) {
    System.out.println(invoice);
}
  

Ruby

require('starkbank')

invoices = StarkBank::Invoice.create(
    [
        StarkBank::Invoice.new(
            amount: 400000,
            due: Time.now + 24 * 3600,
            name: 'Arya Stark',
            tax_id: '012.345.678-90', 
            fine: 2.5,
            interest: 1.3,
            expiration: 123456789,
        )
    ]
)

invoices.each do |invoice|
    puts invoice
end
  

Elixir

invoice = StarkBank.Invoice.create!(
    [
        %StarkBank.Invoice{
            amount: 400000,
            due: String.replace(DateTime.to_iso8601(DateTime.add(DateTime.utc_now(), 30*24*60*60, :second)), "Z", "+00:00"),
            tax_id: "012.345.678-90",
            name: "Arya Stark",
            fine: 2.5,
            interest: 1.3,
            expiration: 123456789,
        }
    ]
) |> IO.inspect()
  

C#

using System;
using System.Collections.Generic;

List<StarkBank.Invoice> invoices = StarkBank.Invoice.Create(
    new List<StarkBank.Invoice> {
        new StarkBank.Invoice(
            amount: 400000,
            due: new DateTime(2021, 05, 12, 20, 30, 0),
            fine: 2.5,
            interest: 1.3,
            name: "Arya Stark",
            taxID: "012.345.678-90",
            expiration: 123456789,
        )
    }
);

foreach (StarkBank.Invoice invoice in invoices)
{
    Console.WriteLine(invoice);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
    "time"
)

func main() {

    due := time.Date(2021, 05, 12, 0, 0, 0, 0, time.UTC)

    invoices, err := invoice.Create(
        []invoice.Invoice{
            {
                Amount:       400000,
                Name:         "Arya Stark",
                TaxId:        "012.345.678-90",
                Due:          &due,
                Fine:         2.5,
                Interest:     1.3,
                Expiration:   123456789,
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    for _, invoice := range invoices {
        fmt.Printf("%+v", invoice)
    }
}
  

Clojure

(def invoices (starkbank.invoice/create
[{
    :amount 400000
    :due "2021-05-12T19:32:35.418698+00:00"
    :expiration 123456789,
    :tax-id "012.345.678-90"
    :name "Arya Stark",
    :fine 2.5,
    :interest 1.3,
}]))

(doseq [invoice invoices]
    (println invoice)
)
  

Curl

curl --location --request POST '{{baseUrl}}/v2/invoice' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "invoices": [
        {
            "amount": 400000,
            "due": "2021-05-12T17:59:26.000000+00:00",
            "expiration": 123456789,
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "fine": 2.5,
            "interest": 1.3,
            "discounts": [
                {
                    "percentage": 10,
                    "due": "2021-03-12T17:59:26.000000+00:00"
                }
            ]
        }
    ]
}'
  
RESPONSE

Python

Invoice(
    amount=400000,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[],
    discount_amount=0,
    discounts=[{'percentage': 10.0, 'due': '2021-03-12T18:23:26+00:00'}],
    due=2021-05-12 15:23:26,
    expiration=123456789,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.5,
    fine_amount=0,
    id=4600131349381120,
    interest=1.3,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=created,
    tags=[],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
  id: '4600131349381120',
  amount: 400000,
  due: '2021-05-12T16:27:37.585000+00:00',
  taxId: '012.345.678-90',
  name: 'Arya Stark',
  expiration: 123456789,
  fine: 2.5,
  interest: 1.3,
  discounts: [ { percentage: 10, due: '2021-03-12T14:16:10.639000+00:00' } ],
  tags: [],
  transactionIds: [  ],
  descriptions: [],
  fee: 0,
  pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
  link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
  nominalAmount: 400000,
  fineAmount: 0,
  interestAmount: 0,
  discountAmount: 0,
  brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
  status: 'created',
  created: '2020-10-26T17:10:57.606357+00:00',
  updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 400000
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 123456789
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.5
    [interest] => 1.3
    [discounts] => Array
        (
            [0] => Array
                (
                    [percentage] => 10
                    [due] => 2021-03-12T21:00:00+00:00
                )

        )

    [tags] => Array
        (
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => created
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

Invoice({
    "amount": 400000,
    "due": "2021-05-12T15:23:26.000000+00:00",
    "taxId": "012.345.678-90",
    "name": "Arya Stark",
    "expiration": 123456789,
    "fee": 0,
    "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    "fine": 2.5,
    "interest": 1.3,
    "descriptions": []
    "discounts": [],
    "tags": [],
    "transactionIds": [],
    "nominalAmount": 400000,
    "fineAmount": 0,
    "interestAmount": 0,
    "discountAmount": 0,
    "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    "status": "created",
    "created": "2020-10-26T17:32:00.997116+00:00",
    "updated": "2020-10-26T17:32:00.997126+00:00",
    "id": "4600131349381120"
})
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 400000,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 123456789,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.5,
    interest: 1.3,
    discounts: [
        (
            percentage: 5,
            due: 2021-03-12T14:00:21+00:00
        )
    ],
    tags: [],
    transaction_ids: [],
    descriptions: [],
    nominal_amount: 23571,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: created,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 400000,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [],
    discount_amount: 0,
    discounts: [
        %{"due" => "2020-11-23T21:36:18.223000+00:00", "percentage" => 10.0}
    ],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 123456789,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.5,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.3,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "created",
    tags: [],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 123456789,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,5,
    Interest: 1,3,
    Descriptions: {},
    Discounts: { { { percentage, 10 }, { due, 30/05/2021 23:30:00 } } },
    Tags: {},
    TransactionIds: {  },
    Amount: 400000,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: created,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
    )
  

Go

{
    Id:4600131349381120 
    Amount:400000 
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000 
    Expiration:123456789 
    Fine:2.5 
    Interest:1.3 
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[] 
    Descriptions:[]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978 
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978 
    NominalAmount:400000 
    FineAmount:0 
    InterestAmount:0 
    DiscountAmount:0 
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79 
    Status:created 
    Fee:0 
    TransactionIds:[] 
    Created:2020-10-26 17:10:54.16799 +0000 +0000 
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 400000, 
    :interest-amount 0, 
    :fee 0, 
    :tags [], 
    :transaction-ids [], 
    :updated 2020-10-26T06:09:07.540753+00:00, 
    :name Iron Bank S.A., 
    :expiration 123456789, 
    :tax-id 012.345.678-90, 
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978, 
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978, 
    :nominal-amount 400000, 
    :created 2020-10-26T06:09:07.540724+00:00, 
    :discounts [
        {
            :percentage 5.0, 
            :due 2021-03-12T22:32:35.418698+00:00
        } 
    ], 
    :due 2021-05-12T19:32:35.418698+00:00,
    :status created,
    :interest 1.3, 
    :id 4600131349381120,
    :fine 2.5,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions []
}
  

Curl

{
    "message": "Invoice(s) successfully created",
    "invoices": [
        {
            "id": "4600131349381120",
            "status": "created",
            "amount": 400000,
            "nominalAmount": 400000,
            "fineAmount": 0,
            "interestAmount": 0,
            "discountAmount": 0,
            "expiration": 123456789,
            "discounts": [
                {
                    "percentage": 5.0
                    "due": 2021-03-12T01:50:50.264656+00:00
                }
            ],
            "descriptions": [],
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "fee": 0,
            "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
            "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
            "fine": 2.5,
            "interest": 1.3,
            "tags": [],
            "transactionIds": [],
            "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
            "created": "2020-10-26T01:50:50.264656+00:00",
            "updated": "2020-10-26T01:50:50.264656+00:00",
            "due": "2020-05-12T17:59:26.000000+00:00"
        }
    ]
}
  

Creating Invoice with discounts, description, tags parameters

Discounts: With this parameter, you can set a list of up to 5 discounts specifying the discount percentage and the deadline until the discount is valid.

Tags: By adding this parameter, you can have an array of strings to mark the entity for future queries.

All tags will be converted to uppercase.

Descriptions: With this parameter, you will have a list of up to 15 descriptions containing information to help understand the reason for the charge.

For each description, you can add a title key and a description value.

Python

import starkbank
from datetime import datetime

invoices = starkbank.invoice.create([
    starkbank.Invoice(
        amount=400000,
        descriptions=[{'key': 'Arya', 'value': 'Not today'}],
        discounts=[{'percentage': 10, 'due': datetime(2021, 3, 12, 15, 23, 26, 689377)}],
        name="Arya Stark",
        tags=['War supply', 'Invoice #1234'],
        tax_id="012.345.678-90"
    )
])

for invoice in invoices:
    print(invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoices = await starkbank.invoice.create([{
        amount: 400000,
        taxId: '012.345.678-90',
        name: 'Arya Stark',
        discounts: [
            {
                'percentage': 10,
                'due': '2021-03-12T15:23:26.249976+00:00'
            }
        ],
        tags: ['War supply', 'Invoice #1234'],
        descriptions: [
            {
                'key': 'Arya',
                'value': 'Not today'
            }
        ]
    }]);

    for (let invoice of invoices) {
        console.log(invoice);
    }
})();
  

PHP

use StarkBank\Invoice;

$invoices = [
    new Invoice([
        "amount" => 400000,
        "taxId" => "012.345.678-90",
        "name" => "Arya Stark",
        "discounts" => [
            [
                "percentage" => 10,
                "due" => "2021-03-12T18:00:00.000000+00:00"
            ]
        ],
        "tags" => [
            'War supply',
            'Invoice #1234'
        ],
        "descriptions" => [
            [
                "key" => "Arya",
                "value" => "Not today"
            ]
        ]
    ])
];

$invoice = Invoice::create($invoices);

print_r($invoice);
  

Java

import com.starkbank.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

List<HashMap<String, Object>> descriptions = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("key", "Arya");
data.put("value", "Not today");
descriptions.add(data);

List<HashMap<String, Object>> discounts = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("percentage", 10);
data.put("due", "2021-03-12T17:59:26.000000+00:00");
discounts.add(data);

List<Invoice> invoices = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("amount", 400000);
data.put("taxId", "012.345.678-90");
data.put("name", "Arya Stark");
data.put("discounts", discounts);
data.put("descriptions", descriptions);
data.put("tags", new String[]{"War supply", "Invoice #1234"});

invoices.add(new Invoice(data));
invoices = Invoice.create(invoices);

for (Invoice invoice : invoices) {
    System.out.println(invoice);
}
  

Ruby

require('starkbank')

invoices = StarkBank::Invoice.create(
    [
        StarkBank::Invoice.new(
            amount: 400000,
            descriptions: 
                [
                    {
                        key: 'Arya', 
                        value: 'Not today'
                    }
                ],
            discounts: 
                [
                    {
                        percentage: 10, 
                        due: '2020-04-25'
                    }
                ],
            tags: ['War supply', 'Invoice #1234'],
            name: 'Arya Stark',
            tax_id: '012.345.678-90'
        )
    ]
)

invoices.each do |invoice|
    puts invoice
end
  

Elixir

invoice = StarkBank.Invoice.create!(
    [
        %StarkBank.Invoice{
            amount: 400000,
            tax_id: "012.345.678-90",
            name: "Arya Stark",
            discounts: [
                %{
                    percentage: 10,
                    due: String.replace(DateTime.to_iso8601(DateTime.add(DateTime.utc_now(), 10*24*60*60, :second)), "Z", "+00:00"),
                }
            ],
            tags: [
                "War Supply",
                "Invoice #1234"
            ],
            descriptions: [
                %{
                    key: "Arya",
                    value: "Not today"
                }
            ]
        }
    ]
) |> IO.inspect()
  

C#

using System;
using System.Collections.Generic;

List<StarkBank.Invoice> invoices = StarkBank.Invoice.Create(
    new List<StarkBank.Invoice> {
        new StarkBank.Invoice(
            amount: 400000,
            descriptions: new List<Dictionary<string, object>>() {
                new Dictionary<string, object> {
                    {"key", "Arya"},
                    {"value", "Not today"}
                }
            },
            discounts: new List<Dictionary<string, object>>() {
                new Dictionary<string, object> {
                    {"percentage", 10},
                    {"due", new DateTime(2021, 03, 12, 20, 30, 0)}
                }
            },
            name: "Arya Stark",
            tags: new List<string> { "New sword", "Invoice #1234" },
            taxID: "012.345.678-90"
        )
    }
);

foreach (StarkBank.Invoice invoice in invoices)
{
    Console.WriteLine(invoice);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
    "time"
)

func main() {

    due := time.Date(2021, 05, 12, 0, 0, 0, 0, time.UTC)

    descriptions := make([]map[string]interface{}, 1)
	var data = map[string]interface{}{}
	data["key"] = "Arya"
	data["value"] = "Not today"
	descriptions[0] = data

    discounts := make([]map[string]interface{}, 1)
	var dataDiscount = map[string]interface{}{}
	dataDiscount["percentage"] = 5
	discounts[0] = dataDiscount

    invoices, err := invoice.Create(
        []invoice.Invoice{
            {
                Amount:       400000,
                Name:         "Arya Stark",
                TaxId:        "012.345.678-90",
                Descriptions: descriptions,
                Discounts:    discounts,
                Tags:         []string{"War supply", "Invoice #1234"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    for _, invoice := range invoices {
        fmt.Printf("%+v", invoice)
    }
}
  

Clojure

(def invoices (starkbank.invoice/create
[{
    :amount 400000
    :tax-id "012.345.678-90"
    :name "Arya Stark",
    :discounts [
        {
            :percentage 5
            :due "2021-03-12T19:32:35.418698+00:00"
        }
    ]
    :descriptions [
        {
            :key "Arya"
            :value "Not Today"
        }
    ],
    :tags [
        "War supply",
        "Invoice #1234"
    ]
}]))

(doseq [invoice invoices]
    (println invoice)
)
  

Curl

curl --location --request POST '{{baseUrl}}/v2/invoice' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "invoices": [
        {
            "amount": 400000,
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "tags": [
                "War supply",
                "Invoice #1234"
            ]
            "descriptions": [
                {
                    "key": "Arya",
                    "value": "Not today"
                }
            ],
            "discounts": [
                {
                    "percentage": 10,
                    "due": "2021-03-12T17:59:26.000000+00:00"
                }
            ]
        }
    ]
}'
  
RESPONSE

Python

Invoice(
    amount=400000,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[{'key': 'Arya', 'value': 'Not today'}],
    discount_amount=0,
    discounts=[{'percentage': 10.0, 'due': '2021-03-12T18:23:26+00:00'}],
    due=2021-05-12 15:23:26,
    expiration=5097600,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.0,
    fine_amount=0,
    id=4600131349381120,
    interest=1.0,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=created,
    tags=['War supply', 'Invoice #1234'],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
  id: '4600131349381120',
  amount: 400000,
  due: '2021-05-12T16:27:37.585000+00:00',
  taxId: '012.345.678-90',
  name: 'Arya Stark',
  expiration: 5097600,
  fine: 2.0,
  interest: 1.0,
  discounts: [ { percentage: 10, due: '2021-03-12T14:16:10.639000+00:00' } ],
  tags: [ 'war supply', 'invoice #1234' ],
  transactionIds: [  ],
  descriptions: [ { key: 'Arya', value: 'Not today' } ],
  fee: 0,
  pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
  link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
  nominalAmount: 400000,
  fineAmount: 0,
  interestAmount: 0,
  discountAmount: 0,
  brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
  status: 'created',
  created: '2020-10-26T17:10:57.606357+00:00',
  updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 400000
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 5097600
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.0
    [interest] => 1.0
    [discounts] => Array
        (
            [0] => Array
                (
                    [percentage] => 10
                    [due] => 2021-03-12T21:00:00+00:00
                )

        )

    [tags] => Array
        (
            [0] => war supply
            [1] => invoice #1234
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
            [0] => Array
                (
                    [key] => Arya
                    [value] => Not today
                )

        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => created
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

Invoice({
    "amount": 400000,
    "due": "2021-05-12T15:23:26.000000+00:00",
    "taxId": "012.345.678-90",
    "name": "Arya Stark",
    "expiration": 5097600,
    "fee": 0,
    "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    "fine": 2.0,
    "interest": 1.0,
    "descriptions": [
        {
            "key": "Arya",
            "value": "Not today"
        }
    ]
    "discounts": [],
    "tags": ["war supply", "invoice #1234"],
    "transactionIds": [],
    "nominalAmount": 400000,
    "fineAmount": 0,
    "interestAmount": 0,
    "discountAmount": 0,
    "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    "status": "created",
    "created": "2020-10-26T17:32:00.997116+00:00",
    "updated": "2020-10-26T17:32:00.997126+00:00",
    "id": "4600131349381120"
})
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 400000,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 5097600,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.0,
    interest: 1.0,
    discounts: [
        (
            percentage: 5,
            due: 2021-03-12T14:00:21+00:00
        )
    ],
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    descriptions: [
        (
            key: Arya,
            value: Not today
        )
    ],
    nominal_amount: 23571,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: created,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 400000,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [
        %{"key" => "Arya", "value" => "Not today"}
    ],
    discount_amount: 0,
    discounts: [
        %{"due" => "2020-11-23T21:36:18.223000+00:00", "percentage" => 10.0}
    ],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 5097600,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.0,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.0,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "created",
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 5097600,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,0,
    Interest: 1,0,
    Descriptions: { { { key, Arya }, { value, Not today } } },
    Discounts: { { { percentage, 10 }, { due, 30/05/2021 23:30:00 } } },
    Tags: { war supply, invoice #1234 },
    TransactionIds: {  },
    Amount: 400000,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: created,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
    )
  

Go

{
    Id:4600131349381120 
    Amount:400000 
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000 
    Expiration:5097600 
    Fine:2.0
    Interest:1.0 
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[war supply invoice #1234] 
    Descriptions:[map[key:Arya value:Not today]]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978 
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978 
    NominalAmount:400000 
    FineAmount:0 
    InterestAmount:0 
    DiscountAmount:0 
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79 
    Status:created 
    Fee:0 
    TransactionIds:[] 
    Created:2020-10-26 17:10:54.16799 +0000 +0000 
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 400000, 
    :interest-amount 0, 
    :fee 0, 
    :tags [war supply invoice #1234], 
    :transaction-ids [], 
    :updated 2020-10-26T06:09:07.540753+00:00, 
    :name Iron Bank S.A., 
    :expiration 5097600, 
    :tax-id 012.345.678-90, 
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978, 
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978, 
    :nominal-amount 400000, 
    :created 2020-10-26T06:09:07.540724+00:00, 
    :discounts [
        {
            :percentage 5.0, 
            :due 2021-03-12T22:32:35.418698+00:00
        } 
    ], 
    :due 2021-05-12T19:32:35.418698+00:00,
    :status created,
    :interest 1.0, 
    :id 4600131349381120,
    :fine 2.0,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions [
        {
            :key Product X,
            :value big
        }
    ]
}
  

Curl

{
    "message": "Invoice(s) successfully created",
    "invoices": [
        {
            "id": "4600131349381120",
            "status": "created",
            "amount": 400000,
            "nominalAmount": 400000,
            "fineAmount": 0,
            "interestAmount": 0,
            "discountAmount": 0,
            "expiration": 5097600,
            "discounts": [
                {
                    "percentage": 5.0
                    "due": 2021-03-12T01:50:50.264656+00:00
                }
            ],
            "descriptions": [
                {
                    "key": "Arya"
                    "value": "Not today"
                }
            ],
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "fee": 0,
            "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
            "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
            "fine": 2.0,
            "interest": 1.0,
            "tags": [
                "War supply",
                "Invoice #1234"
            ],
            "transactionIds": [],
            "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
            "created": "2020-10-26T01:50:50.264656+00:00",
            "updated": "2020-10-26T01:50:50.264656+00:00",
            "due": "2020-05-12T17:59:26.000000+00:00"
        }
    ]
}
  

Creating Invoice with rules parameter

Rules: you can set a list of rules to modify the invoice's behavior.

It is possible to limit the tax IDs allowed to pay this invoice by setting this parameter using the key "allowedTaxIds".

Python

import starkbank
from datetime import datetime

invoices = starkbank.invoice.create([
    starkbank.Invoice(
        amount=400000,
        name="Arya Stark",
        tax_id="012.345.678-90",
        rules=[
            {
                'key': 'allowedTaxIds',
                'value': [
                    '012.345.678-90',
                    '45.059.493/0001-73'
                ]
            }
        ]
    )
])

for invoice in invoices:
    print(invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoices = await starkbank.invoice.create([{
        amount: 400000,
        taxId: '012.345.678-90',
        name: 'Arya Stark',
        rules: [
            {
                'key': 'allowedTaxIds',
                'value': [
                    '012.345.678-90',
                    '45.059.493/0001-73'
                ]
            }
        ]
    }]);

    for (let invoice of invoices) {
        console.log(invoice);
    }
})();
  

PHP

use StarkBank\Invoice;

$invoices = [
    new Invoice([
        "amount" => 400000,
        "taxId" => "012.345.678-90",
        "name" => "Arya Stark",
        "rules" => [
            {
                "key" => "allowedTaxIds",
                "value" => [
                    "012.345.678-90",
                    "45.059.493/0001-73"
                ]
            }
        ]
    ])
];

$invoice = Invoice::create($invoices);

print_r($invoice);
  

Java

import com.starkbank.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

List<HashMap<String, Object>> rules = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("key", "allowedTaxIds");
data.put("value", new String[]{"012.345.678-90", "45.059.493/0001-73"});
rules.add(data);

List<Invoice> invoices = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("amount", 400000);
data.put("rules", rules);
data.put("taxId", "012.345.678-90");
data.put("name", "Arya Stark");

invoices.add(new Invoice(data));
invoices = Invoice.create(invoices);

for (Invoice invoice : invoices) {
    System.out.println(invoice);
}
  

Ruby

require('starkbank')

invoices = StarkBank::Invoice.create(
    [
        StarkBank::Invoice.new(
            amount: 400000,
            name: 'Arya Stark',
            tax_id: '012.345.678-90', 
            rules:
                [
                    {
                        key: 'allowedTaxIds',
                        value: [
                            '012.345.678-90',
                            '45.059.493/0001-73'
                        ]
                    }
                ],
        )
    ]
)

invoices.each do |invoice|
    puts invoice
end
  

Elixir

invoice = StarkBank.Invoice.create!(
    [
        %StarkBank.Invoice{
            amount: 400000,
            tax_id: "012.345.678-90",
            name: "Arya Stark",
            rules: [
                %{
                    key: "allowedTaxIds",
                    value: [
                        "012.345.678-90",
                        "45.059.493/0001-73"
                    ]
                }
            ],
        }
    ]
) |> IO.inspect()
  

C#

using System;
using System.Collections.Generic;

List<StarkBank.Invoice> invoices = StarkBank.Invoice.Create(
    new List<StarkBank.Invoice> {
        new StarkBank.Invoice(
            amount: 400000,
            name: "Arya Stark",
            taxID: "012.345.678-90",
            rules: new List<Dictionary<string, object>>() {
                new Dictionary<string, object> {
                    {"key", "allowedTaxIds"},
                    {"value", new List<string> { "012.345.678-90", "45.059.493/0001-73" }}
                }
            },
        )
    }
);

foreach (StarkBank.Invoice invoice in invoices)
{
    Console.WriteLine(invoice);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
    "time"
)

func main() {

    due := time.Date(2021, 05, 12, 0, 0, 0, 0, time.UTC)
    rules := []rule.Rule{{Key: "allowedTaxIds", Value: []string{"012.345.678-90", "45.059.493/0001-73"}}},

    invoices, err := invoice.Create(
        []invoice.Invoice{
            {
                Amount:       400000,
                Name:         "Arya Stark",
                TaxId:        "012.345.678-90",
                Rules:        rules
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    for _, invoice := range invoices {
        fmt.Printf("%+v", invoice)
    }
}
  

Clojure

(def invoices (starkbank.invoice/create
[{
    :amount 400000
    :tax-id "012.345.678-90"
    :name "Arya Stark",
    :rules [
        {
            :key "allowedTaxIds",
            :value [
                "012.345.678-90",
                "45.059.493/0001-73"
            ]
        }
    ]
}]))

(doseq [invoice invoices]
    (println invoice)
)
  

Curl

curl --location --request POST '{{baseUrl}}/v2/invoice' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "invoices": [
        {
            "amount": 400000,
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "rules": [
                {
                    "key": "allowedTaxIds",
                    "value": [
                        "012.345.678-90",
                        "45.059.493/0001-73"
                    ]
                }
            ]
        }
    ]
}'
  
RESPONSE

Python

Invoice(
    amount=400000,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[],
    discount_amount=0,
    discounts=[],
    due=2021-05-12 15:23:26,
    expiration=5097600,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.0,
    fine_amount=0,
    id=4600131349381120,
    interest=1.0,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=created,
    tags=[],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
  id: '4600131349381120',
  amount: 400000,
  due: '2021-05-12T16:27:37.585000+00:00',
  taxId: '012.345.678-90',
  name: 'Arya Stark',
  expiration: 123456789,
  fine: 2.0,
  interest: 1.0,
  discounts: [],
  tags: [],
  transactionIds: [],
  descriptions: [],
  fee: 0,
  pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
  link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
  nominalAmount: 400000,
  fineAmount: 0,
  interestAmount: 0,
  discountAmount: 0,
  brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
  status: 'created',
  created: '2020-10-26T17:10:57.606357+00:00',
  updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 400000
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 5097600
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.0
    [interest] => 1.0
    [discounts] => Array
        (
        )

    [tags] => Array
        (
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => created
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

Invoice({
    "amount": 400000,
    "due": "2021-05-12T15:23:26.000000+00:00",
    "taxId": "012.345.678-90",
    "name": "Arya Stark",
    "expiration": 5097600,
    "fee": 0,
    "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    "fine": 2.0,
    "interest": 1.0,
    "descriptions": []
    "discounts": [],
    "tags": [],
    "transactionIds": [],
    "nominalAmount": 400000,
    "fineAmount": 0,
    "interestAmount": 0,
    "discountAmount": 0,
    "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    "status": "created",
    "created": "2020-10-26T17:32:00.997116+00:00",
    "updated": "2020-10-26T17:32:00.997126+00:00",
    "id": "4600131349381120"
})
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 400000,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 5097600,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.0,
    interest: 1.0,
    discounts: [],
    tags: [],
    transaction_ids: [],
    descriptions: [],
    nominal_amount: 23571,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: created,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 400000,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [],
    discount_amount: 0,
    discounts: [],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 5097600,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.0,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.0,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "created",
    tags: [],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 5097600,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,0,
    Interest: 1,0,
    Descriptions: {},
    Discounts: {},
    Tags: {},
    TransactionIds: {  },
    Amount: 400000,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: created,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
    )
  

Go

{
    Id:4600131349381120 
    Amount:400000 
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000 
    Expiration:5097600 
    Fine:2.0
    Interest:1.0
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[] 
    Descriptions:[]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978 
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978 
    NominalAmount:400000 
    FineAmount:0 
    InterestAmount:0 
    DiscountAmount:0 
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79 
    Status:created 
    Fee:0 
    TransactionIds:[] 
    Created:2020-10-26 17:10:54.16799 +0000 +0000 
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 400000, 
    :interest-amount 0, 
    :fee 0, 
    :tags [], 
    :transaction-ids [], 
    :updated 2020-10-26T06:09:07.540753+00:00, 
    :name Iron Bank S.A., 
    :expiration 5097600, 
    :tax-id 012.345.678-90, 
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978, 
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978, 
    :nominal-amount 400000, 
    :created 2020-10-26T06:09:07.540724+00:00, 
    :discounts [
        {} 
    ], 
    :due 2021-05-12T19:32:35.418698+00:00,
    :status created,
    :interest 1.0, 
    :id 4600131349381120,
    :fine 2.0,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions []
}
  

Curl

{
    "message": "Invoice(s) successfully created",
    "invoices": [
        {
            "id": "4600131349381120",
            "status": "created",
            "amount": 400000,
            "nominalAmount": 400000,
            "fineAmount": 0,
            "interestAmount": 0,
            "discountAmount": 0,
            "expiration": 5097600,
            "discounts": [],
            "descriptions": [],
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "fee": 0,
            "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
            "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
            "fine": 2.0,
            "interest": 1.0,
            "tags": [],
            "transactionIds": [],
            "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
            "created": "2020-10-26T01:50:50.264656+00:00",
            "updated": "2020-10-26T01:50:50.264656+00:00",
            "due": "2020-05-12T17:59:26.000000+00:00"
        }
    ]
}
  

Consulting Invoices

It is possible to retrieve an invoice by its ID or even list them using parameters such as limit, after, before to filter the results, as shown in the example below:

Python

import starkbank

invoices = starkbank.invoice.query(
    after="2020-10-1",
    before="2020-10-30",
    limit=10
)

for invoice in invoices:
    print(invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoices = await starkbank.invoice.query({
        after: '2020-10-01',
        before: '2020-10-30',
    });

    for await (let invoice of invoices) {
        console.log(invoice);
    }
})();
  

PHP

use StarkBank\Invoice;

 $invoices = iterator_to_array(
    Invoice::query([
        "before" => "2020-10-30T18:00:00.000000+00:00",
        "after" => "2020-10-01T18:00:00.000000+00:00"
        ]
    ));

foreach ($invoices as $invoice) {
    print_r($invoice);
}
  

Java

import com.starkbank.*;
import com.starkbank.utils.Generator;
import java.util.HashMap;

HashMap<String, Object> params = new HashMap<>();
params.put("after", "2020-10-01");
params.put("before", "2020-10-30");
Generator<Invoice> invoices = Invoice.query(params);

for (Invoice invoice : invoices){
    System.out.println(invoice);
}
  

Ruby

require('starkbank')

invoices = StarkBank::Invoice.query(
    after: '2020-10-01',
    before: '2020-10-30'
)
    
invoices.each do |invoice|
    puts invoice
end
  

Elixir

invoices = StarkBank.Invoice.query!(
    after: "2020-10-01",
    before: "2020-10-30"
) |> Enum.take(1) |> IO.inspect
  

C#

IEnumerable<StarkBank.Invoice> invoices = StarkBank.Invoice.Query(
    after: new DateTime(2020, 10, 1),
    before: new DateTime(2020, 10, 30)
);
    
foreach (StarkBank.Invoice invoice in invoices)
{
    Console.WriteLine(invoice);
}
  

Go

package main

import (
    "fmt"
    "time"
    "github.com/starkbank/sdk-go/starkbank/invoice"
)

func main() {

    var params = map[string]interface{}{}
    params["after"] = time.Date(2020, 10, 1, 0, 0, 0, 0, time.UTC)
    params["before"] = time.Date(2020, 10, 30, 0, 0, 0, 0, time.UTC)

    invoices, errorChannel := invoice.Query(params, nil)

    loop:
    for {
        select {
        case err := <-errorChannel:
            if err.Errors != nil {
                for _, e := range err.Errors {
                    fmt.Printf("code: %s, message: %s", e.Code, e.Message)
                }
            }
        case invoice, ok := <-invoices:
            if !ok {
                break loop
            }
            fmt.Printf("%+v", invoice)
        }
    }
}
  

Clojure

(def invoices (starkbank.invoice/query 
    {
    :after "2020-10-01"
    :before "2020-10-30"
    }))

(doseq [invoice invoices]
    (println invoice))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/invoice?after=2020-10-01&before=2020-10-30' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

Invoice(
    amount=400000,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[{'key': 'Arya', 'value': 'Not today'}],
    discount_amount=0,
    discounts=[{'percentage': 10.0, 'due': '2021-03-12T18:23:26+00:00'}],
    due=2021-05-12 15:23:26,
    expiration=123456789,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.5,
    fine_amount=0,
    id=4600131349381120,
    interest=1.3,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=created,
    tags=['War supply', 'Invoice #1234'],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
    id: '4600131349381120',
    amount: 400000,
    due: '2021-05-12T16:27:37.585000+00:00',
    taxId: '012.345.678-90',
    name: 'Arya Stark',
    expiration: 123456789,
    fine: 2.5,
    interest: 1.3,
    discounts: [ { percentage: 10, due: '2021-03-12T14:16:10.639000+00:00' } ],
    tags: [ 'war supply', 'invoice #1234' ],
    transactionIds: [  ],
    descriptions: [ { key: 'Arya', value: 'Not today' } ],
    fee: 0,
    pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
    link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
    nominalAmount: 400000,
    fineAmount: 0,
    interestAmount: 0,
    discountAmount: 0,
    brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
    status: 'created',
    created: '2020-10-26T17:10:57.606357+00:00',
    updated: '2020-10-26T17:10:57.606367+00:00'
    }
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 400000
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 123456789
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.5
    [interest] => 1.3
    [discounts] => Array
        (
            [0] => Array
                (
                    [percentage] => 10
                    [due] => 2021-03-12T21:00:00+00:00
                )

        )

    [tags] => Array
        (
            [0] => war supply
            [1] => invoice #1234
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
            [0] => Array
                (
                    [key] => Arya
                    [value] => Not today
                )

        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => created
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

Invoice({
    "amount": 400000,
    "due": "2021-05-12T15:23:26.000000+00:00",
    "taxId": "012.345.678-90",
    "name": "Arya Stark",
    "expiration": 123456789,
    "fee": 0,
    "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    "fine": 2.5,
    "interest": 1.3,
    "descriptions": [
        {
            "key": "Arya",
            "value": "Not today"
        }
    ]
    "discounts": [],
    "tags": ["war supply", "invoice #1234"],
    "transactionIds": [],
    "nominalAmount": 400000,
    "fineAmount": 0,
    "interestAmount": 0,
    "discountAmount": 0,
    "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    "status": "created",
    "created": "2020-10-26T17:32:00.997116+00:00",
    "updated": "2020-10-26T17:32:00.997126+00:00",
    "id": "4600131349381120"
})
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 400000,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 123456789,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.5,
    interest: 1.3,
    discounts: [
        (
            percentage: 5,
            due: 2021-03-12T14:00:21+00:00
        )
    ],
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    descriptions: [
        (
            key: Arya,
            value: Not today
        )
    ],
    nominal_amount: 23571,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: created,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 400000,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [
        %{"key" => "Arya", "value" => "Not today"}
    ],
    discount_amount: 0,
    discounts: [
        %{"due" => "2020-11-23T21:36:18.223000+00:00", "percentage" => 10.0}
    ],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 123456789,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.5,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.3,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "created",
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 123456789,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,5,
    Interest: 1,3,
    Descriptions: { { { key, Arya }, { value, Not today } } },
    Discounts: { { { percentage, 10 }, { due, 30/05/2021 23:30:00 } } },
    Tags: { war supply, invoice #1234 },
    TransactionIds: {  },
    Amount: 400000,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: created,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
    )
  

Go

{
    Id:4600131349381120 
    Amount:400000 
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000 
    Expiration:123456789 
    Fine:2.5 
    Interest:1.3 
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[war supply invoice #1234] 
    Descriptions:[map[key:Arya value:Not today]]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978 
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978 
    NominalAmount:400000 
    FineAmount:0 
    InterestAmount:0 
    DiscountAmount:0 
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79 
    Status:created 
    Fee:0 
    TransactionIds:[] 
    Created:2020-10-26 17:10:54.16799 +0000 +0000 
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 400000, 
    :interest-amount 0, 
    :fee 0, 
    :tags [war supply invoice #1234], 
    :transaction-ids [], 
    :updated 2020-10-26T06:09:07.540753+00:00, 
    :name Iron Bank S.A., 
    :expiration 123456789, 
    :tax-id 012.345.678-90, 
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978, 
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978, 
    :nominal-amount 400000, 
    :created 2020-10-26T06:09:07.540724+00:00, 
    :discounts [
        {
            :percentage 5.0, 
            :due 2021-03-12T22:32:35.418698+00:00
        } 
    ], 
    :due 2021-05-12T19:32:35.418698+00:00,
    :status created,
    :interest 1.3, 
    :id 4600131349381120,
    :fine 2.5,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions [
        {
            :key Product X,
            :value big
        }
    ]
}
  

Curl

{
    "cursor": null,
    "invoices": [
        {
            "id": "4600131349381120",
            "status": "created",
            "amount": 400000,
            "nominalAmount": 400000,
            "fineAmount": 0,
            "interestAmount": 0,
            "discountAmount": 0,
            "expiration": 123456789,
            "discounts": [
                {
                    "percentage": 5.0
                    "due": 2021-03-12T01:50:50.264656+00:00
                }
            ],
            "descriptions": [
                {
                    "key": "Arya"
                    "value": "Not today"
                }
            ],
            "name": "Arya Stark",
            "taxId": "012.345.678-90",
            "fee": 0,
            "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
            "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
            "fine": 2.5,
            "interest": 1.3,
            "tags": [
                "War supply",
                "Invoice #1234"
            ],
            "transactionIds": [],
            "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
            "created": "2020-10-26T01:50:50.264656+00:00",
            "updated": "2020-10-26T01:50:50.264656+00:00",
            "due": "2020-05-12T17:59:26.000000+00:00",
        }
    ]
}
  

Updating Invoices

Resource that will update certain parameters of your Invoice

To update an Invoice, it is necessary to provide the invoice ID. Additionally, other parameters such as amount, due, expiration, and status can be included in the update process.

If the Invoice has already been paid, it is possible to reduce only the amount, resulting in the corresponding refund. For example, if a R$ 100 invoice has been paid, you can set the amount parameter to R$ 5, and the remaining R$ 95 will be refunded to the payer.

This provides greater flexibility and control over the information associated with your financial transactions.

Python

import starkbank

updated_invoice = starkbank.invoice.update(
    "4600131349381120", 
    amount=12345,
    expiration=98765
)

print(updated_invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoice = await starkbank.invoice.update('4600131349381120', 
        {
            amount: 12345,
            expiration: 98765
        }
    );
    console.log(invoice);
})();
  

PHP

use StarkBank\Invoice;

$updateInvoice = Invoice::update(
    "4600131349381120",
    [
        "amount" => 12345,
        "expiration" => 98765
    ]
);

print_r($updateInvoice);
  

Java

Invoice({
    "amount": 400000,
    "due": "2021-05-12T15:23:26.000000+00:00",
    "taxId": "012.345.678-90",
    "name": "Arya Stark",
    "expiration": 123456789,
    "fee": 0,
    "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    "fine": 2.5,
    "interest": 1.3,
    "descriptions": [
        {
            "key": "Arya",
            "value": "Not today"
        }
    ]
    "discounts": [],
    "tags": ["war supply", "invoice #1234"],
    "transactionIds": [],
    "nominalAmount": 400000,
    "fineAmount": 0,
    "interestAmount": 0,
    "discountAmount": 0,
    "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    "status": "created",
    "created": "2020-10-26T17:32:00.997116+00:00",
    "updated": "2020-10-26T17:32:00.997126+00:00",
    "id": "4600131349381120"
})
  

Ruby

require('starkbank')

invoice = StarkBank::Invoice.update(
    '4600131349381120', 
    amount: 12345,
    expiration: 98765,
)

puts invoice
  

Elixir

invoice = StarkBank.Invoice.update!(
    "4600131349381120", 
    amount: 12345,
    expiration: 98765
) |> IO.inspect
  

C#

StarkBank.Invoice invoice = StarkBank.Invoice.Update(
    "4600131349381120",
    amount: 12345,
    expiration: 98765
);

Console.WriteLine(invoice);
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
)

func main() {

    var patchData = map[string]interface{}{}
    patchData["amount"] = 12345
    patchData["expiration"] = 98765

    invoice, err := invoice.Update("4600131349381120", patchData, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    fmt.Printf("%+v", invoice)
}
  

Clojure

(def invoice (starkbank.invoice/update "4600131349381120" {:amount 12345 :expiration 98765}))

(println invoice)
  

Curl

curl --location --request PATCH '{{baseUrl}}/v2/invoice/4600131349381120' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "amount": 12345,
    "expiration": 98765,
}'
  
RESPONSE

Python

Invoice(
    amount=12345,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[{'key': 'Arya', 'value': 'Not today'}],
    discount_amount=0,
    discounts=[{'percentage': 10.0, 'due': '2021-03-12T18:23:26+00:00'}],
    due=2021-05-12 15:23:26,
    expiration=98765,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.5,
    fine_amount=0,
    id=4600131349381120,
    interest=1.3,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=created,
    tags=['War supply', 'Invoice #1234'],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
    id: '4600131349381120',
    amount: 12345,
    due: '2021-05-12T16:27:37.585000+00:00',
    taxId: '012.345.678-90',
    name: 'Arya Stark',
    expiration: 98765,
    fine: 2.5,
    interest: 1.3,
    discounts: [ { percentage: 10, due: '2021-03-12T14:16:10.639000+00:00' } ],
    tags: [ 'war supply', 'invoice #1234' ],
    transactionIds: [  ],
    descriptions: [ { key: 'Arya', value: 'Not today' } ],
    fee: 0,
    pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
    link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
    nominalAmount: 400000,
    fineAmount: 0,
    interestAmount: 0,
    discountAmount: 0,
    brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
    status: 'created',
    created: '2020-10-26T17:10:57.606357+00:00',
    updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 12345
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 98765
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.5
    [interest] => 1.3
    [discounts] => Array
        (
            [0] => Array
                (
                    [percentage] => 10
                    [due] => 2021-03-12T21:00:00+00:00
                )

        )

    [tags] => Array
        (
            [0] => war supply
            [1] => invoice #1234
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
            [0] => Array
                (
                    [key] => Arya
                    [value] => Not today
                )

        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => created
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

import com.starkbank.*;

HashMap<String, Object> patchData = new HashMap<>();
patchData.put("amount", 12345);
patchData.put("expiration", 98765);

Invoice invoice = Invoice.update("4600131349381120", data);

System.out.println(invoice);
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 12345,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 98765,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.5,
    interest: 1.3,
    discounts: [
        (
            percentage: 5,
            due: 2021-03-12T14:00:21+00:00
        )
    ],
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    descriptions: [
        (
            key: Arya,
            value: Not today
        )
    ],
    nominal_amount: 23571,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: created,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 12345,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [
        %{"key" => "Arya", "value" => "Not today"}
    ],
    discount_amount: 0,
    discounts: [
        %{"due" => "2020-11-23T21:36:18.223000+00:00", "percentage" => 10.0}
    ],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 98765,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.5,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.3,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "created",
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 98765,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,5,
    Interest: 1,3,
    Descriptions: { { { key, Arya }, { value, Not today } } },
    Discounts: { { { percentage, 10 }, { due, 30/05/2021 23:30:00 } } },
    Tags: { war supply, invoice #1234 },
    TransactionIds: {  },
    Amount: 12345,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: created,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
)
  

Go

{
    Id:4600131349381120 
    Amount:12345 
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000 
    Expiration:98765 
    Fine:2.5 
    Interest:1.3 
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[war supply invoice #1234] 
    Descriptions:[map[key:Arya value:Not today]]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978 
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978 
    NominalAmount:400000 
    FineAmount:0 
    InterestAmount:0 
    DiscountAmount:0 
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79 
    Status:created
    Fee:0
    TransactionIds:[]
    Created:2020-10-26 17:10:54.16799 +0000 +0000
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 12345, 
    :interest-amount 0, 
    :fee 0, 
    :tags [war supply invoice #1234], 
    :transaction-ids [], 
    :updated 2020-10-26T06:09:07.540753+00:00, 
    :name Iron Bank S.A., 
    :expiration 98765, 
    :tax-id 012.345.678-90, 
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978, 
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978, 
    :nominal-amount 400000, 
    :created 2020-10-26T06:09:07.540724+00:00, 
    :discounts [
        {
            :percentage 5.0, 
            :due 2021-03-12T22:32:35.418698+00:00
        } 
    ], 
    :due 2021-05-12T19:32:35.418698+00:00,
    :status created,
    :interest 1.3,
    :id 4600131349381120,
    :fine 2.5,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions [
        {
            :key Product X,
            :value big
        }
    ]
}
  

Curl

{
    "invoice": {
        "id": "4600131349381120",
        "status": "created",
        "amount": 12345,
        "nominalAmount": 400000,
        "fineAmount": 0,
        "interestAmount": 0,
        "discountAmount": 0,
        "expiration": 98765,
        "discounts": [
            {
                "percentage": 5.0
                "due": 2021-03-12T01:50:50.264656+00:00
            }
        ],
        "descriptions": [
            {
                "key": "Arya"
                "value": "Not today"
            }
        ],
        "name": "Arya Stark",
        "taxId": "012.345.678-90",
        "fee": 0,
        "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
        "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
        "fine": 2.5,
        "interest": 1.3,
        "tags": [
            "War supply",
            "Invoice #1234"
        ],
        "transactionIds": [],
        "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
        "created": "2020-10-26T01:50:50.264656+00:00",
        "updated": "2020-10-26T01:50:50.264656+00:00",
        "due": "2020-05-12T17:59:26.000000+00:00",
    }
}
  

Canceling an Invoice

To cancel an Invoice, you need to update the invoice status to "canceled".

Only Invoices that have not yet been paid can be canceled.

Python

import starkbank

canceled_invoice = starkbank.invoice.update(
    "4600131349381120",
    status="canceled"
)

print(canceled_invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoice = await starkbank.invoice.update('4600131349381120',
        {
            status: 'canceled'
        }
    );
    console.log(invoice);
})();
  

PHP

use StarkBank\Invoice;

$canceledInvoice = Invoice::update(
    "4600131349381120",
    [
        "status" => "canceled"
    ]
);

print_r($canceledInvoice);
  

Java

import com.starkbank.*;

HashMap patchData = new HashMap<>();
patchData.put("status", "canceled");

Invoice invoice = Invoice.update("4600131349381120", patchData);

System.out.println(invoice);
  

Ruby

require('starkbank')

invoice = StarkBank::Invoice.update(
    '4600131349381120',
    status: 'canceled'
)

puts invoice
  

Elixir

invoice = StarkBank.Invoice.update!(
    "4600131349381120",
    status: "canceled"
) |> IO.inspect
  

C#

StarkBank.Invoice invoice = StarkBank.Invoice.Update(
    "4600131349381120",
    status: "canceled"
);

Console.WriteLine(invoice);
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
)

func main() {

    var patchData = map[string]interface{}{}
    patchData["status"] = "canceled"

    invoice, err := invoice.Update("4600131349381120", patchData, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    fmt.Printf("%+v", invoice)
}
  

Clojure

(def invoice (starkbank.invoice/update "4600131349381120" {:status "canceled"}))

(println invoice)
  

Curl

curl --location --request PATCH '{{baseUrl}}/v2/invoice/4600131349381120' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "status": "canceled"
}'
  
RESPONSE

Python

Invoice(
    amount=400000,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[{'key': 'Arya', 'value': 'Not today'}],
    discount_amount=0,
    discounts=[{'percentage': 10.0, 'due': '2021-03-12T18:23:26+00:00'}],
    due=2021-05-12 15:23:26,
    expiration=123456789,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.5,
    fine_amount=0,
    id=4600131349381120,
    interest=1.3,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=canceled,
    tags=['War supply', 'Invoice #1234'],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
    id: '4600131349381120',
    amount: 400000,
    due: '2021-05-12T16:27:37.585000+00:00',
    taxId: '012.345.678-90',
    name: 'Arya Stark',
    expiration: 123456789,
    fine: 2.5,
    interest: 1.3,
    discounts: [ { percentage: 10, due: '2021-03-12T14:16:10.639000+00:00' } ],
    tags: [ 'war supply', 'invoice #1234' ],
    transactionIds: [  ],
    descriptions: [ { key: 'Arya', value: 'Not today' } ],
    fee: 0,
    pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
    link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
    nominalAmount: 400000,
    fineAmount: 0,
    interestAmount: 0,
    discountAmount: 0,
    brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
    status: 'canceled',
    created: '2020-10-26T17:10:57.606357+00:00',
    updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 400000
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 123456789
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.5
    [interest] => 1.3
    [discounts] => Array
        (
            [0] => Array
                (
                    [percentage] => 10
                    [due] => 2021-03-12T21:00:00+00:00
                )

        )

    [tags] => Array
        (
            [0] => war supply
            [1] => invoice #1234
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
            [0] => Array
                (
                    [key] => Arya
                    [value] => Not today
                )

        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => canceled
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

import com.starkbank.*;

HashMap<String, Object> patchData = new HashMap<>();
patchData.put("status", "canceled");

Invoice invoice = Invoice.update("4600131349381120", data);

System.out.println(invoice);
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 400000,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 123456789,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.5,
    interest: 1.3,
    discounts: [
        (
            percentage: 5,
            due: 2021-03-12T14:00:21+00:00
        )
    ],
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    descriptions: [
        (
            key: Arya,
            value: Not today
        )
    ],
    nominal_amount: 400000,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: canceled,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 400000,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [
        %{"key" => "Arya", "value" => "Not today"}
    ],
    discount_amount: 0,
    discounts: [
        %{"due" => "2020-11-23T21:36:18.223000+00:00", "percentage" => 10.0}
    ],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 123456789,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.5,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.3,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "canceled",
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 123456789,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,5,
    Interest: 1,3,
    Descriptions: { { { key, Arya }, { value, Not today } } },
    Discounts: { { { percentage, 10 }, { due, 30/05/2021 23:30:00 } } },
    Tags: { war supply, invoice #1234 },
    TransactionIds: {  },
    Amount: 400000,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: canceled,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
)
  

Go

{
    Id:4600131349381120
    Amount:400000
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000
    Expiration:123456789
    Fine:2.5
    Interest:1.3
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[war supply invoice #1234]
    Descriptions:[map[key:Arya value:Not today]]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    NominalAmount:400000
    FineAmount:0
    InterestAmount:0
    DiscountAmount:0
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    Status:canceled
    Fee:0
    TransactionIds:[]
    Created:2020-10-26 17:10:54.16799 +0000 +0000
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 400000,
    :interest-amount 0,
    :fee 0,
    :tags [war supply invoice #1234],
    :transaction-ids [],
    :updated 2020-10-26T06:09:07.540753+00:00,
    :name Iron Bank S.A.,
    :expiration 123456789,
    :tax-id 012.345.678-90,
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    :nominal-amount 400000,
    :created 2020-10-26T06:09:07.540724+00:00,
    :discounts [
        {
            :percentage 5.0,
            :due 2021-03-12T22:32:35.418698+00:00
        }
    ],
    :due 2021-05-12T19:32:35.418698+00:00,
    :status canceled,
    :interest 1.3,
    :id 4600131349381120,
    :fine 2.5,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions [
        {
            :key Product X,
            :value big
        }
    ]
}
  

Curl

{
    "invoice": {
        "id": "4600131349381120",
        "status": "canceled",
        "amount": 400000,
        "nominalAmount": 400000,
        "fineAmount": 0,
        "interestAmount": 0,
        "discountAmount": 0,
        "expiration": 123456789,
        "discounts": [
            {
                "percentage": 5.0
                "due": 2021-03-12T01:50:50.264656+00:00
            }
        ],
        "descriptions": [
            {
                "key": "Arya"
                "value": "Not today"
            }
        ],
        "name": "Arya Stark",
        "taxId": "012.345.678-90",
        "fee": 0,
        "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
        "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
        "fine": 2.5,
        "interest": 1.3,
        "tags": [
            "War supply",
            "Invoice #1234"
        ],
        "transactionIds": [],
        "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
        "created": "2020-10-26T01:50:50.264656+00:00",
        "updated": "2020-10-26T01:50:50.264656+00:00",
        "due": "2020-05-12T17:59:26.000000+00:00",
    }
}
  

Reversing Partially an Invoice

To partially reverse a paid Invoice, you need to PATCH the invoice amount to a lower value. The difference between the paid amount and the new amount will be reversed to the payer.

For example, if an Invoice was paid with an amount of 400000 (R$ 4,000.00) and you patch the amount to 3000 (R$ 30.00), it means you reversed 397000 (R$ 3,970.00) back to the payer.

While the reversal is being processed, the invoice status remains paid.

Python

import starkbank

updated_invoice = starkbank.invoice.update(
    "4600131349381120",
    amount=3000
)

print(updated_invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoice = await starkbank.invoice.update('4600131349381120',
        {
            amount: 3000
        }
    );
    console.log(invoice);
})();
  

PHP

use StarkBank\Invoice;

$updateInvoice = Invoice::update(
    "4600131349381120",
    [
        "amount" => 3000
    ]
);

print_r($updateInvoice);
  

Java

import com.starkbank.*;

HashMap patchData = new HashMap<>();
patchData.put("amount", 3000);

Invoice invoice = Invoice.update("4600131349381120", patchData);

System.out.println(invoice);
  

Ruby

require('starkbank')

invoice = StarkBank::Invoice.update(
    '4600131349381120',
    amount: 3000
)

puts invoice
  

Elixir

invoice = StarkBank.Invoice.update!(
    "4600131349381120",
    amount: 3000
) |> IO.inspect
  

C#

StarkBank.Invoice invoice = StarkBank.Invoice.Update(
    "4600131349381120",
    amount: 3000
);

Console.WriteLine(invoice);
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
)

func main() {

    var patchData = map[string]interface{}{}
    patchData["amount"] = 3000

    invoice, err := invoice.Update("4600131349381120", patchData, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    fmt.Printf("%+v", invoice)
}
  

Clojure

(def invoice (starkbank.invoice/update "4600131349381120" {:amount 3000}))

(println invoice)
  

Curl

curl --location --request PATCH '{{baseUrl}}/v2/invoice/4600131349381120' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "amount": 3000
}'
  
RESPONSE

Python

Invoice(
    amount=3000,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[{'key': 'Arya', 'value': 'Not today'}],
    discount_amount=0,
    discounts=[{'percentage': 10.0, 'due': '2021-03-12T18:23:26+00:00'}],
    due=2021-05-12 15:23:26,
    expiration=123456789,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.5,
    fine_amount=0,
    id=4600131349381120,
    interest=1.3,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=paid,
    tags=['War supply', 'Invoice #1234'],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
    id: '4600131349381120',
    amount: 3000,
    due: '2021-05-12T16:27:37.585000+00:00',
    taxId: '012.345.678-90',
    name: 'Arya Stark',
    expiration: 123456789,
    fine: 2.5,
    interest: 1.3,
    discounts: [ { percentage: 10, due: '2021-03-12T14:16:10.639000+00:00' } ],
    tags: [ 'war supply', 'invoice #1234' ],
    transactionIds: [  ],
    descriptions: [ { key: 'Arya', value: 'Not today' } ],
    fee: 0,
    pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
    link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
    nominalAmount: 400000,
    fineAmount: 0,
    interestAmount: 0,
    discountAmount: 0,
    brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
    status: 'paid',
    created: '2020-10-26T17:10:57.606357+00:00',
    updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 3000
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 123456789
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.5
    [interest] => 1.3
    [discounts] => Array
        (
            [0] => Array
                (
                    [percentage] => 10
                    [due] => 2021-03-12T21:00:00+00:00
                )

        )

    [tags] => Array
        (
            [0] => war supply
            [1] => invoice #1234
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
            [0] => Array
                (
                    [key] => Arya
                    [value] => Not today
                )

        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => paid
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

import com.starkbank.*;

HashMap<String, Object> patchData = new HashMap<>();
patchData.put("amount", 3000);

Invoice invoice = Invoice.update("4600131349381120", patchData);

System.out.println(invoice);
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 3000,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 123456789,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.5,
    interest: 1.3,
    discounts: [
        (
            percentage: 5,
            due: 2021-03-12T14:00:21+00:00
        )
    ],
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    descriptions: [
        (
            key: Arya,
            value: Not today
        )
    ],
    nominal_amount: 400000,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: paid,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 3000,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [
        %{"key" => "Arya", "value" => "Not today"}
    ],
    discount_amount: 0,
    discounts: [
        %{"due" => "2020-11-23T21:36:18.223000+00:00", "percentage" => 10.0}
    ],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 123456789,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.5,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.3,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "paid",
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 123456789,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,5,
    Interest: 1,3,
    Descriptions: { { { key, Arya }, { value, Not today } } },
    Discounts: { { { percentage, 10 }, { due, 30/05/2021 23:30:00 } } },
    Tags: { war supply, invoice #1234 },
    TransactionIds: {  },
    Amount: 3000,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: paid,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
)
  

Go

{
    Id:4600131349381120
    Amount:3000
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000
    Expiration:123456789
    Fine:2.5
    Interest:1.3
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[war supply invoice #1234]
    Descriptions:[map[key:Arya value:Not today]]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    NominalAmount:400000
    FineAmount:0
    InterestAmount:0
    DiscountAmount:0
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    Status:paid
    Fee:0
    TransactionIds:[]
    Created:2020-10-26 17:10:54.16799 +0000 +0000
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 3000,
    :interest-amount 0,
    :fee 0,
    :tags [war supply invoice #1234],
    :transaction-ids [],
    :updated 2020-10-26T06:09:07.540753+00:00,
    :name Iron Bank S.A.,
    :expiration 123456789,
    :tax-id 012.345.678-90,
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    :nominal-amount 400000,
    :created 2020-10-26T06:09:07.540724+00:00,
    :discounts [
        {
            :percentage 5.0,
            :due 2021-03-12T22:32:35.418698+00:00
        }
    ],
    :due 2021-05-12T19:32:35.418698+00:00,
    :status paid,
    :interest 1.3,
    :id 4600131349381120,
    :fine 2.5,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions [
        {
            :key Product X,
            :value big
        }
    ]
}
  

Curl

{
    "invoice": {
        "id": "4600131349381120",
        "status": "paid",
        "amount": 3000,
        "nominalAmount": 400000,
        "fineAmount": 0,
        "interestAmount": 0,
        "discountAmount": 0,
        "expiration": 123456789,
        "discounts": [
            {
                "percentage": 5.0
                "due": 2021-03-12T01:50:50.264656+00:00
            }
        ],
        "descriptions": [
            {
                "key": "Arya"
                "value": "Not today"
            }
        ],
        "name": "Arya Stark",
        "taxId": "012.345.678-90",
        "fee": 0,
        "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
        "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
        "fine": 2.5,
        "interest": 1.3,
        "tags": [
            "War supply",
            "Invoice #1234"
        ],
        "transactionIds": [],
        "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
        "created": "2020-10-26T01:50:50.264656+00:00",
        "updated": "2020-10-26T01:50:50.264656+00:00",
        "due": "2020-05-12T17:59:26.000000+00:00",
    }
}
  

Reversing Fully an Invoice

To fully reverse a paid Invoice, you need to PATCH the invoice amount to 0. This will reverse the entire paid amount back to the payer.

For example, if an Invoice was paid with an amount of 400000 (R$ 4,000.00) and you patch the amount to 0, the full 400000 (R$ 4,000.00) will be reversed to the payer.

After the full reversal is completed, the invoice status remains paid.

Python

import starkbank

updated_invoice = starkbank.invoice.update(
    "4600131349381120",
    amount=0
)

print(updated_invoice)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let invoice = await starkbank.invoice.update('4600131349381120',
        {
            amount: 0
        }
    );
    console.log(invoice);
})();
  

PHP

use StarkBank\Invoice;

$updateInvoice = Invoice::update(
    "4600131349381120",
    [
        "amount" => 0
    ]
);

print_r($updateInvoice);
  

Java

import com.starkbank.*;

HashMap patchData = new HashMap<>();
patchData.put("amount", 0);

Invoice invoice = Invoice.update("4600131349381120", patchData);

System.out.println(invoice);
  

Ruby

require('starkbank')

invoice = StarkBank::Invoice.update(
    '4600131349381120',
    amount: 0
)

puts invoice
  

Elixir

invoice = StarkBank.Invoice.update!(
    "4600131349381120",
    amount: 0
) |> IO.inspect
  

C#

StarkBank.Invoice invoice = StarkBank.Invoice.Update(
    "4600131349381120",
    amount: 0
);

Console.WriteLine(invoice);
  

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/invoice"
)

func main() {

    var patchData = map[string]interface{}{}
    patchData["amount"] = 0

    invoice, err := invoice.Update("4600131349381120", patchData, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    fmt.Printf("%+v", invoice)
}
  

Clojure

(def invoice (starkbank.invoice/update "4600131349381120" {:amount 0}))

(println invoice)
  

Curl

curl --location --request PATCH '{{baseUrl}}/v2/invoice/4600131349381120' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "amount": 0
}'
  
RESPONSE

Python

Invoice(
    amount=0,
    brcode=00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    created=2020-10-26 17:10:57.261868,
    descriptions=[{'key': 'Arya', 'value': 'Not today'}],
    discount_amount=0,
    discounts=[{'percentage': 10.0, 'due': '2021-03-12T18:23:26+00:00'}],
    due=2021-05-12 15:23:26,
    expiration=123456789,
    fee=0,
    pdf=https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link=https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine=2.5,
    fine_amount=0,
    id=4600131349381120,
    interest=1.3,
    interest_amount=0,
    name=Arya Stark,
    nominal_amount=400000,
    status=paid,
    tags=['War supply', 'Invoice #1234'],
    transaction_ids=[],
    tax_id=012.345.678-90,
    updated=2020-10-26 17:10:57.261877
)
  

Javascript

Invoice {
    id: '4600131349381120',
    amount: 0,
    due: '2021-05-12T16:27:37.585000+00:00',
    taxId: '012.345.678-90',
    name: 'Arya Stark',
    expiration: 123456789,
    fine: 2.5,
    interest: 1.3,
    discounts: [ { percentage: 10, due: '2021-03-12T14:16:10.639000+00:00' } ],
    tags: [ 'war supply', 'invoice #1234' ],
    transactionIds: [  ],
    descriptions: [ { key: 'Arya', value: 'Not today' } ],
    fee: 0,
    pdf: 'https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978',
    link: 'https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978',
    nominalAmount: 400000,
    fineAmount: 0,
    interestAmount: 0,
    discountAmount: 0,
    brcode: '00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79',
    status: 'paid',
    created: '2020-10-26T17:10:57.606357+00:00',
    updated: '2020-10-26T17:10:57.606367+00:00'
}
  

PHP

StarkBank\Invoice Object
(
    [id] => 4600131349381120
    [amount] => 0
    [due] => DateTime Object
        (
            [date] => 2021-05-12 18:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [taxId] => 012.345.678-90
    [name] => Arya Stark
    [expiration] => 123456789
    [fee] => 0
    [pdf] => https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    [link] => https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    [fine] => 2.5
    [interest] => 1.3
    [discounts] => Array
        (
            [0] => Array
                (
                    [percentage] => 10
                    [due] => 2021-03-12T21:00:00+00:00
                )

        )

    [tags] => Array
        (
            [0] => war supply
            [1] => invoice #1234
        )

    [transactionIds] => Array
        (
        )

    [descriptions] => Array
        (
            [0] => Array
                (
                    [key] => Arya
                    [value] => Not today
                )

        )

    [nominalAmount] => 400000
    [fineAmount] => 0
    [interestAmount] => 0
    [discountAmount] => 0
    [brcode] => 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    [status] => paid
    [created] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241309
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [updated] => DateTime Object
        (
            [date] => 2020-10-26 17:10:43.241320
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
  

Java

import com.starkbank.*;

HashMap<String, Object> patchData = new HashMap<>();
patchData.put("amount", 0);

Invoice invoice = Invoice.update("4600131349381120", patchData);

System.out.println(invoice);
  

Ruby

invoice(
    id: 4600131349381120,
    amount: 0,
    due: 2021-05-12T11:00:20+00:00,
    tax_id: 012.345.678-90,
    name: Arya Stark,
    expiration: 123456789,
    fee: 0,
    pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    fine: 2.5,
    interest: 1.3,
    discounts: [
        (
            percentage: 5,
            due: 2021-03-12T14:00:21+00:00
        )
    ],
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    descriptions: [
        (
            key: Arya,
            value: Not today
        )
    ],
    nominal_amount: 400000,
    fine_amount: 0,
    interest_amount: 0,
    discount_amount: 0,
    brcode: 00020101021226860014br.gov.bcb.pix2564invoice-h.sandbox.starkbank.com/0e272677d4924d1fa3520cfda61b0f6f5204000053039865802BR5933Matheus Coelho Ferraz 418128448406009Sao Paulo62200516643401702073958463047661,
    status: paid,
    updated: 2020-10-26T14:00:21+00:00,
    created: 2020-10-26T14:00:21+00:00
)
  

Elixir

%StarkBank.Invoice{
    amount: 0,
    brcode: "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
    created: ~U[2020-10-26 18:36:18.116954Z],
    descriptions: [
        %{"key" => "Arya", "value" => "Not today"}
    ],
    discount_amount: 0,
    discounts: [
        %{"due" => "2020-11-23T21:36:18.223000+00:00", "percentage" => 10.0}
    ],
    due: "2020-05-12T18:36:18.219000+00:00",
    expiration: 123456789,
    fee: 0,
    pdf: "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
    link: "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
    fine: 2.5,
    fine_amount: 0,
    id: "4600131349381120",
    interest: 1.3,
    interest_amount: 0,
    name: "Arya Stark",
    nominal_amount: 400000,
    status: "paid",
    tags: ["war supply", "invoice #1234"],
    transaction_ids: [],
    tax_id: "012.345.678-90",
    updated: ~U[2020-10-26 18:36:18.116976Z]
}
  

C#

Invoice(
    Name: Arya Stark,
    TaxID: 012.345.678-90,
    Due: 12/05/2021 20:30:00,
    Expiration: 123456789,
    Fee: 0,
    Pdf: https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    Link: https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    Fine: 2,5,
    Interest: 1,3,
    Descriptions: { { { key, Arya }, { value, Not today } } },
    Discounts: { { { percentage, 10 }, { due, 30/05/2021 23:30:00 } } },
    Tags: { war supply, invoice #1234 },
    TransactionIds: {  },
    Amount: 0,
    NominalAmount: 400000,
    FineAmount: 0,
    InterestAmount: 0,
    DiscountAmount: 0,
    Brcode: 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    Status: paid,
    Created: 26/10/2020 12:56:53,
    Updated: 26/10/2020 12:56:53,
    ID: 4600131349381120
)
  

Go

{
    Id:4600131349381120
    Amount:0
    Name:Arya Stark
    TaxId:012.345.678-90
    Due:2021-05-12 16:54:53.5521 +0000 +0000
    Expiration:123456789
    Fine:2.5
    Interest:1.3
    Discounts:[map[due:2023-02-16T16:20:16.621546+00:00 percentage:5]]
    Tags:[war supply invoice #1234]
    Descriptions:[map[key:Arya value:Not today]]
    Pdf:https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978
    Link:https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978
    NominalAmount:400000
    FineAmount:0
    InterestAmount:0
    DiscountAmount:0
    Brcode:00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79
    Status:paid
    Fee:0
    TransactionIds:[]
    Created:2020-10-26 17:10:54.16799 +0000 +0000
    Updated:2020-10-26 17:10:54.24204 +0000 +0000
}
  

Clojure

{
    :amount 0,
    :interest-amount 0,
    :fee 0,
    :tags [war supply invoice #1234],
    :transaction-ids [],
    :updated 2020-10-26T06:09:07.540753+00:00,
    :name Iron Bank S.A.,
    :expiration 123456789,
    :tax-id 012.345.678-90,
    :pdf https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978,
    :link https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978,
    :nominal-amount 400000,
    :created 2020-10-26T06:09:07.540724+00:00,
    :discounts [
        {
            :percentage 5.0,
            :due 2021-03-12T22:32:35.418698+00:00
        }
    ],
    :due 2021-05-12T19:32:35.418698+00:00,
    :status paid,
    :interest 1.3,
    :id 4600131349381120,
    :fine 2.5,
    :fine-amount 0,
    :discount-amount 0,
    :brcode 00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79,
    :descriptions [
        {
            :key Product X,
            :value big
        }
    ]
}
  

Curl

{
    "invoice": {
        "id": "4600131349381120",
        "status": "paid",
        "amount": 0,
        "nominalAmount": 400000,
        "fineAmount": 0,
        "interestAmount": 0,
        "discountAmount": 0,
        "expiration": 123456789,
        "discounts": [
            {
                "percentage": 5.0
                "due": 2021-03-12T01:50:50.264656+00:00
            }
        ],
        "descriptions": [
            {
                "key": "Arya"
                "value": "Not today"
            }
        ],
        "name": "Arya Stark",
        "taxId": "012.345.678-90",
        "fee": 0,
        "pdf": "https://invoice-h.sandbox.starkbank.com/pdf/851ff545535c40ba88e24a05accb9978",
        "link": "https://invoice-h.sandbox.starkbank.com/invoicelink/851ff545535c40ba88e24a05accb9978",
        "fine": 2.5,
        "interest": 1.3,
        "tags": [
            "War supply",
            "Invoice #1234"
        ],
        "transactionIds": [],
        "brcode": "00020101021226600014br.gov.bcb.pix2538invoice-h.sandbox.starkbank.com/57301741758054405204000053039865802BR5910NightKing6010Winterfell62280524invoice/573017417580544063046B79",
        "created": "2020-10-26T01:50:50.264656+00:00",
        "updated": "2020-10-26T01:50:50.264656+00:00",
        "due": "2020-05-12T17:59:26.000000+00:00",
    }
}
  

Receiving Invoice Webhook

After creation, you can use asynchronous Webhooks to monitor status changes of the entity. The Invoice will follow the following life cycle:

Every time we change an Invoice, we create a Log. Logs are pretty useful for understanding the life cycle of each Invoice. Whenever a new Log is created, we will fire a Webhook to your registered URL.

NOTE: Check the Webhook Get Started for more details on how to receive and process Webhook events.

NOTE: An invoice subscription is required to receive this event.

RESPONSE

Python

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

Javascript

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

PHP

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

Java

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

Ruby

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

Elixir

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

C#

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

Go

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

Clojure

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}
        

Curl

{
  "event": {
    "id": "6046987522670592",
    "subscription": "invoice",
    "workspaceId": "6341320293482496"
    "created": "2024-01-31T21:15:17.463956+00:00",
    "log": {
      "id": "5244688441278464",
      "type": "credited"
      "created": "2024-01-31T21:15:16.852263+00:00",
      "errors": [],
      "invoice": {
        "amount": 10000,
        "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkbank.com/v2/ee87e7ce19544b11be5a6de65b97091a5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***630442BE",
        "created": "2024-01-31T21:15:16.701209+00:00",
        "descriptions": [
          {
            "key": "Product A",
            "value": "R$10,00"
          },
          {
            "key": "Taxes",
            "value": "R$100,00"
          }
        ],
        "discountAmount": 0,
        "discounts": [
          {
            "due": "2024-11-25T17:59:26+00:00",
            "percentage": 10.5
          },
          {
            "due": "2024-11-29T17:59:26+00:00",
            "percentage": 5
          }
        ],
        "due": "2024-11-30T02:06:26.249976+00:00",
        "expiration": 1,
        "fee": 0,
        "fine": 2.5,
        "fineAmount": 0,
        "id": "5807638394699776",
        "interest": 1.3,
        "interestAmount": 0,
        "link": "https://starkv2.sandbox.starkbank.com/invoicelink/ee87e7ce19544b11be5a6de65b97091a",
        "name": "Iron Bank S.A.",
        "nominalAmount": 10000,
        "pdf": "https://sandbox.api.starkbank.com/v2/invoice/ee87e7ce19544b11be5a6de65b97091a.pdf",
        "rules": [],
        "splits": [],
        "status": "paid",
        "tags": [
          "customer/123",
          "order/567"
        ],
        "taxId": "20.018.183/0001-80",
        "transactionIds": ["5244688441278464"],
        "updated": "2024-01-31T21:15:16.852309+00:00"
      },
    },
  }
}