Lending (Credit Note)

Issue your own credit operations as Bank Credit Bills (Cédula de Crédito Bancário — CCB) through Stark Infra.

Each CCB is a legally binding loan agreement digitally signed by the borrower and the signers. Stark Infra handles invoice generation, contract signing, payment tracking and disbursement, so you can focus on credit decisions and customer acquisition.

Before disbursing, you may want to evaluate the borrower's credit profile with Credit Holmes — Stark's bureau-backed risk-analysis report — and compute the loan schedule with the preview endpoint.

NOTE: Read Core Concepts before continuing this guide.

RESOURCE SUMMARY
Generate credit analysis reports backed by official bureaus.
Simulate the installment schedule and total cost of a CCB.
Track everyone who must sign the contract and resend signing links.
Create the legally binding CCB and trigger the signing flow.

Setup

1. Reach out to Stark Infra to enable the Lending product on your workspace.

2. Create a Webhook resource subscribing to credit-note and credit-holmes events.

3. Optionally pre-fund the lending balance with a Pix Request so disbursements run immediately when contracts are signed.

Typical flow

1. (Optional) Issue a Credit Holmes report to check the borrower's credit profile.

2. Compute the installment schedule with the Credit Preview endpoint.

3. Create the Credit Note, informing the borrower, the signers, the installment invoices and the disbursement account. Each signer receives a link to sign the contract digitally.

4. Once signed, Stark Infra disburses the loan via Pix to the borrower's account and tracks every installment payment through invoices.

Credit Holmes Overview

CreditHolmes are used to request the credit analysis of a tax ID.

The analysis retrieves credit information from official sources for a given CPF or CNPJ, helping you evaluate the creditworthiness of a borrower.

The CreditHolmes object

Attributes

id STRING

Unique id for the credit holmes.

taxId STRING

CPF or CNPJ of the entity to be analyzed.

competence STRING

Month and year of the credit analysis in YYYY-MM format. Example: "2022-06".

status STRING

Current status of the credit analysis. Options: "created", "solved", "failed".

result OBJECT

Credit analysis result containing financial and credit data for the tax ID.

tags LIST OF STRINGS

Tags associated with the credit holmes.

created STRING

Creation datetime. Example: "2022-01-01T00:00:00.000000+00:00".

updated STRING

Last update datetime. Example: "2022-01-01T00:00:00.000000+00:00".

Create Credit Holmes

Create credit holmes requests to analyze the credit profile of a tax ID.

You can create up to 100 requests in a single call.

ENDPOINT
POST /v2/credit-holmes
REQUEST

Python

import starkinfra

holmes = starkinfra.creditholmes.create([
    starkinfra.CreditHolmes(
        tax_id="012.345.678-90",
        competence="2022-06",
        tags=["credit-analysis"]
    )
])

for sherlock in holmes:
    print(sherlock)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let holmes = await starkinfra.creditHolmes.create([
        {
            taxId: '012.345.678-90',
            competence: '2022-06',
            tags: ['credit-analysis']
        }
    ]);

    for (let sherlock of holmes) {
        console.log(sherlock);
    }
})();
  

PHP

$holmes = StarkInfra\CreditHolmes::create([
    new StarkInfra\CreditHolmes([
        "taxId" => "012.345.678-90",
        "competence" => "2022-06",
        "tags" => ["credit-analysis"]
    ])
]);

foreach ($holmes as $sherlock) {
    print_r($sherlock);
}
  

Java

import com.starkinfra.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

List<CreditHolmes> holmes = new ArrayList<>();
holmes.add(new CreditHolmes.Builder()
    .taxId("012.345.678-90")
    .competence("2022-06")
    .tags(Arrays.asList("credit-analysis"))
    .build()
);

List<CreditHolmes> response = CreditHolmes.create(holmes);

for (CreditHolmes sherlock : response) {
    System.out.println(sherlock);
}
  

Ruby

require('starkinfra')

holmes = StarkInfra::CreditHolmes.create([
    StarkInfra::CreditHolmes.new(
        tax_id: "012.345.678-90",
        competence: "2022-06",
        tags: ["credit-analysis"]
    )
])

holmes.each do |sherlock|
    puts sherlock
end
  

Elixir

holmes = StarkInfra.CreditHolmes.create!([
    %StarkInfra.CreditHolmes{
        tax_id: "012.345.678-90",
        competence: "2022-06",
        tags: ["credit-analysis"]
    }
])

for sherlock <- holmes do
    sherlock |> IO.inspect
end
  

C#

using System;
using System.Collections.Generic;

List<StarkInfra.CreditHolmes> holmes = StarkInfra.CreditHolmes.Create(
    new List<StarkInfra.CreditHolmes> {
        new StarkInfra.CreditHolmes(
            taxId: "012.345.678-90",
            competence: "2022-06",
            tags: new List<string> { "credit-analysis" }
        )
    }
);

foreach (StarkInfra.CreditHolmes sherlock in holmes) {
    Console.WriteLine(sherlock);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditholmes"
)

func main() {

    holmes, err := creditholmes.Create(
        []creditholmes.CreditHolmes{
            {
                TaxId:      "012.345.678-90",
                Competence: "2022-06",
                Tags:       []string{"credit-analysis"},
            },
        },
        nil,
    )
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def holmes
    (starkinfra/credit-holmes-create
        [{:tax-id "012.345.678-90"
          :competence "2022-06"
          :tags ["credit-analysis"]}]))

(dorun (map println holmes))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/credit-holmes' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "holmes": [
        {
            "taxId": "012.345.678-90",
            "competence": "2022-06",
            "tags": ["credit-analysis"]
        }
    ]
}'
  
RESPONSE

Python

CreditHolmes(
    id=5719405850615809,
    tax_id=012.345.678-90,
    competence=2022-06,
    status=created,
    result=None,
    tags=['credit-analysis'],
    created=2022-06-01T00:00:00.000000+00:00,
    updated=2022-06-01T00:00:00.000000+00:00
)
  

Javascript

CreditHolmes {
    id: '5719405850615809',
    taxId: '012.345.678-90',
    competence: '2022-06',
    status: 'created',
    result: null,
    tags: [ 'credit-analysis' ],
    created: '2022-06-01T00:00:00.000000+00:00',
    updated: '2022-06-01T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditHolmes Object
(
    [id] => 5719405850615809
    [taxId] => 012.345.678-90
    [competence] => 2022-06
    [status] => created
    [result] =>
    [tags] => Array ( [0] => credit-analysis )
    [created] => 2022-06-01T00:00:00.000000+00:00
    [updated] => 2022-06-01T00:00:00.000000+00:00
)
  

Java

CreditHolmes({
    "id": "5719405850615809",
    "taxId": "012.345.678-90",
    "competence": "2022-06",
    "status": "created",
    "result": null,
    "tags": ["credit-analysis"],
    "created": "2022-06-01T00:00:00.000000+00:00",
    "updated": "2022-06-01T00:00:00.000000+00:00"
})
  

Ruby

credit_holmes(
    id: 5719405850615809,
    tax_id: 012.345.678-90,
    competence: 2022-06,
    status: created,
    result: nil,
    tags: ["credit-analysis"],
    created: 2022-06-01T00:00:00.000000+00:00,
    updated: 2022-06-01T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditHolmes{
    id: "5719405850615809",
    tax_id: "012.345.678-90",
    competence: "2022-06",
    status: "created",
    result: nil,
    tags: ["credit-analysis"],
    created: "2022-06-01T00:00:00.000000+00:00",
    updated: "2022-06-01T00:00:00.000000+00:00"
}
  

C#

CreditHolmes(
    Id: 5719405850615809,
    TaxId: 012.345.678-90,
    Competence: 2022-06,
    Status: created,
    Result: null,
    Tags: [ credit-analysis ],
    Created: 2022-06-01T00:00:00.000000+00:00,
    Updated: 2022-06-01T00:00:00.000000+00:00
)
  

Go

{
    Id:5719405850615809
    TaxId:012.345.678-90
    Competence:2022-06
    Status:created
    Result:map[]
    Tags:[credit-analysis]
    Created:2022-06-01T00:00:00.000000+00:00
    Updated:2022-06-01T00:00:00.000000+00:00
}
  

Clojure

{:id "5719405850615809",
 :tax-id "012.345.678-90",
 :competence "2022-06",
 :status "created",
 :result nil,
 :tags ["credit-analysis"],
 :created "2022-06-01T00:00:00.000000+00:00",
 :updated "2022-06-01T00:00:00.000000+00:00"}
  

Curl

{
    "holmes": [
        {
            "id": "5719405850615809",
            "taxId": "012.345.678-90",
            "competence": "2022-06",
            "status": "created",
            "result": null,
            "tags": ["credit-analysis"],
            "created": "2022-06-01T00:00:00.000000+00:00",
            "updated": "2022-06-01T00:00:00.000000+00:00"
        }
    ]
}
  

List Credit Holmes

List and filter all credit holmes requests in your workspace. Results are returned paged.

ENDPOINT
GET /v2/credit-holmes
REQUEST

Python

import starkinfra

holmes = starkinfra.creditholmes.query(limit=10)

for sherlock in holmes:
    print(sherlock)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let holmes = await starkinfra.creditHolmes.query({ limit: 10 });

    for await (let sherlock of holmes) {
        console.log(sherlock);
    }
})();
  

PHP

$holmes = StarkInfra\CreditHolmes::query(["limit" => 10]);

foreach ($holmes as $sherlock) {
    print_r($sherlock);
}
  

Java

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

HashMap<String, Object> params = new HashMap<>();
params.put("limit", 10);
Generator<CreditHolmes> holmes = CreditHolmes.query(params);

for (CreditHolmes sherlock : holmes) {
    System.out.println(sherlock);
}
  

Ruby

require('starkinfra')

holmes = StarkInfra::CreditHolmes.query(limit: 10)

holmes.each do |sherlock|
    puts sherlock
end
  

Elixir

holmes = StarkInfra.CreditHolmes.query!(limit: 10)

for sherlock <- holmes do
    sherlock |> IO.inspect
end
  

C#

using System;
using System.Collections.Generic;

IEnumerable<StarkInfra.CreditHolmes> holmes = StarkInfra.CreditHolmes.Query(limit: 10);

foreach (StarkInfra.CreditHolmes sherlock in holmes) {
    Console.WriteLine(sherlock);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditholmes"
)

func main() {

    var params = map[string]interface{}{}
    params["limit"] = 10

    holmes, errorChannel := creditholmes.Query(params, nil)

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

Clojure

(def holmes (starkinfra.credit-holmes/query {:limit 10}))
(dorun (map println holmes))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-holmes?limit=10' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

CreditHolmes(
    id=5719405850615809,
    tax_id=012.345.678-90,
    competence=2022-06,
    status=solved,
    result={...},
    tags=['credit-analysis'],
    created=2022-06-01T00:00:00.000000+00:00,
    updated=2022-06-01T00:00:00.000000+00:00
)
  

Javascript

CreditHolmes {
    id: '5719405850615809',
    taxId: '012.345.678-90',
    competence: '2022-06',
    status: 'solved',
    result: { ... },
    tags: [ 'credit-analysis' ],
    created: '2022-06-01T00:00:00.000000+00:00',
    updated: '2022-06-01T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditHolmes Object
(
    [id] => 5719405850615809
    [taxId] => 012.345.678-90
    [competence] => 2022-06
    [status] => solved
    [result] => Array ( ... )
    [tags] => Array ( [0] => credit-analysis )
    [created] => 2022-06-01T00:00:00.000000+00:00
    [updated] => 2022-06-01T00:00:00.000000+00:00
)
  

Java

CreditHolmes({
    "id": "5719405850615809",
    "taxId": "012.345.678-90",
    "competence": "2022-06",
    "status": "solved",
    "result": {...},
    "tags": ["credit-analysis"],
    "created": "2022-06-01T00:00:00.000000+00:00",
    "updated": "2022-06-01T00:00:00.000000+00:00"
})
  

Ruby

credit_holmes(
    id: 5719405850615809,
    tax_id: 012.345.678-90,
    competence: 2022-06,
    status: solved,
    result: {...},
    tags: ["credit-analysis"],
    created: 2022-06-01T00:00:00.000000+00:00,
    updated: 2022-06-01T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditHolmes{
    id: "5719405850615809",
    tax_id: "012.345.678-90",
    competence: "2022-06",
    status: "solved",
    result: %{...},
    tags: ["credit-analysis"],
    created: "2022-06-01T00:00:00.000000+00:00",
    updated: "2022-06-01T00:00:00.000000+00:00"
}
  

C#

CreditHolmes(
    Id: 5719405850615809,
    TaxId: 012.345.678-90,
    Competence: 2022-06,
    Status: solved,
    Result: {...},
    Tags: [ credit-analysis ],
    Created: 2022-06-01T00:00:00.000000+00:00,
    Updated: 2022-06-01T00:00:00.000000+00:00
)
  

Go

{
    Id:5719405850615809
    TaxId:012.345.678-90
    Competence:2022-06
    Status:solved
    Result:map[...]
    Tags:[credit-analysis]
    Created:2022-06-01T00:00:00.000000+00:00
    Updated:2022-06-01T00:00:00.000000+00:00
}
  

Clojure

{:id "5719405850615809",
 :tax-id "012.345.678-90",
 :competence "2022-06",
 :status "solved",
 :result {...},
 :tags ["credit-analysis"],
 :created "2022-06-01T00:00:00.000000+00:00",
 :updated "2022-06-01T00:00:00.000000+00:00"}
  

Curl

{
    "cursor": null,
    "holmes": [
        {
            "id": "5719405850615809",
            "taxId": "012.345.678-90",
            "competence": "2022-06",
            "status": "solved",
            "result": {},
            "tags": ["credit-analysis"],
            "created": "2022-06-01T00:00:00.000000+00:00",
            "updated": "2022-06-01T00:00:00.000000+00:00"
        }
    ]
}
  

Get a Credit Holmes

Get a single credit holmes by its id.

ENDPOINT
GET /v2/credit-holmes/:id
REQUEST

Python

import starkinfra

sherlock = starkinfra.creditholmes.get("5719405850615809")

print(sherlock)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let sherlock = await starkinfra.creditHolmes.get('5719405850615809');
    console.log(sherlock);
})();
  

PHP

$sherlock = StarkInfra\CreditHolmes::get("5719405850615809");

print_r($sherlock);
  

Java

import com.starkinfra.*;

CreditHolmes sherlock = CreditHolmes.get("5719405850615809");

System.out.println(sherlock);
  

Ruby

require('starkinfra')

sherlock = StarkInfra::CreditHolmes.get('5719405850615809')

puts sherlock
  

Elixir

sherlock = StarkInfra.CreditHolmes.get!("5719405850615809")

sherlock |> IO.inspect
  

C#

using System;

StarkInfra.CreditHolmes sherlock = StarkInfra.CreditHolmes.Get("5719405850615809");

Console.WriteLine(sherlock);
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditholmes"
)

func main() {

    sherlock, err := creditholmes.Get("5719405850615809", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def sherlock (starkinfra.credit-holmes/get "5719405850615809"))
(println sherlock)
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-holmes/5719405850615809' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

CreditHolmes(
    id=5719405850615809,
    tax_id=012.345.678-90,
    competence=2022-06,
    status=solved,
    result={...},
    tags=['credit-analysis'],
    created=2022-06-01T00:00:00.000000+00:00,
    updated=2022-06-01T00:00:00.000000+00:00
)
  

Javascript

CreditHolmes {
    id: '5719405850615809',
    taxId: '012.345.678-90',
    competence: '2022-06',
    status: 'solved',
    result: { ... },
    tags: [ 'credit-analysis' ],
    created: '2022-06-01T00:00:00.000000+00:00',
    updated: '2022-06-01T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditHolmes Object
(
    [id] => 5719405850615809
    [taxId] => 012.345.678-90
    [competence] => 2022-06
    [status] => solved
    [result] => Array ( ... )
    [tags] => Array ( [0] => credit-analysis )
    [created] => 2022-06-01T00:00:00.000000+00:00
    [updated] => 2022-06-01T00:00:00.000000+00:00
)
  

Java

CreditHolmes({
    "id": "5719405850615809",
    "taxId": "012.345.678-90",
    "competence": "2022-06",
    "status": "solved",
    "result": {...},
    "tags": ["credit-analysis"],
    "created": "2022-06-01T00:00:00.000000+00:00",
    "updated": "2022-06-01T00:00:00.000000+00:00"
})
  

Ruby

credit_holmes(
    id: 5719405850615809,
    tax_id: 012.345.678-90,
    competence: 2022-06,
    status: solved,
    result: {...},
    tags: ["credit-analysis"],
    created: 2022-06-01T00:00:00.000000+00:00,
    updated: 2022-06-01T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditHolmes{
    id: "5719405850615809",
    tax_id: "012.345.678-90",
    competence: "2022-06",
    status: "solved",
    result: %{...},
    tags: ["credit-analysis"],
    created: "2022-06-01T00:00:00.000000+00:00",
    updated: "2022-06-01T00:00:00.000000+00:00"
}
  

C#

CreditHolmes(
    Id: 5719405850615809,
    TaxId: 012.345.678-90,
    Competence: 2022-06,
    Status: solved,
    Result: {...},
    Tags: [ credit-analysis ],
    Created: 2022-06-01T00:00:00.000000+00:00,
    Updated: 2022-06-01T00:00:00.000000+00:00
)
  

Go

{
    Id:5719405850615809
    TaxId:012.345.678-90
    Competence:2022-06
    Status:solved
    Result:map[...]
    Tags:[credit-analysis]
    Created:2022-06-01T00:00:00.000000+00:00
    Updated:2022-06-01T00:00:00.000000+00:00
}
  

Clojure

{:id "5719405850615809",
 :tax-id "012.345.678-90",
 :competence "2022-06",
 :status "solved",
 :result {...},
 :tags ["credit-analysis"],
 :created "2022-06-01T00:00:00.000000+00:00",
 :updated "2022-06-01T00:00:00.000000+00:00"}
  

Curl

{
    "holmes": {
        "id": "5719405850615809",
        "taxId": "012.345.678-90",
        "competence": "2022-06",
        "status": "solved",
        "result": {},
        "tags": ["credit-analysis"],
        "created": "2022-06-01T00:00:00.000000+00:00",
        "updated": "2022-06-01T00:00:00.000000+00:00"
    }
}
  

List Credit Holmes Logs

Get a paged list of all credit holmes logs. A log tracks a change in the credit holmes entity according to its life cycle.

ENDPOINT
GET /v2/credit-holmes/log
REQUEST

Python

import starkinfra

logs = starkinfra.creditholmes.log.query(limit=10)

for log in logs:
    print(log)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let logs = await starkinfra.creditHolmes.log.query({ limit: 10 });

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

PHP

$logs = StarkInfra\CreditHolmes\Log::query(["limit" => 10]);

foreach ($logs as $log) {
    print_r($log);
}
  

Java

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

HashMap<String, Object> params = new HashMap<>();
params.put("limit", 10);
Generator<CreditHolmes.Log> logs = CreditHolmes.Log.query(params);

for (CreditHolmes.Log log : logs) {
    System.out.println(log);
}
  

Ruby

require('starkinfra')

logs = StarkInfra::CreditHolmes::Log.query(limit: 10)

logs.each do |log|
    puts log
end
  

Elixir

logs = StarkInfra.CreditHolmes.Log.query!(limit: 10)

for log <- logs do
    log |> IO.inspect
end
  

C#

using System;
using System.Collections.Generic;

IEnumerable<StarkInfra.CreditHolmes.Log> logs = StarkInfra.CreditHolmes.Log.Query(limit: 10);

foreach (StarkInfra.CreditHolmes.Log log in logs) {
    Console.WriteLine(log);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditholmes/log"
)

func main() {

    var params = map[string]interface{}{}
    params["limit"] = 10

    logs, errorChannel := log.Query(params, nil)

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

Clojure

(def logs (starkinfra.credit-holmes.log/query {:limit 10}))
(dorun (map println logs))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-holmes/log?limit=10' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

Log(
    id=5155165527080961,
    type=created,
    created=2022-06-01T00:00:00.000000+00:00,
    holmes=CreditHolmes(id=5719405850615809, status=created, ...)
)
  

Javascript

Log {
    id: '5155165527080961',
    type: 'created',
    created: '2022-06-01T00:00:00.000000+00:00',
    holmes: CreditHolmes { id: '5719405850615809', status: 'created' }
}
  

PHP

StarkInfra\CreditHolmes\Log Object
(
    [id] => 5155165527080961
    [type] => created
    [created] => 2022-06-01T00:00:00.000000+00:00
)
  

Java

Log({
    "id": "5155165527080961",
    "type": "created",
    "created": "2022-06-01T00:00:00.000000+00:00"
})
  

Ruby

log(
    id: 5155165527080961,
    type: created,
    created: 2022-06-01T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditHolmes.Log{
    id: "5155165527080961",
    type: "created",
    created: "2022-06-01T00:00:00.000000+00:00"
}
  

C#

Log(
    Id: 5155165527080961,
    Type: created,
    Created: 2022-06-01T00:00:00.000000+00:00
)
  

Go

{
    Id:5155165527080961
    Type:created
    Created:2022-06-01T00:00:00.000000+00:00
}
  

Clojure

{:id "5155165527080961",
 :type "created",
 :created "2022-06-01T00:00:00.000000+00:00"}
  

Curl

{
    "cursor": null,
    "logs": [
        {
            "id": "5155165527080961",
            "type": "created",
            "created": "2022-06-01T00:00:00.000000+00:00",
            "holmes": {
                "id": "5719405850615809",
                "status": "created"
            }
        }
    ]
}
  

Get a Credit Holmes Log

Get a single credit holmes log by its id.

ENDPOINT
GET /v2/credit-holmes/log/:id
REQUEST

Python

import starkinfra

log = starkinfra.creditholmes.log.get("5155165527080961")

print(log)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let log = await starkinfra.creditHolmes.log.get('5155165527080961');
    console.log(log);
})();
  

PHP

$log = StarkInfra\CreditHolmes\Log::get("5155165527080961");

print_r($log);
  

Java

import com.starkinfra.*;

CreditHolmes.Log log = CreditHolmes.Log.get("5155165527080961");

System.out.println(log);
  

Ruby

require('starkinfra')

log = StarkInfra::CreditHolmes::Log.get('5155165527080961')

puts log
  

Elixir

log = StarkInfra.CreditHolmes.Log.get!("5155165527080961")

log |> IO.inspect
  

C#

using System;

StarkInfra.CreditHolmes.Log log = StarkInfra.CreditHolmes.Log.Get("5155165527080961");

Console.WriteLine(log);
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditholmes/log"
)

func main() {

    creditHolmesLog, err := log.Get("5155165527080961", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def log (starkinfra.credit-holmes.log/get "5155165527080961"))
(println log)
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-holmes/log/5155165527080961' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

Log(
    id=5155165527080961,
    type=created,
    created=2022-06-01T00:00:00.000000+00:00,
    holmes=CreditHolmes(id=5719405850615809, status=created, ...)
)
  

Javascript

Log {
    id: '5155165527080961',
    type: 'created',
    created: '2022-06-01T00:00:00.000000+00:00',
    holmes: CreditHolmes { id: '5719405850615809', status: 'created' }
}
  

PHP

StarkInfra\CreditHolmes\Log Object
(
    [id] => 5155165527080961
    [type] => created
    [created] => 2022-06-01T00:00:00.000000+00:00
)
  

Java

Log({
    "id": "5155165527080961",
    "type": "created",
    "created": "2022-06-01T00:00:00.000000+00:00"
})
  

Ruby

log(
    id: 5155165527080961,
    type: created,
    created: 2022-06-01T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditHolmes.Log{
    id: "5155165527080961",
    type: "created",
    created: "2022-06-01T00:00:00.000000+00:00"
}
  

C#

Log(
    Id: 5155165527080961,
    Type: created,
    Created: 2022-06-01T00:00:00.000000+00:00
)
  

Go

{
    Id:5155165527080961
    Type:created
    Created:2022-06-01T00:00:00.000000+00:00
}
  

Clojure

{:id "5155165527080961",
 :type "created",
 :created "2022-06-01T00:00:00.000000+00:00"}
  

Curl

{
    "log": {
        "id": "5155165527080961",
        "type": "created",
        "created": "2022-06-01T00:00:00.000000+00:00",
        "holmes": {
            "id": "5719405850615809",
            "status": "created"
        }
    }
}
  

Credit Preview Overview

CreditPreviews are used to preview a credit operation before creating it.

You can simulate the installment schedule, the IOF tax amount, the disbursed amount and the effective interest rates of a Credit Note without persisting anything. Previews are computed on the fly and are not saved.

The CreditPreview object

Attributes

type STRING

Type of the credit preview. Options: "credit-note".

credit OBJECT

CreditNotePreview object with the simulation parameters and, in the response, the computed results.

Its "type" defines the amortization schedule: "sac" (constant amortization), "price" (fixed installments), "american" (periodic interest and principal at maturity), "bullet" (principal and interest at maturity) or "custom" (you provide the invoices and the rates are computed).

Input fields: "taxId", "scheduled" (disbursement datetime), "nominalInterest" (% per year), "initialDue" (first installment due datetime), "count" (number of installments), "initialAmount" (installment amount in cents), "interval" ("day", "week", "month", "quarter", "semester" or "year" - default "month"), "nominalAmount" or "amount" (in cents), "rebateAmount" and, for the "custom" type, "invoices" as {"amount", "due"} objects.

Computed fields returned: "amount" (net disbursed amount), "taxAmount" (IOF), "interest" (effective rate, % per year), "nominalInterest", "count", "initialDue", "initialAmount" and the full "invoices" schedule.

Create Credit Previews

Create credit previews to simulate credit notes before actually creating them. You can create up to 100 previews in a single request.

For the "sac" and "price" types, provide exactly one of "count" or "initialAmount" - the other one is computed. For all types except "custom", provide exactly one of "nominalAmount" or "amount".

ENDPOINT
POST /v2/credit-preview
REQUEST

Python

import starkinfra

previews = starkinfra.creditpreview.create([
    starkinfra.CreditPreview(
        type="credit-note",
        credit=starkinfra.creditpreview.CreditNotePreview(
            type="sac",
            nominal_amount=100000,
            nominal_interest=15.0,
            scheduled="2022-06-28",
            initial_due="2022-07-28",
            count=12,
            tax_id="012.345.678-90"
        )
    )
])

for preview in previews:
    print(preview)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let previews = await starkinfra.creditPreview.create([
        {
            type: 'credit-note',
            credit: {
                type: 'sac',
                nominalAmount: 100000,
                nominalInterest: 15.0,
                scheduled: '2022-06-28',
                initialDue: '2022-07-28',
                count: 12,
                taxId: '012.345.678-90'
            }
        }
    ]);

    for (let preview of previews) {
        console.log(preview);
    }
})();
  

PHP

$previews = StarkInfra\CreditPreview::create([
    new StarkInfra\CreditPreview([
        "type" => "credit-note",
        "credit" => new StarkInfra\CreditPreview\CreditNotePreview([
            "type" => "sac",
            "nominalAmount" => 100000,
            "nominalInterest" => 15.0,
            "scheduled" => "2022-06-28",
            "initialDue" => "2022-07-28",
            "count" => 12,
            "taxId" => "012.345.678-90"
        ])
    ])
]);

foreach ($previews as $preview) {
    print_r($preview);
}
  

Java

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

HashMap<String, Object> creditData = new HashMap<>();
creditData.put("type", "sac");
creditData.put("nominalAmount", 100000);
creditData.put("nominalInterest", 15.0);
creditData.put("scheduled", "2022-06-28");
creditData.put("initialDue", "2022-07-28");
creditData.put("count", 12);
creditData.put("taxId", "012.345.678-90");

List<CreditPreview> previews = new ArrayList<>();
previews.add(new CreditPreview(new CreditPreview.CreditNotePreview(creditData), "credit-note"));

List<CreditPreview> response = CreditPreview.create(previews);

for (CreditPreview preview : response) {
    System.out.println(preview);
}
  

Ruby

require('starkinfra')

previews = StarkInfra::CreditPreview.create([
    StarkInfra::CreditPreview.new(
        type: "credit-note",
        credit: StarkInfra::CreditPreview::CreditNotePreview.new(
            type: "sac",
            nominal_amount: 100000,
            nominal_interest: 15.0,
            scheduled: "2022-06-28",
            initial_due: "2022-07-28",
            count: 12,
            tax_id: "012.345.678-90"
        )
    )
])

previews.each do |preview|
    puts preview
end
  

Elixir

previews = StarkInfra.CreditPreview.create!([
    %StarkInfra.CreditPreview{
        type: "credit-note",
        credit: %StarkInfra.CreditPreview.CreditNotePreview{
            type: "sac",
            nominal_amount: 100000,
            nominal_interest: 15.0,
            scheduled: "2022-06-28",
            initial_due: "2022-07-28",
            count: 12,
            tax_id: "012.345.678-90"
        }
    }
])

for preview <- previews do
    preview |> IO.inspect
end
  

C#

using System;
using System.Collections.Generic;

List<StarkInfra.CreditPreview> previews = StarkInfra.CreditPreview.Create(
    new List<StarkInfra.CreditPreview> {
        new StarkInfra.CreditPreview(
            type: "credit-note",
            credit: new StarkInfra.CreditPreview.CreditNotePreview(
                type: "sac",
                nominalAmount: 100000,
                nominalInterest: 15.0,
                scheduled: "2022-06-28",
                initialDue: "2022-07-28",
                count: 12,
                taxId: "012.345.678-90"
            )
        )
    }
);

foreach (StarkInfra.CreditPreview preview in previews) {
    Console.WriteLine(preview);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditpreview"
)

func main() {

    previews, err := creditpreview.Create(
        []creditpreview.CreditPreview{
            {
                Type: "credit-note",
                Credit: creditpreview.CreditNotePreview{
                    Type:            "sac",
                    NominalAmount:   100000,
                    NominalInterest: 15.0,
                    Scheduled:       "2022-06-28",
                    InitialDue:      "2022-07-28",
                    Count:           12,
                    TaxId:           "012.345.678-90",
                },
            },
        },
        nil,
    )
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def previews
    (starkinfra.credit-preview/create
        [{:type "credit-note"
          :credit {:type "sac"
                   :nominal-amount 100000
                   :nominal-interest 15.0
                   :scheduled "2022-06-28"
                   :initial-due "2022-07-28"
                   :count 12
                   :tax-id "012.345.678-90"}}]))

(dorun (map println previews))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/credit-preview' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "previews": [
        {
            "type": "credit-note",
            "credit": {
                "type": "sac",
                "nominalAmount": 100000,
                "nominalInterest": 15.0,
                "scheduled": "2022-06-28",
                "initialDue": "2022-07-28",
                "count": 12,
                "taxId": "012.345.678-90"
            }
        }
    ]
}'
  
RESPONSE

Python

CreditPreview(
    type=credit-note,
    credit=CreditNotePreview(
        type=sac,
        nominal_amount=100000,
        rebate_amount=0,
        tax_amount=1126,
        amount=98874,
        interest=17.34,
        nominal_interest=15.0,
        scheduled=2022-06-28T00:00:00.000000+00:00,
        initial_due=2022-07-28T00:00:00.000000+00:00,
        initial_amount=9583,
        count=12,
        invoices=[Invoice(amount=9583, due=2022-07-28), ..., Invoice(amount=8438, due=2023-06-28)]
    )
)
  

Javascript

CreditPreview {
    type: 'credit-note',
    credit: CreditNotePreview {
        type: 'sac',
        nominalAmount: 100000,
        rebateAmount: 0,
        taxAmount: 1126,
        amount: 98874,
        interest: 17.34,
        nominalInterest: 15.0,
        scheduled: '2022-06-28T00:00:00.000000+00:00',
        initialDue: '2022-07-28T00:00:00.000000+00:00',
        initialAmount: 9583,
        count: 12,
        invoices: [{amount: 9583, due: '2022-07-28'}, ..., {amount: 8438, due: '2023-06-28'}]
    }
}
  

PHP

StarkInfra\CreditPreview Object
(
    [type] => credit-note
    [credit] => StarkInfra\CreditPreview\CreditNotePreview Object
        (
            [type] => sac
            [nominalAmount] => 100000
            [rebateAmount] => 0
            [taxAmount] => 1126
            [amount] => 98874
            [interest] => 17.34
            [nominalInterest] => 15.0
            [scheduled] => 2022-06-28T00:00:00.000000+00:00
            [initialDue] => 2022-07-28T00:00:00.000000+00:00
            [initialAmount] => 9583
            [count] => 12
            [invoices] => Array(...)
        )
)
  

Java

CreditPreview({
    "type": "credit-note",
    "credit": {
        "type": "sac",
        "nominalAmount": 100000,
        "rebateAmount": 0,
        "taxAmount": 1126,
        "amount": 98874,
        "interest": 17.34,
        "nominalInterest": 15.0,
        "scheduled": "2022-06-28T00:00:00.000000+00:00",
        "initialDue": "2022-07-28T00:00:00.000000+00:00",
        "initialAmount": 9583,
        "count": 12,
        "invoices": [{"amount": 9583, "due": "2022-07-28"}, ..., {"amount": 8438, "due": "2023-06-28"}]
    }
})
  

Ruby

credit_preview(
    type: credit-note,
    credit: credit_note_preview(
        type: sac,
        nominal_amount: 100000,
        rebate_amount: 0,
        tax_amount: 1126,
        amount: 98874,
        interest: 17.34,
        nominal_interest: 15.0,
        scheduled: 2022-06-28T00:00:00.000000+00:00,
        initial_due: 2022-07-28T00:00:00.000000+00:00,
        initial_amount: 9583,
        count: 12,
        invoices: [...]
    )
)
  

Elixir

%StarkInfra.CreditPreview{
    type: "credit-note",
    credit: %StarkInfra.CreditPreview.CreditNotePreview{
        type: "sac",
        nominal_amount: 100000,
        rebate_amount: 0,
        tax_amount: 1126,
        amount: 98874,
        interest: 17.34,
        nominal_interest: 15.0,
        scheduled: "2022-06-28T00:00:00.000000+00:00",
        initial_due: "2022-07-28T00:00:00.000000+00:00",
        initial_amount: 9583,
        count: 12,
        invoices: [...]
    }
}
  

C#

CreditPreview(
    Type: credit-note,
    Credit: CreditNotePreview(
        Type: sac,
        NominalAmount: 100000,
        RebateAmount: 0,
        TaxAmount: 1126,
        Amount: 98874,
        Interest: 17.34,
        NominalInterest: 15.0,
        Scheduled: 2022-06-28T00:00:00.000000+00:00,
        InitialDue: 2022-07-28T00:00:00.000000+00:00,
        InitialAmount: 9583,
        Count: 12,
        Invoices: [...]
    )
)
  

Go

{
    Type:credit-note
    Credit:{
        Type:sac
        NominalAmount:100000
        RebateAmount:0
        TaxAmount:1126
        Amount:98874
        Interest:17.34
        NominalInterest:15.0
        Scheduled:2022-06-28T00:00:00.000000+00:00
        InitialDue:2022-07-28T00:00:00.000000+00:00
        InitialAmount:9583
        Count:12
        Invoices:[...]
    }
}
  

Clojure

{:type "credit-note",
 :credit {:type "sac",
          :nominal-amount 100000,
          :rebate-amount 0,
          :tax-amount 1126,
          :amount 98874,
          :interest 17.34,
          :nominal-interest 15.0,
          :scheduled "2022-06-28T00:00:00.000000+00:00",
          :initial-due "2022-07-28T00:00:00.000000+00:00",
          :initial-amount 9583,
          :count 12,
          :invoices [...]}}
  

Curl

{
    "previews": [
        {
            "type": "credit-note",
            "credit": {
                "type": "sac",
                "nominalAmount": 100000,
                "rebateAmount": 0,
                "taxAmount": 1126,
                "amount": 98874,
                "interest": 17.34,
                "nominalInterest": 15.0,
                "scheduled": "2022-06-28T00:00:00.000000+00:00",
                "initialDue": "2022-07-28T00:00:00.000000+00:00",
                "initialAmount": 9583,
                "count": 12,
                "invoices": [
                    {"amount": 9583, "due": "2022-07-28"},
                    {"amount": 8438, "due": "2023-06-28"}
                ]
            }
        }
    ]
}
  

Credit Signer Overview

Credit Signers represent every person or entity that must sign the CCB contract of a Credit Note.

Signers are created together with the Credit Note, through its "signers" parameter, and are returned embedded in the CreditNote object. Signers registered in your credit profile and the SCD signature are appended automatically.

When the method is "link" or "token", the signer receives the signing link or token on the registered contact (email or phone). If a signer misses it, you can trigger a new delivery.

The CreditSigner object

Attributes

id STRING

Unique id for the credit signer.

name STRING

Signer full name.

contact STRING

Signer contact that receives the signing link or token. Can be an email, a phone number or, for the "server" and "organization" methods, a URL.

method STRING

Signing method. Options: "link" (signing link sent to the contact), "token" (signing token sent to the contact), "server" and "organization" (automatic signatures over URL contacts).

signed STRING

Datetime when the signer signed the contract. Empty until the signature happens. Example: "2022-06-02T00:00:00.000000+00:00".

Update a Credit Signer

Update the delivery state of a credit signer's signing token or link. Setting "isSent" to false marks it as not delivered, causing it to be sent again to the signer's contact. Use it when a signer misses the original email or SMS.

ENDPOINT
PATCH /v2/credit-signer/:id
REQUEST

Python

import starkinfra

signer = starkinfra.creditsigner.resend_token("6306107546853376")

print(signer)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let signer = await starkinfra.request.patch(
        '/credit-signer/6306107546853376',
        { isSent: false }
    );
    console.log(signer);
})();
  

PHP

$signer = StarkInfra\Request::patch(
    "/credit-signer/6306107546853376",
    ["isSent" => false]
);

print_r($signer);
  

Java

import com.starkinfra.*;
import java.util.HashMap;

HashMap<String, Object> data = new HashMap<>();
data.put("isSent", false);

String signer = Request.patch("/credit-signer/6306107546853376", data).content();

System.out.println(signer);
  

Ruby

require('starkinfra')

signer = StarkInfra::Request.patch(
    '/credit-signer/6306107546853376',
    payload: { isSent: false }
)

puts signer
  

Elixir

signer = StarkInfra.Request.patch!(
    "/credit-signer/6306107546853376",
    payload: %{isSent: false}
)

signer |> IO.inspect
  

C#

using System;
using System.Collections.Generic;

Dictionary<string, object> data = new Dictionary<string, object> {
    { "isSent", false }
};

string signer = StarkInfra.Request.Patch("/credit-signer/6306107546853376", data);

Console.WriteLine(signer);
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/request"
)

func main() {

    var data = map[string]interface{}{}
    data["isSent"] = false

    signer, err := request.Patch("/credit-signer/6306107546853376", data, nil, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def signer
  (starkinfra.request/patch
    "/credit-signer/6306107546853376"
    {:is-sent false}))
(println signer)
  

Curl

curl --location --request PATCH '{{baseUrl}}/v2/credit-signer/6306107546853376' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "isSent": false
}'
  
RESPONSE

Python

CreditSigner(
    id=6306107546853376,
    name=Jamie Lannister,
    contact=jamie.lannister@gmail.com,
    method=link,
    signed=
)
  

Javascript

{
    signer: {
        id: '6306107546853376',
        name: 'Jamie Lannister',
        contact: 'jamie.lannister@gmail.com',
        method: 'link',
        signed: ''
    }
}
  

PHP

Array
(
    [signer] => Array
        (
            [id] => 6306107546853376
            [name] => Jamie Lannister
            [contact] => jamie.lannister@gmail.com
            [method] => link
            [signed] =>
        )
)
  

Java

{
    "signer": {
        "id": "6306107546853376",
        "name": "Jamie Lannister",
        "contact": "jamie.lannister@gmail.com",
        "method": "link",
        "signed": ""
    }
}
  

Ruby

{
    signer: {
        id: 6306107546853376,
        name: Jamie Lannister,
        contact: jamie.lannister@gmail.com,
        method: link,
        signed:
    }
}
  

Elixir

%{
    signer: %{
        id: "6306107546853376",
        name: "Jamie Lannister",
        contact: "jamie.lannister@gmail.com",
        method: "link",
        signed: ""
    }
}
  

C#

{
    "signer": {
        "id": "6306107546853376",
        "name": "Jamie Lannister",
        "contact": "jamie.lannister@gmail.com",
        "method": "link",
        "signed": ""
    }
}
  

Go

{
    Signer:{
        Id:6306107546853376
        Name:Jamie Lannister
        Contact:jamie.lannister@gmail.com
        Method:link
        Signed:
    }
}
  

Clojure

{:signer {:id "6306107546853376",
          :name "Jamie Lannister",
          :contact "jamie.lannister@gmail.com",
          :method "link",
          :signed ""}}
  

Curl

{
    "signer": {
        "id": "6306107546853376",
        "name": "Jamie Lannister",
        "contact": "jamie.lannister@gmail.com",
        "method": "link",
        "signed": ""
    }
}
  

Credit Note Overview

Credit Notes represent credit operations issued to individuals or businesses as Bank Credit Bills (Cédula de Crédito Bancário - CCB). They carry all the information needed to formalize a lending operation, including signers, installment invoices and the disbursement payment details.

Once created, the credit note generates a contract that must be digitally signed by all signers. After signing, the disbursement is transferred via Pix to the borrower's account and each installment is tracked through invoices.

Here we will show you how to create and manage them.

The CreditNote object

Attributes

id STRING

Unique id for the credit note.

templateId STRING

ID of the credit note template used. Templates are enabled for your workspace through your credit profile.

name STRING

Borrower full name.

taxId STRING

Borrower CPF or CNPJ.

nominalAmount INTEGER

Nominal amount in cents of the credit note, before taxes. Example: 100000 (R$1,000.00).

rebateAmount INTEGER

Amount in cents discounted from the disbursed amount. Example: 100 (R$1.00).

taxAmount INTEGER

Tax amount in cents (IOF) embedded in the operation, computed from the borrower type (individual or business) and the operation duration.

amount INTEGER

Net amount in cents disbursed to the borrower.

interest FLOAT

Effective interest rate of the credit operation, in % per year, computed from the disbursed amount and the invoice schedule. Example: 27.5.

nominalInterest FLOAT

Nominal interest rate of the credit operation, in % per year, computed from the nominal amount and the invoice schedule. Example: 25.2.

rules LIST OF OBJECTS

List of rules modifying the credit note behavior, as {"key", "value"} objects. Currently available key: "invoiceCreationMode", with values "scheduled" (default - each installment invoice is issued a few days before its due date), "instant" (all invoices are issued as soon as the note is disbursed) or "never" (invoices are not issued automatically).

scheduled STRING

Datetime when the credit note will be disbursed after signing. Example: "2022-06-28T00:00:00.000000+00:00".

expiration INTEGER

Time span, in seconds, counted from the scheduled datetime, for the borrower and signers to sign the contract before the credit note expires. Default: 604800 (7 days).

externalId STRING

Unique external ID that prevents the creation of duplicate credit notes on unintended retries.

tags LIST OF STRINGS

Tags associated with the credit note.

status STRING

Current status of the credit note. Options: "created" (awaiting signatures), "signed" (contract signed by all signers), "processing" (disbursement in progress), "success" (disbursement settled), "failed" (disbursement failed), "canceled" and "expired" (not signed before the expiration).

signers LIST OF OBJECTS

List of CreditSigner objects representing every person or entity that must sign the contract, as {"id", "name", "contact", "method", "signed"} objects. Signers registered in your credit profile and the SCD signature are appended automatically.

invoices LIST OF OBJECTS

List of Invoice objects representing the installments to be paid by the borrower, with their "id", "amount", "due", "fine", "interest", "expiration", "descriptions" and "tags".

payment OBJECT

Transfer object used to disburse the credit amount to the borrower, including its "id" and "status" once the disbursement is initiated.

paymentType STRING

Type of the payment object. Options: "transfer".

streetLine1 STRING

Borrower main address street line.

streetLine2 STRING

Borrower complement address street line.

district STRING

Borrower address district.

city STRING

Borrower address city.

stateCode STRING

Borrower address state code. Example: "SP".

zipCode STRING

Borrower address zip code. Example: "01310-100".

documentId STRING

Unique id of the digital signing document attached to this credit note.

workspaceId STRING

ID of the workspace that issued the credit note.

debtorWorkspaceId STRING

ID of the borrower's workspace, when it differs from the issuing workspace.

transactionIds LIST OF STRINGS

Ledger transaction ids linked to the disbursement and its chargebacks.

created STRING

Creation datetime. Example: "2022-01-01T00:00:00.000000+00:00".

updated STRING

Last update datetime. Example: "2022-01-01T00:00:00.000000+00:00".

Create Credit Notes

Create credit notes in bulk. You can create up to 100 credit notes in a single request.

Provide either the nominalAmount (pre-tax) or the amount (net disbursed value) - the other one, along with the taxAmount (IOF) and the interest rates, is computed from the invoice schedule.

ENDPOINT
POST /v2/credit-note
REQUEST

Python

import starkinfra

notes = starkinfra.creditnote.create([
    starkinfra.CreditNote(
        template_id="5745297609744384",
        name="Jamie Lannister",
        tax_id="012.345.678-90",
        nominal_amount=100000,
        scheduled="2022-06-28",
        invoices=[
            starkinfra.creditnote.Invoice(
                amount=102612,
                due="2022-07-28"
            )
        ],
        payment=starkinfra.creditnote.Transfer(
            bank_code="20018183",
            branch_code="1234",
            account_number="129340-1",
            name="Jamie Lannister",
            tax_id="012.345.678-90"
        ),
        payment_type="transfer",
        signers=[
            starkinfra.creditsigner.CreditSigner(
                name="Jamie Lannister",
                contact="jamie.lannister@gmail.com",
                method="link"
            )
        ],
        external_id="my-internal-id-123456",
        street_line_1="Av. Paulista, 200",
        street_line_2="Apto. 51",
        district="Bela Vista",
        city="Sao Paulo",
        state_code="SP",
        zip_code="01310-100"
    )
])

for note in notes:
    print(note)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let notes = await starkinfra.creditNote.create([
        {
            templateId: '5745297609744384',
            name: 'Jamie Lannister',
            taxId: '012.345.678-90',
            nominalAmount: 100000,
            scheduled: '2022-06-28',
            invoices: [
                { amount: 102612, due: '2022-07-28' }
            ],
            payment: {
                bankCode: '20018183',
                branchCode: '1234',
                accountNumber: '129340-1',
                name: 'Jamie Lannister',
                taxId: '012.345.678-90'
            },
            paymentType: 'transfer',
            signers: [
                { name: 'Jamie Lannister', contact: 'jamie.lannister@gmail.com', method: 'link' }
            ],
            externalId: 'my-internal-id-123456',
            streetLine1: 'Av. Paulista, 200',
            streetLine2: 'Apto. 51',
            district: 'Bela Vista',
            city: 'Sao Paulo',
            stateCode: 'SP',
            zipCode: '01310-100'
        }
    ]);

    for (let note of notes) {
        console.log(note);
    }
})();
  

PHP

$notes = StarkInfra\CreditNote::create([
    new StarkInfra\CreditNote([
        "templateId" => "5745297609744384",
        "name" => "Jamie Lannister",
        "taxId" => "012.345.678-90",
        "nominalAmount" => 100000,
        "scheduled" => "2022-06-28",
        "invoices" => [
            new StarkInfra\CreditNote\Invoice(["amount" => 102612, "due" => "2022-07-28"])
        ],
        "payment" => new StarkInfra\CreditNote\Transfer([
            "bankCode" => "20018183",
            "branchCode" => "1234",
            "accountNumber" => "129340-1",
            "name" => "Jamie Lannister",
            "taxId" => "012.345.678-90"
        ]),
        "paymentType" => "transfer",
        "signers" => [
            new StarkInfra\CreditSigner(["name" => "Jamie Lannister", "contact" => "jamie.lannister@gmail.com", "method" => "link"])
        ],
        "externalId" => "my-internal-id-123456",
        "streetLine1" => "Av. Paulista, 200",
        "streetLine2" => "Apto. 51",
        "district" => "Bela Vista",
        "city" => "Sao Paulo",
        "stateCode" => "SP",
        "zipCode" => "01310-100"
    ])
]);

foreach ($notes as $note) {
    print_r($note);
}
  

Java

import com.starkinfra.*;
import java.util.Arrays;
import java.util.HashMap;

HashMap<String, Object> invoiceData = new HashMap<>();
invoiceData.put("amount", 102612);
invoiceData.put("due", "2022-07-28");

HashMap<String, Object> paymentData = new HashMap<>();
paymentData.put("bankCode", "20018183");
paymentData.put("branchCode", "1234");
paymentData.put("accountNumber", "129340-1");
paymentData.put("name", "Jamie Lannister");
paymentData.put("taxId", "012.345.678-90");

HashMap<String, Object> signerData = new HashMap<>();
signerData.put("name", "Jamie Lannister");
signerData.put("contact", "jamie.lannister@gmail.com");
signerData.put("method", "link");

HashMap<String, Object> data = new HashMap<>();
data.put("templateId", "5745297609744384");
data.put("name", "Jamie Lannister");
data.put("taxId", "012.345.678-90");
data.put("nominalAmount", 100000);
data.put("scheduled", "2022-06-28");
data.put("invoices", Arrays.asList(new CreditNote.Invoice(invoiceData)));
data.put("payment", new CreditNote.Transfer(paymentData));
data.put("paymentType", "transfer");
data.put("signers", Arrays.asList(new CreditSigner(signerData)));
data.put("externalId", "my-internal-id-123456");
data.put("streetLine1", "Av. Paulista, 200");
data.put("streetLine2", "Apto. 51");
data.put("district", "Bela Vista");
data.put("city", "Sao Paulo");
data.put("stateCode", "SP");
data.put("zipCode", "01310-100");

List<CreditNote> notes = CreditNote.create(Arrays.asList(new CreditNote(data)));

for (CreditNote note : notes) {
    System.out.println(note);
}
  

Ruby

require('starkinfra')

notes = StarkInfra::CreditNote.create([
    StarkInfra::CreditNote.new(
        template_id: '5745297609744384',
        name: 'Jamie Lannister',
        tax_id: '012.345.678-90',
        nominal_amount: 100000,
        scheduled: '2022-06-28',
        invoices: [
            StarkInfra::CreditNote::Invoice.new(amount: 102612, due: '2022-07-28')
        ],
        payment: StarkInfra::CreditNote::Transfer.new(
            bank_code: '20018183',
            branch_code: '1234',
            account_number: '129340-1',
            name: 'Jamie Lannister',
            tax_id: '012.345.678-90'
        ),
        payment_type: 'transfer',
        signers: [
            StarkInfra::CreditSigner.new(name: 'Jamie Lannister', contact: 'jamie.lannister@gmail.com', method: 'link')
        ],
        external_id: 'my-internal-id-123456',
        street_line_1: 'Av. Paulista, 200',
        street_line_2: 'Apto. 51',
        district: 'Bela Vista',
        city: 'Sao Paulo',
        state_code: 'SP',
        zip_code: '01310-100'
    )
])

notes.each do |note|
    puts note
end
  

Elixir

notes = StarkInfra.CreditNote.create!([
    %StarkInfra.CreditNote{
        template_id: "5745297609744384",
        name: "Jamie Lannister",
        tax_id: "012.345.678-90",
        nominal_amount: 100000,
        scheduled: "2022-06-28",
        invoices: [%StarkInfra.CreditNote.Invoice{amount: 102612, due: "2022-07-28"}],
        payment: %StarkInfra.CreditNote.Transfer{
            bank_code: "20018183",
            branch_code: "1234",
            account_number: "129340-1",
            name: "Jamie Lannister",
            tax_id: "012.345.678-90"
        },
        payment_type: "transfer",
        signers: [%StarkInfra.CreditSigner{name: "Jamie Lannister", contact: "jamie.lannister@gmail.com", method: "link"}],
        external_id: "my-internal-id-123456",
        street_line_1: "Av. Paulista, 200",
        street_line_2: "Apto. 51",
        district: "Bela Vista",
        city: "Sao Paulo",
        state_code: "SP",
        zip_code: "01310-100"
    }
])

for note <- notes do
    note |> IO.inspect
end
  

C#

using System;
using System.Collections.Generic;

List<StarkInfra.CreditNote> notes = StarkInfra.CreditNote.Create(
    new List<StarkInfra.CreditNote> {
        new StarkInfra.CreditNote(
            templateId: "5745297609744384",
            name: "Jamie Lannister",
            taxId: "012.345.678-90",
            nominalAmount: 100000,
            scheduled: "2022-06-28",
            invoices: new List<StarkInfra.CreditNote.Invoice> {
                new StarkInfra.CreditNote.Invoice(amount: 102612, due: "2022-07-28")
            },
            payment: new StarkInfra.CreditNote.Transfer(
                bankCode: "20018183",
                branchCode: "1234",
                accountNumber: "129340-1",
                name: "Jamie Lannister",
                taxId: "012.345.678-90"
            ),
            paymentType: "transfer",
            signers: new List<StarkInfra.CreditSigner> {
                new StarkInfra.CreditSigner(name: "Jamie Lannister", contact: "jamie.lannister@gmail.com", method: "link")
            },
            externalId: "my-internal-id-123456",
            streetLine1: "Av. Paulista, 200",
            streetLine2: "Apto. 51",
            district: "Bela Vista",
            city: "Sao Paulo",
            stateCode: "SP",
            zipCode: "01310-100"
        )
    }
);

foreach (StarkInfra.CreditNote note in notes) {
    Console.WriteLine(note);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditnote"
    "github.com/starkinfra/sdk-go/starkinfra/creditsigner"
)

func main() {

    notes, err := creditnote.Create(
        []creditnote.CreditNote{
            {
                TemplateId:    "5745297609744384",
                Name:          "Jamie Lannister",
                TaxId:         "012.345.678-90",
                NominalAmount: 100000,
                Scheduled:     "2022-06-28",
                Invoices: []creditnote.Invoice{
                    {
                        Amount: 102612,
                        Due:    "2022-07-28",
                    },
                },
                Payment: creditnote.Transfer{
                    BankCode:      "20018183",
                    BranchCode:    "1234",
                    AccountNumber: "129340-1",
                    Name:          "Jamie Lannister",
                    TaxId:         "012.345.678-90",
                },
                PaymentType: "transfer",
                Signers: []creditsigner.CreditSigner{
                    {
                        Name:    "Jamie Lannister",
                        Contact: "jamie.lannister@gmail.com",
                        Method:  "link",
                    },
                },
                ExternalId:  "my-internal-id-123456",
                StreetLine1: "Av. Paulista, 200",
                StreetLine2: "Apto. 51",
                District:    "Bela Vista",
                City:        "Sao Paulo",
                StateCode:   "SP",
                ZipCode:     "01310-100",
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def notes
  (starkinfra.credit-note/create
    [{
      :template-id "5745297609744384"
      :name "Jamie Lannister"
      :tax-id "012.345.678-90"
      :nominal-amount 100000
      :scheduled "2022-06-28"
      :invoices [{:amount 102612 :due "2022-07-28"}]
      :payment {
        :bank-code "20018183"
        :branch-code "1234"
        :account-number "129340-1"
        :name "Jamie Lannister"
        :tax-id "012.345.678-90"
      }
      :payment-type "transfer"
      :signers [{:name "Jamie Lannister" :contact "jamie.lannister@gmail.com" :method "link"}]
      :external-id "my-internal-id-123456"
      :street-line-1 "Av. Paulista, 200"
      :street-line-2 "Apto. 51"
      :district "Bela Vista"
      :city "Sao Paulo"
      :state-code "SP"
      :zip-code "01310-100"
    }]))
(dorun (map println notes))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/credit-note' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "notes": [
        {
            "templateId": "5745297609744384",
            "name": "Jamie Lannister",
            "taxId": "012.345.678-90",
            "nominalAmount": 100000,
            "scheduled": "2022-06-28",
            "invoices": [{"amount": 102612, "due": "2022-07-28"}],
            "payment": {"bankCode": "20018183", "branchCode": "1234", "accountNumber": "129340-1", "name": "Jamie Lannister", "taxId": "012.345.678-90"},
            "paymentType": "transfer",
            "signers": [{"name": "Jamie Lannister", "contact": "jamie.lannister@gmail.com", "method": "link"}],
            "externalId": "my-internal-id-123456",
            "streetLine1": "Av. Paulista, 200",
            "streetLine2": "Apto. 51",
            "district": "Bela Vista",
            "city": "Sao Paulo",
            "stateCode": "SP",
            "zipCode": "01310-100"
        }
    ]
}'
  
RESPONSE

Python

CreditNote(
    id=5745297609744385,
    template_id=5745297609744384,
    name=Jamie Lannister,
    tax_id=012.345.678-90,
    nominal_amount=100000,
    tax_amount=626,
    amount=99374,
    interest=38.61,
    nominal_interest=30.69,
    status=created,
    external_id=my-internal-id-123456,
    scheduled=2022-06-28T00:00:00.000000+00:00,
    expiration=604800,
    payment_type=transfer,
    created=2022-06-01T00:00:00.000000+00:00,
    updated=2022-06-01T00:00:00.000000+00:00
)
  

Javascript

CreditNote {
    id: '5745297609744385',
    templateId: '5745297609744384',
    name: 'Jamie Lannister',
    taxId: '012.345.678-90',
    nominalAmount: 100000,
    taxAmount: 626,
    amount: 99374,
    interest: 38.61,
    nominalInterest: 30.69,
    status: 'created',
    externalId: 'my-internal-id-123456',
    scheduled: '2022-06-28T00:00:00.000000+00:00',
    expiration: 604800,
    paymentType: 'transfer',
    created: '2022-06-01T00:00:00.000000+00:00',
    updated: '2022-06-01T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditNote Object
(
    [id] => 5745297609744385
    [templateId] => 5745297609744384
    [name] => Jamie Lannister
    [taxId] => 012.345.678-90
    [nominalAmount] => 100000
    [taxAmount] => 626
    [amount] => 99374
    [interest] => 38.61
    [nominalInterest] => 30.69
    [status] => created
    [externalId] => my-internal-id-123456
    [scheduled] => 2022-06-28T00:00:00.000000+00:00
    [expiration] => 604800
    [paymentType] => transfer
    [created] => 2022-06-01T00:00:00.000000+00:00
    [updated] => 2022-06-01T00:00:00.000000+00:00
)
  

Java

CreditNote({
    "id": "5745297609744385",
    "templateId": "5745297609744384",
    "name": "Jamie Lannister",
    "taxId": "012.345.678-90",
    "nominalAmount": 100000,
    "taxAmount": 626,
    "amount": 99374,
    "interest": 38.61,
    "nominalInterest": 30.69,
    "status": "created",
    "externalId": "my-internal-id-123456",
    "scheduled": "2022-06-28T00:00:00.000000+00:00",
    "expiration": 604800,
    "paymentType": "transfer",
    "created": "2022-06-01T00:00:00.000000+00:00",
    "updated": "2022-06-01T00:00:00.000000+00:00"
})
  

Ruby

credit_note(
    id: 5745297609744385,
    template_id: 5745297609744384,
    name: Jamie Lannister,
    tax_id: 012.345.678-90,
    nominal_amount: 100000,
    tax_amount: 626,
    amount: 99374,
    interest: 38.61,
    nominal_interest: 30.69,
    status: created,
    external_id: my-internal-id-123456,
    scheduled: 2022-06-28T00:00:00.000000+00:00,
    expiration: 604800,
    payment_type: transfer,
    created: 2022-06-01T00:00:00.000000+00:00,
    updated: 2022-06-01T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditNote{
    id: "5745297609744385",
    template_id: "5745297609744384",
    name: "Jamie Lannister",
    tax_id: "012.345.678-90",
    nominal_amount: 100000,
    tax_amount: 626,
    amount: 99374,
    interest: 38.61,
    nominal_interest: 30.69,
    status: "created",
    external_id: "my-internal-id-123456",
    scheduled: "2022-06-28T00:00:00.000000+00:00",
    expiration: 604800,
    payment_type: "transfer",
    created: "2022-06-01T00:00:00.000000+00:00",
    updated: "2022-06-01T00:00:00.000000+00:00"
}
  

C#

CreditNote(
    Id: 5745297609744385,
    TemplateId: 5745297609744384,
    Name: Jamie Lannister,
    TaxId: 012.345.678-90,
    NominalAmount: 100000,
    TaxAmount: 626,
    Amount: 99374,
    Interest: 38.61,
    NominalInterest: 30.69,
    Status: created,
    ExternalId: my-internal-id-123456,
    Scheduled: 2022-06-28T00:00:00.000000+00:00,
    Expiration: 604800,
    PaymentType: transfer,
    Created: 2022-06-01T00:00:00.000000+00:00,
    Updated: 2022-06-01T00:00:00.000000+00:00
)
  

Go

{
    Id:5745297609744385
    TemplateId:5745297609744384
    Name:Jamie Lannister
    TaxId:012.345.678-90
    NominalAmount:100000
    TaxAmount:626
    Amount:99374
    Interest:38.61
    NominalInterest:30.69
    Status:created
    ExternalId:my-internal-id-123456
    Scheduled:2022-06-28T00:00:00.000000+00:00
    Expiration:604800
    PaymentType:transfer
    Created:2022-06-01T00:00:00.000000+00:00
    Updated:2022-06-01T00:00:00.000000+00:00
}
  

Clojure

{:id "5745297609744385",
 :template-id "5745297609744384",
 :name "Jamie Lannister",
 :tax-id "012.345.678-90",
 :nominal-amount 100000,
 :tax-amount 626,
 :amount 99374,
 :interest 38.61,
 :nominal-interest 30.69,
 :status "created",
 :external-id "my-internal-id-123456",
 :scheduled "2022-06-28T00:00:00.000000+00:00",
 :expiration 604800,
 :payment-type "transfer",
 :created "2022-06-01T00:00:00.000000+00:00",
 :updated "2022-06-01T00:00:00.000000+00:00"}
  

Curl

{
    "notes": [
        {
            "id": "5745297609744385",
            "templateId": "5745297609744384",
            "name": "Jamie Lannister",
            "taxId": "012.345.678-90",
            "rules": [],
            "tags": [],
            "streetLine1": "Av. Paulista, 200",
            "streetLine2": "Apto. 51",
            "district": "Bela Vista",
            "city": "Sao Paulo",
            "stateCode": "SP",
            "zipCode": "01310-100",
            "nominalAmount": 100000,
            "rebateAmount": 0,
            "taxAmount": 626,
            "amount": 99374,
            "interest": 38.61,
            "nominalInterest": 30.69,
            "externalId": "my-internal-id-123456",
            "signers": [
                {"id": "6306107546853376", "name": "Jamie Lannister", "method": "link", "contact": "jamie.lannister@gmail.com", "signed": ""}
            ],
            "invoices": [
                {"amount": 102612, "due": "2022-07-28", "fine": 2.0, "interest": 1.0}
            ],
            "payment": {"id": "", "status": "", "amount": 99374, "name": "Jamie Lannister", "taxId": "012.345.678-90", "bankCode": "20018183", "branchCode": "1234", "accountNumber": "129340-1"},
            "paymentType": "transfer",
            "status": "created",
            "scheduled": "2022-06-28T00:00:00.000000+00:00",
            "expiration": 604800,
            "documentId": "07d05b14-9d83-4439-9622-d2b313b05a10",
            "workspaceId": "6341320293482496",
            "debtorWorkspaceId": "6341320293482496",
            "transactionIds": [],
            "created": "2022-06-01T00:00:00.000000+00:00",
            "updated": "2022-06-01T00:00:00.000000+00:00"
        }
    ]
}
  

List Credit Notes

List and filter all credit notes created in your workspace. Results are returned paged.

ENDPOINT
GET /v2/credit-note
REQUEST

Python

import starkinfra

notes = starkinfra.creditnote.query(
    limit=10,
    status="signed",
    after="2022-06-01",
    before="2022-06-30"
)

for note in notes:
    print(note)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let notes = await starkinfra.creditNote.query({
        limit: 10,
        status: 'signed',
        after: '2022-06-01',
        before: '2022-06-30'
    });

    for await (let note of notes) {
        console.log(note);
    }
})();
  

PHP

$notes = StarkInfra\CreditNote::query([
    "limit" => 10,
    "status" => "signed",
    "after" => "2022-06-01",
    "before" => "2022-06-30"
]);

foreach ($notes as $note) {
    print_r($note);
}
  

Java

import com.starkinfra.*;
import java.util.HashMap;

HashMap<String, Object> params = new HashMap<>();
params.put("limit", 10);
params.put("status", "signed");
params.put("after", "2022-06-01");
params.put("before", "2022-06-30");

Generator<CreditNote> notes = CreditNote.query(params);

for (CreditNote note : notes) {
    System.out.println(note);
}
  

Ruby

require('starkinfra')

notes = StarkInfra::CreditNote.query(
    limit: 10,
    status: 'signed',
    after: '2022-06-01',
    before: '2022-06-30'
)

notes.each do |note|
    puts note
end
  

Elixir

notes = StarkInfra.CreditNote.query!(
    limit: 10,
    status: "signed",
    after: "2022-06-01",
    before: "2022-06-30"
)

for note <- notes do
    note |> IO.inspect
end
  

C#

using System;
using System.Collections.Generic;

IEnumerable<StarkInfra.CreditNote> notes = StarkInfra.CreditNote.Query(
    limit: 10,
    status: "signed",
    after: DateTime.Parse("2022-06-01"),
    before: DateTime.Parse("2022-06-30")
);

foreach (StarkInfra.CreditNote note in notes) {
    Console.WriteLine(note);
}
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditnote"
)

func main() {

    var params = map[string]interface{}{}
    params["limit"] = 10
    params["status"] = "signed"
    params["after"] = "2022-06-01"
    params["before"] = "2022-06-30"

    notes := creditnote.Query(params, nil)

    for note := range notes {
        fmt.Printf("%+v", note)
    }
}
  

Clojure

(def notes
  (starkinfra.credit-note/query
    {
      :limit 10
      :status "signed"
      :after "2022-06-01"
      :before "2022-06-30"
    }))
(dorun (map println notes))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-note?limit=10&status=signed&after=2022-06-01&before=2022-06-30' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

CreditNote(
    id=5745297609744385,
    template_id=5745297609744384,
    name=Jamie Lannister,
    tax_id=012.345.678-90,
    nominal_amount=100000,
    tax_amount=626,
    amount=99374,
    interest=38.61,
    nominal_interest=30.69,
    status=signed,
    external_id=my-internal-id-123456,
    scheduled=2022-06-28T00:00:00.000000+00:00,
    expiration=604800,
    payment_type=transfer,
    created=2022-06-01T00:00:00.000000+00:00,
    updated=2022-06-02T00:00:00.000000+00:00
)
  

Javascript

CreditNote {
    id: '5745297609744385',
    templateId: '5745297609744384',
    name: 'Jamie Lannister',
    taxId: '012.345.678-90',
    nominalAmount: 100000,
    taxAmount: 626,
    amount: 99374,
    interest: 38.61,
    nominalInterest: 30.69,
    status: 'signed',
    externalId: 'my-internal-id-123456',
    scheduled: '2022-06-28T00:00:00.000000+00:00',
    expiration: 604800,
    paymentType: 'transfer',
    created: '2022-06-01T00:00:00.000000+00:00',
    updated: '2022-06-02T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditNote Object
(
    [id] => 5745297609744385
    [templateId] => 5745297609744384
    [name] => Jamie Lannister
    [taxId] => 012.345.678-90
    [nominalAmount] => 100000
    [taxAmount] => 626
    [amount] => 99374
    [interest] => 38.61
    [nominalInterest] => 30.69
    [status] => signed
    [externalId] => my-internal-id-123456
    [scheduled] => 2022-06-28T00:00:00.000000+00:00
    [expiration] => 604800
    [paymentType] => transfer
    [created] => 2022-06-01T00:00:00.000000+00:00
    [updated] => 2022-06-02T00:00:00.000000+00:00
)
  

Java

CreditNote({
    "id": "5745297609744385",
    "templateId": "5745297609744384",
    "name": "Jamie Lannister",
    "taxId": "012.345.678-90",
    "nominalAmount": 100000,
    "taxAmount": 626,
    "amount": 99374,
    "interest": 38.61,
    "nominalInterest": 30.69,
    "status": "signed",
    "externalId": "my-internal-id-123456",
    "scheduled": "2022-06-28T00:00:00.000000+00:00",
    "expiration": 604800,
    "paymentType": "transfer",
    "created": "2022-06-01T00:00:00.000000+00:00",
    "updated": "2022-06-02T00:00:00.000000+00:00"
})
  

Ruby

credit_note(
    id: 5745297609744385,
    template_id: 5745297609744384,
    name: Jamie Lannister,
    tax_id: 012.345.678-90,
    nominal_amount: 100000,
    tax_amount: 626,
    amount: 99374,
    interest: 38.61,
    nominal_interest: 30.69,
    status: signed,
    external_id: my-internal-id-123456,
    scheduled: 2022-06-28T00:00:00.000000+00:00,
    expiration: 604800,
    payment_type: transfer,
    created: 2022-06-01T00:00:00.000000+00:00,
    updated: 2022-06-02T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditNote{
    id: "5745297609744385",
    template_id: "5745297609744384",
    name: "Jamie Lannister",
    tax_id: "012.345.678-90",
    nominal_amount: 100000,
    tax_amount: 626,
    amount: 99374,
    interest: 38.61,
    nominal_interest: 30.69,
    status: "signed",
    external_id: "my-internal-id-123456",
    scheduled: "2022-06-28T00:00:00.000000+00:00",
    expiration: 604800,
    payment_type: "transfer",
    created: "2022-06-01T00:00:00.000000+00:00",
    updated: "2022-06-02T00:00:00.000000+00:00"
}
  

C#

CreditNote(
    Id: 5745297609744385,
    TemplateId: 5745297609744384,
    Name: Jamie Lannister,
    TaxId: 012.345.678-90,
    NominalAmount: 100000,
    TaxAmount: 626,
    Amount: 99374,
    Interest: 38.61,
    NominalInterest: 30.69,
    Status: signed,
    ExternalId: my-internal-id-123456,
    Scheduled: 2022-06-28T00:00:00.000000+00:00,
    Expiration: 604800,
    PaymentType: transfer,
    Created: 2022-06-01T00:00:00.000000+00:00,
    Updated: 2022-06-02T00:00:00.000000+00:00
)
  

Go

{
    Id:5745297609744385
    TemplateId:5745297609744384
    Name:Jamie Lannister
    TaxId:012.345.678-90
    NominalAmount:100000
    TaxAmount:626
    Amount:99374
    Interest:38.61
    NominalInterest:30.69
    Status:signed
    ExternalId:my-internal-id-123456
    Scheduled:2022-06-28T00:00:00.000000+00:00
    Expiration:604800
    PaymentType:transfer
    Created:2022-06-01T00:00:00.000000+00:00
    Updated:2022-06-02T00:00:00.000000+00:00
}
  

Clojure

{:id "5745297609744385",
 :template-id "5745297609744384",
 :name "Jamie Lannister",
 :tax-id "012.345.678-90",
 :nominal-amount 100000,
 :tax-amount 626,
 :amount 99374,
 :interest 38.61,
 :nominal-interest 30.69,
 :status "signed",
 :external-id "my-internal-id-123456",
 :scheduled "2022-06-28T00:00:00.000000+00:00",
 :expiration 604800,
 :payment-type "transfer",
 :created "2022-06-01T00:00:00.000000+00:00",
 :updated "2022-06-02T00:00:00.000000+00:00"}
  

Curl

{
    "cursor": null,
    "notes": [
        {
            "id": "5745297609744385",
            "templateId": "5745297609744384",
            "name": "Jamie Lannister",
            "taxId": "012.345.678-90",
            "nominalAmount": 100000,
            "taxAmount": 626,
            "amount": 99374,
            "interest": 38.61,
            "nominalInterest": 30.69,
            "status": "signed",
            "externalId": "my-internal-id-123456",
            "scheduled": "2022-06-28T00:00:00.000000+00:00",
            "expiration": 604800,
            "paymentType": "transfer",
            "created": "2022-06-01T00:00:00.000000+00:00",
            "updated": "2022-06-02T00:00:00.000000+00:00"
        }
    ]
}
  

Get a Credit Note

Get a single credit note by its id.

ENDPOINT
GET /v2/credit-note/:id
REQUEST

Python

import starkinfra

note = starkinfra.creditnote.get("5745297609744385")

print(note)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let note = await starkinfra.creditNote.get('5745297609744385');
    console.log(note);
})();
  

PHP

$note = StarkInfra\CreditNote::get("5745297609744385");

print_r($note);
  

Java

import com.starkinfra.*;

CreditNote note = CreditNote.get("5745297609744385");

System.out.println(note);
  

Ruby

require('starkinfra')

note = StarkInfra::CreditNote.get('5745297609744385')

puts note
  

Elixir

note = StarkInfra.CreditNote.get!("5745297609744385")

note |> IO.inspect
  

C#

using System;

StarkInfra.CreditNote note = StarkInfra.CreditNote.Get("5745297609744385");

Console.WriteLine(note);
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditnote"
)

func main() {

    note, err := creditnote.Get("5745297609744385", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def note (starkinfra.credit-note/get "5745297609744385"))
(println note)
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-note/5745297609744385' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

CreditNote(
    id=5745297609744385,
    template_id=5745297609744384,
    name=Jamie Lannister,
    tax_id=012.345.678-90,
    nominal_amount=100000,
    tax_amount=626,
    amount=99374,
    interest=38.61,
    nominal_interest=30.69,
    status=signed,
    signers=[{id: 6306107546853376, name: Jamie Lannister, method: link, contact: jamie.lannister@gmail.com, signed: 2022-06-02T00:00:00.000000+00:00}],
    document_id=07d05b14-9d83-4439-9622-d2b313b05a10,
    external_id=my-internal-id-123456,
    scheduled=2022-06-28T00:00:00.000000+00:00,
    expiration=604800,
    payment_type=transfer,
    created=2022-06-01T00:00:00.000000+00:00,
    updated=2022-06-02T00:00:00.000000+00:00
)
  

Javascript

CreditNote {
    id: '5745297609744385',
    templateId: '5745297609744384',
    name: 'Jamie Lannister',
    taxId: '012.345.678-90',
    nominalAmount: 100000,
    taxAmount: 626,
    amount: 99374,
    interest: 38.61,
    nominalInterest: 30.69,
    status: 'signed',
    signers: [{id: '6306107546853376', name: 'Jamie Lannister', method: 'link', contact: 'jamie.lannister@gmail.com', signed: '2022-06-02T00:00:00.000000+00:00'}],
    documentId: '07d05b14-9d83-4439-9622-d2b313b05a10',
    externalId: 'my-internal-id-123456',
    scheduled: '2022-06-28T00:00:00.000000+00:00',
    expiration: 604800,
    paymentType: 'transfer',
    created: '2022-06-01T00:00:00.000000+00:00',
    updated: '2022-06-02T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditNote Object
(
    [id] => 5745297609744385
    [templateId] => 5745297609744384
    [name] => Jamie Lannister
    [taxId] => 012.345.678-90
    [nominalAmount] => 100000
    [taxAmount] => 626
    [amount] => 99374
    [interest] => 38.61
    [nominalInterest] => 30.69
    [status] => signed
    [signers] => Array([0] => Array([id] => 6306107546853376, [name] => Jamie Lannister, [method] => link, [contact] => jamie.lannister@gmail.com, [signed] => 2022-06-02T00:00:00.000000+00:00))
    [documentId] => 07d05b14-9d83-4439-9622-d2b313b05a10
    [externalId] => my-internal-id-123456
    [scheduled] => 2022-06-28T00:00:00.000000+00:00
    [expiration] => 604800
    [paymentType] => transfer
    [created] => 2022-06-01T00:00:00.000000+00:00
    [updated] => 2022-06-02T00:00:00.000000+00:00
)
  

Java

CreditNote({
    "id": "5745297609744385",
    "templateId": "5745297609744384",
    "name": "Jamie Lannister",
    "taxId": "012.345.678-90",
    "nominalAmount": 100000,
    "taxAmount": 626,
    "amount": 99374,
    "interest": 38.61,
    "nominalInterest": 30.69,
    "status": "signed",
    "signers": [{"id": "6306107546853376", "name": "Jamie Lannister", "method": "link", "contact": "jamie.lannister@gmail.com", "signed": "2022-06-02T00:00:00.000000+00:00"}],
    "documentId": "07d05b14-9d83-4439-9622-d2b313b05a10",
    "externalId": "my-internal-id-123456",
    "scheduled": "2022-06-28T00:00:00.000000+00:00",
    "expiration": 604800,
    "paymentType": "transfer",
    "created": "2022-06-01T00:00:00.000000+00:00",
    "updated": "2022-06-02T00:00:00.000000+00:00"
})
  

Ruby

credit_note(
    id: 5745297609744385,
    template_id: 5745297609744384,
    name: Jamie Lannister,
    tax_id: 012.345.678-90,
    nominal_amount: 100000,
    tax_amount: 626,
    amount: 99374,
    interest: 38.61,
    nominal_interest: 30.69,
    status: signed,
    signers: [{id: 6306107546853376, name: Jamie Lannister, method: link, contact: jamie.lannister@gmail.com, signed: 2022-06-02T00:00:00.000000+00:00}],
    document_id: 07d05b14-9d83-4439-9622-d2b313b05a10,
    external_id: my-internal-id-123456,
    scheduled: 2022-06-28T00:00:00.000000+00:00,
    expiration: 604800,
    payment_type: transfer,
    created: 2022-06-01T00:00:00.000000+00:00,
    updated: 2022-06-02T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditNote{
    id: "5745297609744385",
    template_id: "5745297609744384",
    name: "Jamie Lannister",
    tax_id: "012.345.678-90",
    nominal_amount: 100000,
    tax_amount: 626,
    amount: 99374,
    interest: 38.61,
    nominal_interest: 30.69,
    status: "signed",
    signers: [%{id: "6306107546853376", name: "Jamie Lannister", method: "link", contact: "jamie.lannister@gmail.com", signed: "2022-06-02T00:00:00.000000+00:00"}],
    document_id: "07d05b14-9d83-4439-9622-d2b313b05a10",
    external_id: "my-internal-id-123456",
    scheduled: "2022-06-28T00:00:00.000000+00:00",
    expiration: 604800,
    payment_type: "transfer",
    created: "2022-06-01T00:00:00.000000+00:00",
    updated: "2022-06-02T00:00:00.000000+00:00"
}
  

C#

CreditNote(
    Id: 5745297609744385,
    TemplateId: 5745297609744384,
    Name: Jamie Lannister,
    TaxId: 012.345.678-90,
    NominalAmount: 100000,
    TaxAmount: 626,
    Amount: 99374,
    Interest: 38.61,
    NominalInterest: 30.69,
    Status: signed,
    Signers: [{Id: 6306107546853376, Name: Jamie Lannister, Method: link, Contact: jamie.lannister@gmail.com, Signed: 2022-06-02T00:00:00.000000+00:00}],
    DocumentId: 07d05b14-9d83-4439-9622-d2b313b05a10,
    ExternalId: my-internal-id-123456,
    Scheduled: 2022-06-28T00:00:00.000000+00:00,
    Expiration: 604800,
    PaymentType: transfer,
    Created: 2022-06-01T00:00:00.000000+00:00,
    Updated: 2022-06-02T00:00:00.000000+00:00
)
  

Go

{
    Id:5745297609744385
    TemplateId:5745297609744384
    Name:Jamie Lannister
    TaxId:012.345.678-90
    NominalAmount:100000
    TaxAmount:626
    Amount:99374
    Interest:38.61
    NominalInterest:30.69
    Status:signed
    Signers:[{Id:6306107546853376 Name:Jamie Lannister Method:link Contact:jamie.lannister@gmail.com Signed:2022-06-02T00:00:00.000000+00:00}]
    DocumentId:07d05b14-9d83-4439-9622-d2b313b05a10
    ExternalId:my-internal-id-123456
    Scheduled:2022-06-28T00:00:00.000000+00:00
    Expiration:604800
    PaymentType:transfer
    Created:2022-06-01T00:00:00.000000+00:00
    Updated:2022-06-02T00:00:00.000000+00:00
}
  

Clojure

{:id "5745297609744385",
 :template-id "5745297609744384",
 :name "Jamie Lannister",
 :tax-id "012.345.678-90",
 :nominal-amount 100000,
 :tax-amount 626,
 :amount 99374,
 :interest 38.61,
 :nominal-interest 30.69,
 :status "signed",
 :signers [{:id "6306107546853376" :name "Jamie Lannister" :method "link" :contact "jamie.lannister@gmail.com" :signed "2022-06-02T00:00:00.000000+00:00"}],
 :document-id "07d05b14-9d83-4439-9622-d2b313b05a10",
 :external-id "my-internal-id-123456",
 :scheduled "2022-06-28T00:00:00.000000+00:00",
 :expiration 604800,
 :payment-type "transfer",
 :created "2022-06-01T00:00:00.000000+00:00",
 :updated "2022-06-02T00:00:00.000000+00:00"}
  

Curl

{
    "note": {
        "id": "5745297609744385",
        "templateId": "5745297609744384",
        "name": "Jamie Lannister",
        "taxId": "012.345.678-90",
        "rules": [],
        "tags": [],
        "streetLine1": "Av. Paulista, 200",
        "streetLine2": "Apto. 51",
        "district": "Bela Vista",
        "city": "Sao Paulo",
        "stateCode": "SP",
        "zipCode": "01310-100",
        "nominalAmount": 100000,
        "rebateAmount": 0,
        "taxAmount": 626,
        "amount": 99374,
        "interest": 38.61,
        "nominalInterest": 30.69,
        "externalId": "my-internal-id-123456",
        "signers": [
            {"id": "6306107546853376", "name": "Jamie Lannister", "method": "link", "contact": "jamie.lannister@gmail.com", "signed": "2022-06-02T00:00:00.000000+00:00"}
        ],
        "invoices": [
            {"id": "5155165527080960", "amount": 102612, "due": "2022-07-28", "fine": 2.0, "interest": 1.0}
        ],
        "payment": {"id": "", "status": "", "amount": 99374, "name": "Jamie Lannister", "taxId": "012.345.678-90", "bankCode": "20018183", "branchCode": "1234", "accountNumber": "129340-1"},
        "paymentType": "transfer",
        "status": "signed",
        "scheduled": "2022-06-28T00:00:00.000000+00:00",
        "expiration": 604800,
        "documentId": "07d05b14-9d83-4439-9622-d2b313b05a10",
        "workspaceId": "6341320293482496",
        "debtorWorkspaceId": "6341320293482496",
        "transactionIds": [],
        "created": "2022-06-01T00:00:00.000000+00:00",
        "updated": "2022-06-02T00:00:00.000000+00:00"
    }
}
  

Cancel a Credit Note

Cancel a credit note that has not reached a final status yet. Credit notes with status "created", "signed" or "processing" can be canceled, which also cancels the signing document. Credit notes with status "success", "failed", "expired" or already "canceled" are returned unchanged.

ENDPOINT
DELETE /v2/credit-note/:id
REQUEST

Python

import starkinfra

note = starkinfra.creditnote.cancel("5745297609744385")

print(note)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let note = await starkinfra.creditNote.cancel('5745297609744385');
    console.log(note);
})();
  

PHP

$note = StarkInfra\CreditNote::cancel("5745297609744385");

print_r($note);
  

Java

import com.starkinfra.*;

CreditNote note = CreditNote.cancel("5745297609744385");

System.out.println(note);
  

Ruby

require('starkinfra')

note = StarkInfra::CreditNote.cancel('5745297609744385')

puts note
  

Elixir

note = StarkInfra.CreditNote.cancel!("5745297609744385")

note |> IO.inspect
  

C#

using System;

StarkInfra.CreditNote note = StarkInfra.CreditNote.Cancel("5745297609744385");

Console.WriteLine(note);
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/creditnote"
)

func main() {

    note, err := creditnote.Cancel("5745297609744385", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def note (starkinfra.credit-note/cancel "5745297609744385"))
(println note)
  

Curl

curl --location --request DELETE '{{baseUrl}}/v2/credit-note/5745297609744385' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

CreditNote(
    id=5745297609744385,
    template_id=5745297609744384,
    name=Jamie Lannister,
    tax_id=012.345.678-90,
    nominal_amount=100000,
    status=canceled,
    external_id=my-internal-id-123456,
    created=2022-06-01T00:00:00.000000+00:00,
    updated=2022-06-03T00:00:00.000000+00:00
)
  

Javascript

CreditNote {
    id: '5745297609744385',
    templateId: '5745297609744384',
    name: 'Jamie Lannister',
    taxId: '012.345.678-90',
    nominalAmount: 100000,
    status: 'canceled',
    externalId: 'my-internal-id-123456',
    created: '2022-06-01T00:00:00.000000+00:00',
    updated: '2022-06-03T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditNote Object
(
    [id] => 5745297609744385
    [templateId] => 5745297609744384
    [name] => Jamie Lannister
    [taxId] => 012.345.678-90
    [nominalAmount] => 100000
    [status] => canceled
    [externalId] => my-internal-id-123456
    [created] => 2022-06-01T00:00:00.000000+00:00
    [updated] => 2022-06-03T00:00:00.000000+00:00
)
  

Java

CreditNote({
    "id": "5745297609744385",
    "templateId": "5745297609744384",
    "name": "Jamie Lannister",
    "taxId": "012.345.678-90",
    "nominalAmount": 100000,
    "status": "canceled",
    "externalId": "my-internal-id-123456",
    "created": "2022-06-01T00:00:00.000000+00:00",
    "updated": "2022-06-03T00:00:00.000000+00:00"
})
  

Ruby

credit_note(
    id: 5745297609744385,
    template_id: 5745297609744384,
    name: Jamie Lannister,
    tax_id: 012.345.678-90,
    nominal_amount: 100000,
    status: canceled,
    external_id: my-internal-id-123456,
    created: 2022-06-01T00:00:00.000000+00:00,
    updated: 2022-06-03T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditNote{
    id: "5745297609744385",
    template_id: "5745297609744384",
    name: "Jamie Lannister",
    tax_id: "012.345.678-90",
    nominal_amount: 100000,
    status: "canceled",
    external_id: "my-internal-id-123456",
    created: "2022-06-01T00:00:00.000000+00:00",
    updated: "2022-06-03T00:00:00.000000+00:00"
}
  

C#

CreditNote(
    Id: 5745297609744385,
    TemplateId: 5745297609744384,
    Name: Jamie Lannister,
    TaxId: 012.345.678-90,
    NominalAmount: 100000,
    Status: canceled,
    ExternalId: my-internal-id-123456,
    Created: 2022-06-01T00:00:00.000000+00:00,
    Updated: 2022-06-03T00:00:00.000000+00:00
)
  

Go

{
    Id:5745297609744385
    TemplateId:5745297609744384
    Name:Jamie Lannister
    TaxId:012.345.678-90
    NominalAmount:100000
    Status:canceled
    ExternalId:my-internal-id-123456
    Created:2022-06-01T00:00:00.000000+00:00
    Updated:2022-06-03T00:00:00.000000+00:00
}
  

Clojure

{:id "5745297609744385",
 :template-id "5745297609744384",
 :name "Jamie Lannister",
 :tax-id "012.345.678-90",
 :nominal-amount 100000,
 :status "canceled",
 :external-id "my-internal-id-123456",
 :created "2022-06-01T00:00:00.000000+00:00",
 :updated "2022-06-03T00:00:00.000000+00:00"}
  

Curl

{
    "note": {
        "id": "5745297609744385",
        "templateId": "5745297609744384",
        "name": "Jamie Lannister",
        "taxId": "012.345.678-90",
        "nominalAmount": 100000,
        "status": "canceled",
        "externalId": "my-internal-id-123456",
        "created": "2022-06-01T00:00:00.000000+00:00",
        "updated": "2022-06-03T00:00:00.000000+00:00"
    }
}
  

Get a Credit Note PDF

Get the CCB contract PDF file of a credit note. After all signers have signed, the returned file carries the digital signatures.

ENDPOINT
GET /v2/credit-note/:id/pdf
REQUEST

Python

import starkinfra

pdf = starkinfra.creditnote.pdf("5745297609744385")

with open("credit-note.pdf", "wb") as file:
    file.write(pdf)
  

Javascript

const starkinfra = require('starkinfra');
const fs = require('fs').promises;

(async() => {
    let pdf = await starkinfra.creditNote.pdf('5745297609744385');
    await fs.writeFile('credit-note.pdf', pdf);
})();
  

PHP

$pdf = StarkInfra\CreditNote::pdf("5745297609744385");

$fp = fopen('credit-note.pdf', 'w');
fwrite($fp, $pdf);
fclose($fp);
  

Java

import com.starkinfra.*;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;

InputStream pdf = CreditNote.pdf("5745297609744385");

Files.copy(pdf, new File("credit-note.pdf").toPath(), StandardCopyOption.REPLACE_EXISTING);
  

Ruby

require('starkinfra')

pdf = StarkInfra::CreditNote.pdf('5745297609744385')

File.binwrite('credit-note.pdf', pdf)
  

Elixir

pdf = StarkInfra.CreditNote.pdf!("5745297609744385")

file = File.open!("credit-note.pdf", [:write])
IO.binwrite(file, pdf)
File.close(file)
  

C#

using System;
using System.IO;

byte[] pdf = StarkInfra.CreditNote.Pdf("5745297609744385");

File.WriteAllBytes("credit-note.pdf", pdf);
  

Go

package main

import (
    "fmt"
    "os"
    "github.com/starkinfra/sdk-go/starkinfra/creditnote"
)

func main() {

    pdf, err := creditnote.Pdf("5745297609744385", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    errFile := os.WriteFile("credit-note.pdf", pdf, 0666)
    if errFile != nil {
        fmt.Print(errFile)
    }
}
  

Clojure

(def pdf (starkinfra.credit-note/pdf "5745297609744385"))
(clojure.java.io/copy pdf (clojure.java.io/file "credit-note.pdf"))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-note/5745297609744385/pdf' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--output credit-note.pdf
  
RESPONSE

Python

(binary PDF file content)
  

Javascript

(binary PDF file content)
  

PHP

(binary PDF file content)
  

Java

(binary PDF file content)
  

Ruby

(binary PDF file content)
  

Elixir

(binary PDF file content)
  

C#

(binary PDF file content)
  

Go

(binary PDF file content)
  

Clojure

(binary PDF file content)
  

Curl

(binary PDF file content)
  

Get a Credit Note Payment PDF

Get the disbursement transfer receipt PDF file of a credit note. Only available for credit notes with status "success".

ENDPOINT
GET /v2/credit-note/:id/payment/pdf
REQUEST

Python

import starkinfra

pdf = starkinfra.request.get(
    path="/credit-note/5745297609744385/payment/pdf"
).content

with open("credit-note-payment.pdf", "wb") as file:
    file.write(pdf)
  

Javascript

const starkinfra = require('starkinfra');
const fs = require('fs').promises;

(async() => {
    let pdf = await starkinfra.request.get('/credit-note/5745297609744385/payment/pdf');
    await fs.writeFile('credit-note-payment.pdf', pdf);
})();
  

PHP

$pdf = StarkInfra\Request::get("/credit-note/5745297609744385/payment/pdf");

$fp = fopen('credit-note-payment.pdf', 'w');
fwrite($fp, $pdf);
fclose($fp);
  

Java

import com.starkinfra.*;

String pdf = Request.get("/credit-note/5745297609744385/payment/pdf").content();
  

Ruby

require('starkinfra')

pdf = StarkInfra::Request.get('/credit-note/5745297609744385/payment/pdf')

File.binwrite('credit-note-payment.pdf', pdf)
  

Elixir

pdf = StarkInfra.Request.get!("/credit-note/5745297609744385/payment/pdf")

file = File.open!("credit-note-payment.pdf", [:write])
IO.binwrite(file, pdf)
File.close(file)
  

C#

using System;
using System.IO;

string pdf = StarkInfra.Request.Get("/credit-note/5745297609744385/payment/pdf");
  

Go

package main

import (
    "fmt"
    "github.com/starkinfra/sdk-go/starkinfra/request"
)

func main() {

    pdf, err := request.Get("/credit-note/5745297609744385/payment/pdf", nil, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def pdf (starkinfra.request/get "/credit-note/5745297609744385/payment/pdf"))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-note/5745297609744385/payment/pdf' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--output credit-note-payment.pdf
  
RESPONSE

Python

(binary PDF file content)
  

Javascript

(binary PDF file content)
  

PHP

(binary PDF file content)
  

Java

(binary PDF file content)
  

Ruby

(binary PDF file content)
  

Elixir

(binary PDF file content)
  

C#

(binary PDF file content)
  

Go

(binary PDF file content)
  

Clojure

(binary PDF file content)
  

Curl

(binary PDF file content)
  

List Credit Note Logs

Get a paged list of all credit note logs. A log tracks a change in the credit note entity according to its life cycle, as {"id", "type", "errors", "note", "created"} objects.

ENDPOINT
GET /v2/credit-note/log
REQUEST

Python

import starkinfra

logs = starkinfra.creditnote.log.query(
    limit=10,
    note_ids=["5745297609744385"],
    types=["signed"]
)

for log in logs:
    print(log)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let logs = await starkinfra.creditNote.log.query({
        limit: 10,
        noteIds: ['5745297609744385'],
        types: ['signed']
    });

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

PHP

$logs = StarkInfra\CreditNote\Log::query([
    "limit" => 10,
    "noteIds" => ["5745297609744385"],
    "types" => ["signed"]
]);

foreach ($logs as $log) {
    print_r($log);
}
  

Java

import com.starkinfra.*;
import java.util.HashMap;
import java.util.Arrays;

HashMap<String, Object> params = new HashMap<>();
params.put("limit", 10);
params.put("noteIds", Arrays.asList("5745297609744385"));
params.put("types", Arrays.asList("signed"));

Generator<CreditNote.Log> logs = CreditNote.Log.query(params);

for (CreditNote.Log log : logs) {
    System.out.println(log);
}
  

Ruby

require('starkinfra')

logs = StarkInfra::CreditNote::Log.query(
    limit: 10,
    note_ids: ['5745297609744385'],
    types: ['signed']
)

logs.each do |log|
    puts log
end
  

Elixir

logs = StarkInfra.CreditNote.Log.query!(
    limit: 10,
    note_ids: ["5745297609744385"],
    types: ["signed"]
)

for log <- logs do
    log |> IO.inspect
end
  

C#

using System;
using System.Collections.Generic;

IEnumerable<StarkInfra.CreditNote.Log> logs = StarkInfra.CreditNote.Log.Query(
    limit: 10,
    noteIds: new List<string> { "5745297609744385" },
    types: new List<string> { "signed" }
);

foreach (StarkInfra.CreditNote.Log log in logs) {
    Console.WriteLine(log);
}
  

Go

package main

import (
    "fmt"
    creditNoteLog "github.com/starkinfra/sdk-go/starkinfra/creditnote/log"
)

func main() {

    var params = map[string]interface{}{}
    params["limit"] = 10
    params["noteIds"] = []string{"5745297609744385"}
    params["types"] = []string{"signed"}

    logs := creditNoteLog.Query(params, nil)

    for log := range logs {
        fmt.Printf("%+v", log)
    }
}
  

Clojure

(def logs
  (starkinfra.credit-note.log/query
    {
      :limit 10
      :note-ids ["5745297609744385"]
      :types ["signed"]
    }))
(dorun (map println logs))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-note/log?limit=10¬eIds=5745297609744385&types=signed' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

Log(
    id=6532638269505536,
    type=signed,
    errors=[],
    note=CreditNote(
        id=5745297609744385,
        name=Jamie Lannister,
        status=signed
    ),
    created=2022-06-02T00:00:00.000000+00:00
)
  

Javascript

CreditNoteLog {
    id: '6532638269505536',
    type: 'signed',
    errors: [],
    note: CreditNote {
        id: '5745297609744385',
        name: 'Jamie Lannister',
        status: 'signed'
    },
    created: '2022-06-02T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditNote\Log Object
(
    [id] => 6532638269505536
    [type] => signed
    [errors] => Array()
    [note] => StarkInfra\CreditNote Object
        (
            [id] => 5745297609744385
            [name] => Jamie Lannister
            [status] => signed
        )
    [created] => 2022-06-02T00:00:00.000000+00:00
)
  

Java

Log({
    "id": "6532638269505536",
    "type": "signed",
    "errors": [],
    "note": {
        "id": "5745297609744385",
        "name": "Jamie Lannister",
        "status": "signed"
    },
    "created": "2022-06-02T00:00:00.000000+00:00"
})
  

Ruby

credit_note_log(
    id: 6532638269505536,
    type: signed,
    errors: [],
    note: credit_note(
        id: 5745297609744385,
        name: Jamie Lannister,
        status: signed
    ),
    created: 2022-06-02T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditNote.Log{
    id: "6532638269505536",
    type: "signed",
    errors: [],
    note: %StarkInfra.CreditNote{
        id: "5745297609744385",
        name: "Jamie Lannister",
        status: "signed"
    },
    created: "2022-06-02T00:00:00.000000+00:00"
}
  

C#

Log(
    Id: 6532638269505536,
    Type: signed,
    Errors: [],
    Note: CreditNote(
        Id: 5745297609744385,
        Name: Jamie Lannister,
        Status: signed
    ),
    Created: 2022-06-02T00:00:00.000000+00:00
)
  

Go

{
    Id:6532638269505536
    Type:signed
    Errors:[]
    Note:{
        Id:5745297609744385
        Name:Jamie Lannister
        Status:signed
    }
    Created:2022-06-02T00:00:00.000000+00:00
}
  

Clojure

{:id "6532638269505536",
 :type "signed",
 :errors [],
 :note {:id "5745297609744385",
        :name "Jamie Lannister",
        :status "signed"},
 :created "2022-06-02T00:00:00.000000+00:00"}
  

Curl

{
    "cursor": null,
    "logs": [
        {
            "id": "6532638269505536",
            "type": "signed",
            "errors": [],
            "note": {
                "id": "5745297609744385",
                "name": "Jamie Lannister",
                "status": "signed"
            },
            "created": "2022-06-02T00:00:00.000000+00:00"
        }
    ]
}
  

Get a Credit Note Log

Get a single credit note log by its id.

ENDPOINT
GET /v2/credit-note/log/:id
REQUEST

Python

import starkinfra

log = starkinfra.creditnote.log.get("6532638269505536")

print(log)
  

Javascript

const starkinfra = require('starkinfra');

(async() => {
    let log = await starkinfra.creditNote.log.get('6532638269505536');
    console.log(log);
})();
  

PHP

$log = StarkInfra\CreditNote\Log::get("6532638269505536");

print_r($log);
  

Java

import com.starkinfra.*;

CreditNote.Log log = CreditNote.Log.get("6532638269505536");

System.out.println(log);
  

Ruby

require('starkinfra')

log = StarkInfra::CreditNote::Log.get('6532638269505536')

puts log
  

Elixir

log = StarkInfra.CreditNote.Log.get!("6532638269505536")

log |> IO.inspect
  

C#

using System;

StarkInfra.CreditNote.Log log = StarkInfra.CreditNote.Log.Get("6532638269505536");

Console.WriteLine(log);
  

Go

package main

import (
    "fmt"
    creditNoteLog "github.com/starkinfra/sdk-go/starkinfra/creditnote/log"
)

func main() {

    log, err := creditNoteLog.Get("6532638269505536", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def log (starkinfra.credit-note.log/get "6532638269505536"))
(println log)
  

Curl

curl --location --request GET '{{baseUrl}}/v2/credit-note/log/6532638269505536' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

Log(
    id=6532638269505536,
    type=signed,
    errors=[],
    note=CreditNote(
        id=5745297609744385,
        name=Jamie Lannister,
        status=signed
    ),
    created=2022-06-02T00:00:00.000000+00:00
)
  

Javascript

CreditNoteLog {
    id: '6532638269505536',
    type: 'signed',
    errors: [],
    note: CreditNote {
        id: '5745297609744385',
        name: 'Jamie Lannister',
        status: 'signed'
    },
    created: '2022-06-02T00:00:00.000000+00:00'
}
  

PHP

StarkInfra\CreditNote\Log Object
(
    [id] => 6532638269505536
    [type] => signed
    [errors] => Array()
    [note] => StarkInfra\CreditNote Object
        (
            [id] => 5745297609744385
            [name] => Jamie Lannister
            [status] => signed
        )
    [created] => 2022-06-02T00:00:00.000000+00:00
)
  

Java

Log({
    "id": "6532638269505536",
    "type": "signed",
    "errors": [],
    "note": {
        "id": "5745297609744385",
        "name": "Jamie Lannister",
        "status": "signed"
    },
    "created": "2022-06-02T00:00:00.000000+00:00"
})
  

Ruby

credit_note_log(
    id: 6532638269505536,
    type: signed,
    errors: [],
    note: credit_note(
        id: 5745297609744385,
        name: Jamie Lannister,
        status: signed
    ),
    created: 2022-06-02T00:00:00.000000+00:00
)
  

Elixir

%StarkInfra.CreditNote.Log{
    id: "6532638269505536",
    type: "signed",
    errors: [],
    note: %StarkInfra.CreditNote{
        id: "5745297609744385",
        name: "Jamie Lannister",
        status: "signed"
    },
    created: "2022-06-02T00:00:00.000000+00:00"
}
  

C#

Log(
    Id: 6532638269505536,
    Type: signed,
    Errors: [],
    Note: CreditNote(
        Id: 5745297609744385,
        Name: Jamie Lannister,
        Status: signed
    ),
    Created: 2022-06-02T00:00:00.000000+00:00
)
  

Go

{
    Id:6532638269505536
    Type:signed
    Errors:[]
    Note:{
        Id:5745297609744385
        Name:Jamie Lannister
        Status:signed
    }
    Created:2022-06-02T00:00:00.000000+00:00
}
  

Clojure

{:id "6532638269505536",
 :type "signed",
 :errors [],
 :note {:id "5745297609744385",
        :name "Jamie Lannister",
        :status "signed"},
 :created "2022-06-02T00:00:00.000000+00:00"}
  

Curl

{
    "log": {
        "id": "6532638269505536",
        "type": "signed",
        "errors": [],
        "note": {
            "id": "5745297609744385",
            "name": "Jamie Lannister",
            "status": "signed"
        },
        "created": "2022-06-02T00:00:00.000000+00:00"
    }
}