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.Here is the Invoice log flow, offering a clear and organized perspective of the various stages through which an invoice can go:invoice-logA paid invoice can be partially or fully reversed to its payer. Multiple reversals can be made for the same invoice, and each time, the following log flow will occur:invoice-log-reversal

RESOURCE SUMMARY
Invoice Creation
Generate a customized Invoice
Invoice Update
Update an Invoice
Invoice Consulting
Details about the Invoice payment, enhancing the clarity and completeness of the transaction
Split Receiver
Add information regarding the payment beneficiary

Setup in Sandbox/Production

For each environment:1. Create an account at Stark Bank.2. Create asynchronous Webhook subscriptions to receive update Events. Register an URL using the POST Webhook route to receive Events about the following resources:  2.1 Invoice: Creation and updates of Invoices

Creating Invoices

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.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 in step 7 or use the rules parameter in the creation of the Invoice in step 2.Required parameters to create an InvoiceIn 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 at 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 {
            panic(fmt.Sprintf("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 {
            panic(fmt.Sprintf("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 {
            panic(fmt.Sprintf("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 {
            panic(fmt.Sprintf("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"
        }
    ]
}
  

Creating Invoice with Split

It enables you to split the payment of an invoice among multiple receivers based on criteria such as settlement date, amount, and predefined rules.To execute this operation, please follow the steps outlined below:Setup the Split Profile Split Profile is the set of rules that will define the behavior of transferring funds from the client's account to the Receivers.Two behaviors are essential for the transfer to occur:IntervalIt is the period during which the transfer of funds from the Workspace to the receiver's destination account will be conducted.You can choose from four methods to execute the interval:DelayIt is the period during which the value will be "retained" in the main Workspace until it is transferred to the receiver's destination account.The Delay is configured by the client, allowing it to determine how long the value should be "retained" before the transfer occurs.For clients who do not configure the Split Profile rules for interval and delay as desired, by default, the Payment Split will have the following properties:Interval - monthlyDelay - 7 days

The setup of Receivers involves adding information regarding the payment beneficiary.

Python


  import starkbank
  
  receiver = starkbank.splitreceiver.create(
        receiver=starkbank.SplitReceiver(
          name="Daenerys Targaryen Stormborn",
          tax_id="594.739.480-42",
          bank_code="341",
          branch_code="2201",
          account_number="76543-8",
          account_type="salary"
      )
  )
  
  print(receiver)  

Javascript


  Not yet available. Please contact us if you need this SDK.
    

PHP


  Not yet available. Please contact us if you need this SDK.
    

Java


  import com.starkbank.*;
  import java.util.Map;
  import java.util.List;
  import java.util.HashMap;
  import java.util.ArrayList;
  
  Map<String, Object> data = new HashMap<>();
  data.put("name", "Daenerys Targaryen Stormborn");
  data.put("taxId", "594.739.480-42");
  data.put("bankCode", "341");
  data.put("branchCode", "2201");
  data.put("accountNumber", "76543-8");
  data.put("accountType", "salary");
  
  SplitReceiver receiver = SplitReceiver.create(new SplitReceiver(data));
  
  System.out.println(receiver);  

Ruby


  Not yet available. Please contact us if you need this SDK.
    

Elixir


  Not yet available. Please contact us if you need this SDK.
    

C#


  Not yet available. Please contact us if you need this SDK.
    

Go


  Not yet available. Please contact us if you need this SDK.
    

Clojure


  Not yet available. Please contact us if you need this SDK.
    

Curl


  curl --location --request POST '{{baseUrl}}/v2/split-receiver' 
  --header 'Access-Id: {{accessId}}' 
  --header 'Access-Time: {{accessTime}}' 
  --header 'Access-Signature: {{accessSignature}}' 
  --header 'Content-Type: application/json' 
  --data-raw '{
      "receivers": [
          {
              "name": "Daenerys Targaryen Stormborn",
              "taxId": "594.739.480-42",
              "bankCode": "341",
              "branchCode": "2201",
              "accountNumber": "76543-8",
              "accountType": "salary"
          }
      ]
  }'
    
Response

Python


  SplitReceiver(
      account_number=76543-8,
      account_type=salary,
      bank_code=341,
      branch_code=2201,
      created=2024-01-30 20:17:12.586145,
      id=5710191014182912,
      name=Daenerys Targaryen Stormborn,
      status=created,
      tags=[],
      tax_id=594.739.480-42,
      updated=2024-01-30 20:17:12.586152
  )
    

Javascript


  Not yet available. Please contact us if you need this SDK.
          

PHP


  Not yet available. Please contact us if you need this SDK.
    

Java


  SplitReceiver({
      "accountNumber": 76543-8,
      "accountType": salary,
      "bankCode": 341,
      "branchCode": 2201,
      "created": 2024-01-30 20:17:12.586145,
      "id": 5710191014182912,
      "name": Daenerys Targaryen Stormborn,
      "status": created,
      "tags": [],
      "taxId": 594.739.480-42,
      "updated": 2024-01-30 20:17:12.586152
  })
    

Ruby


  Not yet available. Please contact us if you need this SDK.
    

Elixir


  Not yet available. Please contact us if you need this SDK.
    

C#


  Not yet available. Please contact us if you need this SDK.
    

Go


  Not yet available. Please contact us if you need this SDK.
    

Clojure


  Not yet available. Please contact us if you need this SDK.
    

Curl


  {
      "receivers": [
          {
              "accountNumber": "76543-8",
              "accountType": "salary",
              "bankCode": "341",
              "branchCode": "2201",
              "created": "2024-01-30T20:32:56.182031+00:00",
              "id": "5642933638266880",
              "name": "Daenerys Targaryen Stormborn",
              "status": "created",
              "tags": [],
              "taxId": "594.739.480-42",
              "updated": "2024-01-30T20:32:56.182039+00:00"
          }
      ]
  }
    

Generate the InvoiceOnce you have completed that step, you can generate an invoice by including the Split parameter along with the receiver ID, as demonstrated in the following example:For each party involved in the transaction, their respective receiver ID must be included, along with the amount to be sent. Therefore, if there are 3 parties in a transaction, three Receiver IDs should be sent, each with its corresponding Amount.

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)}],
        due=datetime(2021, 5, 12, 15, 23, 26, 689377),
        expiration=123456789,
        fine=2.5,
        interest=1.3,
        name="Arya Stark",
        tags=['War supply', 'Invoice #1234'],
        tax_id="012.345.678-90",
        rules=[
            {
                'key': 'allowedTaxIds',
                'value': [
                    '012.345.678-90',
                    '45.059.493/0001-73'
                ]
            }
        ],
        splits=[
            Split(amount=3000, receiverId="5742447426535424"), Split(amount=5000, receiverId="5743243941642240")
        ]
    )
])

for invoice in invoices:
    print(invoice)
  

Javascript


    Not yet available. Please contact us if you need this SDK.

PHP


    Not yet available. Please contact us if you need this SDK.

Java


    Not yet available. Please contact us if you need this SDK.

Ruby


    Not yet available. Please contact us if you need this SDK.

Elixir


    Not yet available. Please contact us if you need this SDK.

C#


    Not yet available. Please contact us if you need this SDK.

Go


    Not yet available. Please contact us if you need this SDK.

Clojure


    Not yet available. Please contact us if you need this SDK.

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,
                "tags": [
                    "War supply",
                    "Invoice #1234"
                ]
                "descriptions": [
                    {
                        "key": "Arya",
                        "value": "Not today"
                    }
                ],
                "rules": [
                    {
                        "key": "allowedTaxIds",
                        "value": [
                            "012.345.678-90",
                            "45.059.493/0001-73"
                        ]
                    }
                ],
                "discounts": [
                    {
                        "percentage": 10,
                        "due": "2021-03-12T17:59:26.000000+00:00"
                    }
                ],
                "splits": [
                    {
                        "receiverId": "5742447426535424",
                        "amount": 3000
                    },
                    {
                        "receiverId": "5743243941642240",
                        "amount": 5000
                    }
                ]
            }
        ]
    }
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,
    splits=[
        Split(
            amount=3000,
            created=None,
            external_id=None,
            id=None,
            receiver_id=5742447426535424,
            scheduled=None,
            source=None,
            status=None,
            tags=None,
            updated=None
        ),
        Split(
            amount=5000,
            created=None,
            external_id=None,
            id=None,
            receiver_id=5743243941642240,
            scheduled=None,
            source=None,
            status=None,
            tags=None,
            updated=None
        )
    ]
)
  

Javascript


    Not yet available. Please contact us if you need this SDK.

PHP


    Not yet available. Please contact us if you need this SDK.

Java


    Not yet available. Please contact us if you need this SDK.

Ruby


    Not yet available. Please contact us if you need this SDK.

Elixir


    Not yet available. Please contact us if you need this SDK.

C#


    Not yet available. Please contact us if you need this SDK.

Go


    Not yet available. Please contact us if you need this SDK.

Clojure


    Not yet available. Please contact us if you need this SDK.

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": [
                {
                    "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",
            "splits": [
                {
                    "amount": 3000,
                    "receiverId": "5742447426535424",
                ),
                {
                    "amount": 5000,
                    "receiverId": "5743243941642240",
                }
            ]
        }
    ]
}
  

Consulting Invoices

Is it possible to retrieve an invoice by its ID or even list them using parameters 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"
    "github.com/starkbank/sdk-go/starkbank/invoice"
)

func main() {

    var params = map[string]interface{}{}
    params["after"] = "2020-10-01"
    params["before"] = "2020-10-30"

    invoices := invoice.Query(params, nil)

    for invoice := range invoices {
        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 InvoiceTo 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", 
    status="canceled", 
    amount=12345,
    expiration=98765
)

print(updated_invoice)
  

Javascript


const starkbank = require('starkbank');

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

PHP


use StarkBank\Invoice;

$updateInvoice = Invoice::update(
    "4600131349381120",
    [
        "status" => "canceled"
        "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', 
    status: 'canceled',
    amount: 12345,
    expiration: 98765,
)

puts invoice
  

Elixir


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

C#


StarkBank.Invoice invoice = StarkBank.Invoice.Update(
    "4600131349381120",
    status: "canceled",
    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["status"] = "canceled"
    patchData["amount"] = 12345
    patchData["expiration"] = 98765

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

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

Clojure


(def invoice (starkbank.invoice/update "4600131349381120" {:amount 12345 :expiration 98765 :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",
    "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=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: 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: '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] => 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] => 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");
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: canceled,
    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: "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: 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: canceled,
    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: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 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 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": 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",
    }
}
  

Receiving Invoice Webhook

Listen to Invoice WebhooksAfter 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.

Python


    import starkbank
    
    
    request = listen()  # this is the method you made to get the events posted to your Webhook endpoint
    
    event = starkbank.event.parse(
        content=request.data.decode("utf-8"),
        signature=request.headers["Digital-Signature"],
    )
    
    if "invoice" in event.subscription:
        print(event.log.request)
        

Javascript


    const starkbank = require('starkbank');
    const express = require('express')
    const app = express()
    
    app.use(express.raw({type: "*/*"}));
    
    const port = 3000
    app.get('/', async (req, res) => {
        try {
            let event = await starkbank.event.parse({
                content: req.body.toString(),
                signature: req.headers['Digital-Signature']
            });
            if (event.subscription === 'invoice') {
                console.log(event.log.request);
            }
            res.end()
        }
        catch (err) {
            console.log(err)
            res.status(400).end()
        }
    })
    app.listen(port, () => console.log('Example app listening at http://localhost:{port}'))
        

PHP


    use StarkBank\Event;
    
    
    $response = listen()  # this is the method you made to get the events posted to your Webhook
    
    $event = Event::parse(
        $response->content, 
        $response->headers["Digital-Signature"]
    );
    
    if ($event->subscription == "invoice"){
        print_r($event->log->request);
        

Java


    import com.starkbank.*;
    
    
    Request request = Listener.listen(); // this is the method you made to get the events posted to your Webhook
    
    String content = request.content.toString();
    String signature = request.headers.get("Digital-Signature");
    
    Event event = Event.parse(content, signature);
    if(event.subscription == "invoice"){) {
        Invoice.Log log = ((Event.Invoice) event).log;
        System.out.println(log.request);
    }
        

Ruby


    require('starkbank')
    
    
    request = listen()  # this is the method you made to get the events posted to your Webhook
    
    event = StarkBank::Event.parse(
        content: request.body.read, 
        signature: request.headers['Digital-Signature']
    )
    
    if event.subscription == 'invoice'
        puts event.log.request
    end
        

Elixir


    response = listen()  # this is the function you made to get the events posted to your Webhook
    
    {event, cache_pid} = StarkBank.Event.parse!(
        content: response.content,
        signature: response.headers["Digital-Signature"]
    ) |> IO.inspect
        

C#


    using System;
    
    
    Response response = listen();  // this is the method you made to get the events posted to your Webhook endpoint
    
    StarkBank.Event parsedEvent = StarkBank.Event.Parse(
        content: response.Content,
        signature: response.Headers["Digital-Signature"]
    );
    
    if (parsedEvent.Subscription == "invoice") {
        StarkBank.Invoice.Log log = invoice.Log as StarkBank.Invoice.Log;
        Console.WriteLine(log.request);
    }
        

Go


                

Clojure


                

Curl


                

2.1. Credited Webhook Example

Python


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Javascript


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

PHP


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Java


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Ruby


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Elixir


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

C#


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Go


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Clojure


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Curl


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "credited"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

2.2 Canceled Webhook Example

Python


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Javascript


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

PHP


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Java


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Ruby


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Elixir


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

C#


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Go


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Clojure


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Curl


        {
            "event": {
                "created": "2024-01-31T21:15:17.463956+00:00",
                "id": "6046987522670592",
                "log": {
                "created": "2024-01-31T21:15:16.852263+00:00",
                "errors": [],
                "id": "5244688441278464",
                "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": "canceled",
                    "tags": [
                    "war supply",
                    "invoice #1234"
                    ],
                    "taxId": "20.018.183/0001-80",
                    "transactionIds": [],
                    "updated": "2024-01-31T21:15:16.852309+00:00"
                },
                "type": "canceled"
                },
                "subscription": "invoice",
                "workspaceId": "6341320293482496"
            }
        }
        

Consulting Split

Once an invoice with Split is created, a Split entity is also generated. It is possible to retrieve it by its ID or list them using parameters such as limit, after, before to filter the results, as shown in the example below:

Python


  import starkbank
  
  splits = starkbank.split.query(
      after="2024-01-30",
      before="2024-02-01",
      limit=1
  )
  
  for split in splits:
      print(split)
    

Javascript


  Not yet available. Please contact us if you need this SDK.
    

PHP


  Not yet available. Please contact us if you need this SDK.
    

Java


  import com.starkbank.*;
  import java.util.Map;
  import java.util.HashMap;
  
  Map params = new HashMap<>();
  params.put("limit", 1);
  
  Generator splits = Split.query(params);
  
  for (Split split : splits) {
      System.out.println(split);
  }
    

Ruby


  Not yet available. Please contact us if you need this SDK.
    

Elixir


  Not yet available. Please contact us if you need this SDK.
    

C#


  Not yet available. Please contact us if you need this SDK.
    

Go


  Not yet available. Please contact us if you need this SDK.
    

Clojure


  Not yet available. Please contact us if you need this SDK.
    

Curl


  curl --location --request GET '{{baseUrl}}/v2/split?after=2024-01-30&before=2024-02-01' 
  --header 'Access-Id: {{accessId}}' 
  --header 'Access-Time: {{accessTime}}' 
  --header 'Access-Signature: {{accessSignature}}'
    
Response

Python


  Split(
      amount=10000,
      created=2024-01-30 16:10:59.874663,
      external_id=invoice/5163468596445184/receiver/5143677177430016,
      id=5745664021495808,
      receiver_id=5143677177430016,
      scheduled=2024-01-30 16:10:59.840821,
      source=invoice/5163468596445184,
      status=created,
      tags=['invoice/5163468596445184'],
      updated=2024-01-30 16:21:03.973723
  )  

Javascript


  Not yet available. Please contact us if you need this SDK.
    

PHP


  Not yet available. Please contact us if you need this SDK.
    

Java


  Split({
      "amount": 10000,
      "created": "2024-01-30 16:10:59.874824",
      "external_id": invoice/5163468596445184/receiver/5706627130851328,
      "id": 5182714068074496,
      "receiver_id": 5706627130851328,
      "scheduled": "2024-01-30 16:10:59.840821",
      "source": invoice/5163468596445184,
      "status": created,
      "tags": ['invoice/5163468596445184'],
      "updated": 2024-01-30 16:10:59.874829
  })
    

Ruby


  Not yet available. Please contact us if you need this SDK.
    

Elixir


  Not yet available. Please contact us if you need this SDK.
    

C#


  Not yet available. Please contact us if you need this SDK.
    

Go


  Not yet available. Please contact us if you need this SDK.
    

Clojure


  Not yet available. Please contact us if you need this SDK.
    

Curl


  {
      "cursor": null,
      "splits": [
          {
              "amount": 10000,
              "created": "2023-10-23T23:40:04.809130+00:00",
              "externalId": "invoice/6394476721340416/receiver/5644004762845184",
              "id": "5714489739575296",
              "receiverId": "5644004762845184",
              "scheduled": "2023-11-01T10:00:00+00:00",
              "source": "invoice/6394476721340416",
              "status": "success",
              "tags": [],
              "updated": "2023-11-01T09:51:02.985959+00:00"
          }
      ]
  }