Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,58 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Added
- BusinessIdentity and BusinessAttachment resources
### Added
- IssuingBillingInvoice resource
### Changed
- url attribute to IssuingToken resource
- installmentCount attribute to IssuingPurchase resource
- PixPullSubscription resource
- PixPullRequest resource
- IssuingStockRule resource

## [0.17.0] - 2026-06-30
### Added
- IssuingBillingInvoice resource
- IssuingBillingTransaction resource
### Changed
- url attribute to IssuingToken resource
- installmentCount attribute to IssuingPurchase resource
- BusinessIdentity and BusinessAttachment resources
- PixPullSubscription resource
- PixPullRequest resource
- IssuingStockRule resource
- PixFraud.Log resource
- PixKeyHolmes resource
- PixInternalTransactionReport resource
- PixInternalTransactionReport.Log resource
- priority and reason attributes to PixRequest resource
- rules and debtorWorkspaceId parameters to CreditNote resource
- Ledger resource
- LedgerLog resource
- LedgerTransaction resource

## [0.17.0] - 2026-06-30
### Added
- IssuingBillingInvoice resource
- IssuingBillingTransaction resource
### Changed
- url attribute to IssuingToken resource
- installmentCount attribute to IssuingPurchase resource
- BusinessIdentity and BusinessAttachment resources
- PixPullSubscription resource
- PixPullRequest resource
- IssuingStockRule resource
- PixFraud.Log resource
- PixKeyHolmes resource
- PixInternalTransactionReport resource
- PixInternalTransactionReport.Log resource
- priority and reason attributes to PixRequest resource
- rules and debtorWorkspaceId parameters to CreditNote resource
- Ledger resource
- LedgerLog resource
- LedgerTransaction resource

## [0.17.0] - 2026-06-30
### Added
Expand Down
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ This SDK version is compatible with the Stark Infra API v2.
- [TokenDesign](#get-an-issuingtokendesign): View your current token card arts
- [Purchases](#process-purchase-authorizations): Authorize and view your past purchases
- [Invoices](#create-issuinginvoices): Add money to your issuing balance
- [BillingInvoices](#query-issuingbillinginvoices): View the Pix invoices that charge for your issuing operation
- [BillingTransactions](#query-issuingbillingtransactions): View the transactions that compose your issuing billing invoices
- [Withdrawals](#create-issuingwithdrawals): Send money back to your Workspace from your issuing balance
- [Balance](#get-your-issuingbalance): View your issuing balance
- [Transactions](#query-issuingtransactions): View the transactions that have affected your issuing balance
Expand Down Expand Up @@ -1273,6 +1275,74 @@ $log = IssuingInvoice\Log::get("5155165527080960");
print_r($log);
```

### Query IssuingBillingInvoices

You can get a list of the Pix invoices that charge for your issuing operation given some filters.

```php
use StarkInfra\IssuingBillingInvoice;

$invoices = IssuingBillingInvoice::query([
"limit" => 10,
"after" => "2020-04-01",
"before" => "2020-04-30",
"status" => ["paid", "expired"],
"tags" => ['iron', 'suit'],
]);

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

### Get an IssuingBillingInvoice

After its creation, information on a billing invoice may be retrieved by its id.

```php
use StarkInfra\IssuingBillingInvoice;

$invoice = IssuingBillingInvoice::get("5155165527080960");

print_r($invoice);
```

### Query IssuingBillingTransactions

You can get a list of the transactions that compose your issuing billing invoices given some filters.

```php
use StarkInfra\IssuingBillingTransaction;

$transactions = IssuingBillingTransaction::query([
"limit" => 10,
"after" => "2020-04-01",
"before" => "2020-04-30",
"invoiceId" => "5656565656565656",
"tags" => ['iron', 'suit'],
]);

foreach ($transactions as $transaction) {
print_r($transaction);
}
```

### Query IssuingBillingTransactions page

You can also get a list of the transactions one page at a time and manually control the cursor.

```php
use StarkInfra\IssuingBillingTransaction;

list($transactions, $cursor) = IssuingBillingTransaction::page([
"limit" => 5,
]);

foreach ($transactions as $transaction) {
print_r($transaction);
}
```

### Create IssuingWithdrawals

You can create withdrawals to send cash back from your Issuing balance to your Banking balance
Expand Down
6 changes: 6 additions & 0 deletions src/issuingBalance/issuingBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class IssuingBalance extends Resource
{

public $amount;
public $limit;
public $maxLimit;
public $currency;
public $updated;

Expand All @@ -24,6 +26,8 @@ class IssuingBalance extends Resource
## Attributes (return-only):
- id [string]: unique id returned when IssuingBalance is created. ex: "5656565656565656"
- amount [integer]: current issuing balance amount of the workspace in cents. ex: 200 (= R$ 2.00)
- limit [integer]: Spending limit of the balance
- maxLimit [integer]: Maximum spending limit. This field is currently always equal to limit
- currency [string]: currency of the current workspace. Expect others to be added eventually. ex: "BRL"
- updated [DateTime]: update datetime for the IssuingBalance.
*/
Expand All @@ -32,6 +36,8 @@ function __construct(array $params)
parent::__construct($params);

$this->amount = Checks::checkParam($params, "amount");
$this->limit = Checks::checkParam($params, "limit");
$this->maxLimit = Checks::checkParam($params, "maxLimit");
$this->currency = Checks::checkParam($params, "currency");
$this->updated = Checks::checkDateTime(Checks::checkParam($params, "updated"));

Expand Down
153 changes: 153 additions & 0 deletions src/issuingBillingInvoice/issuingBillingInvoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?php

namespace StarkInfra;
use StarkInfra\Utils\Rest;
use StarkCore\Utils\Checks;
use StarkCore\Utils\Resource;
use StarkCore\Utils\StarkDate;


class IssuingBillingInvoice extends Resource
{

public $taxId;
public $name;
public $fine;
public $interest;
public $status;
public $amount;
public $nominalAmount;
public $brcode;
public $link;
public $due;
public $start;
public $end;
public $created;
public $updated;

/**
# IssuingBillingInvoice object

The IssuingBillingInvoice objects created in your Workspace are the Pix invoices
used to charge for your issuing operation.

## Attributes (return-only):
-id [string]: unique id returned when the IssuingBillingInvoice is created. ex: "5656565656565656"
-taxId [string]: payer tax ID (CPF or CNPJ). ex: "012.345.678-90"
-name [string]: payer name. ex: "Tony Stark"
-fine [float]: Fine percentage applied when paid after the due date. ex: 2.0
-interest [float]: Monthly interest percentage applied when paid after the due date. ex: 1.0
-status [string]: current IssuingBillingInvoice status. ex: "paid" or "expired"
-amount [integer]: invoice amount in cents. ex: 11234 (= R$ 112.34)
-nominalAmount [integer]: nominal invoice amount in cents. ex: 11234 (= R$ 112.34)
-brcode [string]: BR Code for the invoice payment. ex: "00020101021226930014br.gov.bcb.pix..."
-link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.sandbox.starkbank.com/billinginvoicelink/97de4d51e8984c459639a645ce920abb"
-due [DateTime]: invoice due datetime.
-start [DateTime]: billing cycle start datetime.
-end [DateTime]: billing cycle end datetime.
-created [DateTime]: creation datetime for the IssuingBillingInvoice.
-updated [DateTime]: latest update datetime for the IssuingBillingInvoice.
*/
function __construct(array $params)
{
parent::__construct($params);

$this->taxId = Checks::checkParam($params, "taxId");
$this->name = Checks::checkParam($params, "name");
$this->fine = Checks::checkParam($params, "fine");
$this->interest = Checks::checkParam($params, "interest");
$this->status = Checks::checkParam($params, "status");
$this->amount = Checks::checkParam($params, "amount");
$this->nominalAmount = Checks::checkParam($params, "nominalAmount");
$this->brcode = Checks::checkParam($params, "brcode");
$this->link = Checks::checkParam($params, "link");
$this->due = Checks::checkDateTime(Checks::checkParam($params, "due"));
$this->start = Checks::checkDateTime(Checks::checkParam($params, "start"));
$this->end = Checks::checkDateTime(Checks::checkParam($params, "end"));
$this->created = Checks::checkDateTime(Checks::checkParam($params, "created"));
$this->updated = Checks::checkDateTime(Checks::checkParam($params, "updated"));

Checks::checkParams($params);
}

/**
# Retrieve a specific IssuingBillingInvoice

Receive a single IssuingBillingInvoice object previously created in the Stark Infra API by passing its id

## Parameters (required):
- id [string]: object unique id. ex: "5656565656565656"

## Parameters (optional):
- user [Organization/Project object, default null]: Organization or Project object. Not necessary if StarkInfra\Settings::setUser() was used before function call

## Return:
- IssuingBillingInvoice object with updated attributes
*/
public static function get($id, $user = null)
{
return Rest::getId($user, IssuingBillingInvoice::resource(), $id);
}

/**
# Retrieve IssuingBillingInvoices

Receive an enumerator of IssuingBillingInvoice objects previously created in the Stark Infra API

## Parameters (optional):
- limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
- after [Date or string, default null]: date filter for objects created only after specified date. ex: "2020-04-03"
- before [Date or string, default null]: date filter for objects created only before specified date. ex: "2020-04-03"
- status [array of strings, default null]: filter for status of retrieved objects. ex: ["paid", "expired"]
- tags [array of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"]
- ids [array of strings, default null]: array of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- user [Organization/Project object, default null]: Organization or Project object. Not necessary if StarkInfra\Settings::setUser() was used before function call

## Return:
- enumerator of IssuingBillingInvoice objects with updated attributes
*/
public static function query($options = [], $user = null)
{
$options["after"] = new StarkDate(Checks::checkParam($options, "after"));
$options["before"] = new StarkDate(Checks::checkParam($options, "before"));
return Rest::getList($user, IssuingBillingInvoice::resource(), $options);
}

/**
# Retrieve paged IssuingBillingInvoices

Receive a list of up to 100 IssuingBillingInvoice objects previously created in the Stark Infra API and the cursor to the next page.
Use this function instead of query if you want to manually page your requests.

## Parameters (optional):
- cursor [string, default null]: cursor returned on the previous page function call
- limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 50
- after [Date or string, default null]: date filter for objects created only after specified date. ex: "2020-04-03"
- before [Date or string, default null]: date filter for objects created only before specified date. ex: "2020-04-03"
- status [array of strings, default null]: filter for status of retrieved objects. ex: ["paid", "expired"]
- tags [array of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"]
- ids [array of strings, default null]: array of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- user [Organization/Project object, default null]: Organization or Project object. Not necessary if StarkInfra\Settings::setUser() was used before function call

## Return:
- list of IssuingBillingInvoice objects with updated attributes
- cursor to retrieve the next page of IssuingBillingInvoice objects
*/
public static function page($options = [], $user = null)
{
$options["after"] = new StarkDate(Checks::checkParam($options, "after"));
$options["before"] = new StarkDate(Checks::checkParam($options, "before"));
return Rest::getPage($user, IssuingBillingInvoice::resource(), $options);
}

private static function resource()
{
$invoice = function ($array) {
return new IssuingBillingInvoice($array);
};
return [
"name" => "IssuingBillingInvoice",
"maker" => $invoice,
];
}
}
Loading