- addMetadataOnTransaction - Set the metadata of a transaction by its ID
- addMetadataToAccount - Add metadata to an account
- countAccounts - Count the accounts from a ledger
- countTransactions - Count the transactions from a ledger
- createBulk - Bulk request
- createExporter - Create exporter
- createLedger - Create a ledger
- createPipeline - Create pipeline
- createTransaction - Create a new transaction to a ledger
- deleteAccountMetadata - Delete metadata by key
- deleteBucket - Delete bucket
- deleteExporter - Delete exporter
- deleteLedgerMetadata - Delete ledger metadata by key
- deletePipeline - Delete pipeline
- deleteTransactionMetadata - Delete metadata by key
- exportLogs - Export logs
- getAccount - Get account by its address
- getBalancesAggregated - Get the aggregated balances from selected accounts
- getExporterState - Get exporter state
- getLedger - Get a ledger
- getLedgerInfo - Get information about a ledger
- getPipelineState - Get pipeline state
- getSchema - Get a schema for a ledger by version
- getTransaction - Get transaction from a ledger by its ID
- getVolumesWithBalances - Get list of volumes with balances for (account/asset)
- importLogs
- insertSchema - Insert a schema for a ledger
- listAccounts - List accounts from a ledger
- listExporters - List exporters
- listLedgers - List ledgers
- listLogs - List the logs from a ledger
- listPipelines - List pipelines
- listSchemas - List all schemas for a ledger
- listTransactions - List transactions from a ledger
- readStats - Get statistics from a ledger
- resetPipeline - Reset pipeline
- restoreBucket - Restore bucket
- revertTransaction - Revert a ledger transaction by its ID
- runQuery - Run a query template
- startPipeline - Start pipeline
- stopPipeline - Stop pipeline
- updateExporter - Update exporter
- updateLedgerMetadata - Update ledger metadata
Set the metadata of a transaction by its ID
declare(strict_types=1);
require 'vendor/autoload.php';
use Brick\Math\BigInteger;
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2AddMetadataOnTransactionRequest(
requestBody: [
'admin' => 'true',
],
dryRun: true,
id: BigInteger::of('1234'),
ledger: 'ledger001',
schemaVersion: 'v1.0.0',
);
$response = $sdk->ledger->v2->addMetadataOnTransaction(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2AddMetadataOnTransactionRequest | ✔️ | The request object to use for the request. |
?Operations\V2AddMetadataOnTransactionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Add metadata to an account
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2AddMetadataToAccountRequest(
requestBody: [
'admin' => 'true',
],
address: 'users:001',
dryRun: true,
ledger: 'ledger001',
schemaVersion: 'v1.0.0',
);
$response = $sdk->ledger->v2->addMetadataToAccount(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2AddMetadataToAccountRequest | ✔️ | The request object to use for the request. |
?Operations\V2AddMetadataToAccountResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Count the accounts from a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2CountAccountsRequest(
requestBody: [
'key' => '<value>',
'key1' => '<value>',
],
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->countAccounts(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2CountAccountsRequest | ✔️ | The request object to use for the request. |
?Operations\V2CountAccountsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Count the transactions from a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2CountTransactionsRequest(
requestBody: [
'key' => '<value>',
],
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->countTransactions(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2CountTransactionsRequest | ✔️ | The request object to use for the request. |
?Operations\V2CountTransactionsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Bulk request
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Ledger;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2CreateBulkRequest(
requestBody: [
new \formance\stack\Models\Ledger\V2BulkElementCreateTransaction(
action: 'REVERT_TRANSACTION',
),
],
atomic: true,
continueOnFailure: true,
ledger: 'ledger001',
parallel: true,
schemaVersion: 'v1.0.0',
);
$response = $sdk->ledger->v2->createBulk(
request: $request
);
if ($response->v2BulkResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2CreateBulkRequest | ✔️ | The request object to use for the request. |
?Operations\V2CreateBulkResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Create exporter
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Ledger;
$sdk = stack\SDK::builder()->build();
$request = new \formance\stack\Models\Ledger\V2ExporterConfiguration(
config: [
'key' => '<value>',
],
driver: '<value>',
);
$response = $sdk->ledger->v2->createExporter(
request: $request
);
if ($response->v2CreateExporterResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
\formance\stack\Models\Ledger\V2ExporterConfiguration | ✔️ | The request object to use for the request. |
?Operations\V2CreateExporterResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Create a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Ledger;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2CreateLedgerRequest(
v2CreateLedgerRequest: new \formance\stack\Models\Ledger\V2CreateLedgerRequest(
metadata: [
'admin' => 'true',
],
),
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->createLedger(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2CreateLedgerRequest | ✔️ | The request object to use for the request. |
?Operations\V2CreateLedgerResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Create pipeline
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2CreatePipelineRequest(
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->createPipeline(
request: $request
);
if ($response->v2CreatePipelineResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2CreatePipelineRequest | ✔️ | The request object to use for the request. |
?Operations\V2CreatePipelineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Create a new transaction to a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use Brick\Math\BigInteger;
use formance\stack;
use formance\stack\Models\Ledger;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2CreateTransactionRequest(
v2PostTransaction: new \formance\stack\Models\Ledger\V2PostTransaction(
accountMetadata: [
'key' => [
'admin' => 'true',
],
'key1' => [
'admin' => 'true',
],
'key2' => [
'admin' => 'true',
],
],
metadata: [
'admin' => 'true',
],
postings: [
new \formance\stack\Models\Ledger\V2Posting(
amount: BigInteger::of('100'),
asset: 'COIN',
destination: 'users:002',
source: 'users:001',
),
],
reference: 'ref:001',
script: new Ledger\V2PostTransactionScript(
plain: 'vars {\naccount $user\n}\nsend [COIN 10] (\n source = @world\n destination = $user\n)\n',
template: 'CUSTOMER_DEPOSIT',
vars: [
'user' => 'users:042',
],
),
),
dryRun: true,
force: true,
ledger: 'ledger001',
schemaVersion: 'v1.0.0',
);
$response = $sdk->ledger->v2->createTransaction(
request: $request
);
if ($response->v2CreateTransactionResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2CreateTransactionRequest | ✔️ | The request object to use for the request. |
?Operations\V2CreateTransactionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Delete metadata by key
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2DeleteAccountMetadataRequest(
address: '6753 S Washington Street',
key: 'foo',
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->deleteAccountMetadata(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2DeleteAccountMetadataRequest | ✔️ | The request object to use for the request. |
?Operations\V2DeleteAccountMetadataResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Delete a bucket by marking all ledgers in the bucket as deleted (soft delete). All ledgers in the bucket will have their deleted_at field set to the current timestamp.
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2DeleteBucketRequest(
bucket: '<value>',
);
$response = $sdk->ledger->v2->deleteBucket(
request: $request
);
if ($response->v2ErrorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2DeleteBucketRequest | ✔️ | The request object to use for the request. |
?Operations\V2DeleteBucketResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Delete exporter
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2DeleteExporterRequest(
exporterID: '<id>',
);
$response = $sdk->ledger->v2->deleteExporter(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2DeleteExporterRequest | ✔️ | The request object to use for the request. |
?Operations\V2DeleteExporterResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Delete ledger metadata by key
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2DeleteLedgerMetadataRequest(
key: 'foo',
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->deleteLedgerMetadata(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2DeleteLedgerMetadataRequest | ✔️ | The request object to use for the request. |
?Operations\V2DeleteLedgerMetadataResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Delete pipeline
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2DeletePipelineRequest(
ledger: 'ledger001',
pipelineID: '<id>',
);
$response = $sdk->ledger->v2->deletePipeline(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2DeletePipelineRequest | ✔️ | The request object to use for the request. |
?Operations\V2DeletePipelineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Delete metadata by key
declare(strict_types=1);
require 'vendor/autoload.php';
use Brick\Math\BigInteger;
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2DeleteTransactionMetadataRequest(
id: BigInteger::of('1234'),
key: 'foo',
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->deleteTransactionMetadata(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2DeleteTransactionMetadataRequest | ✔️ | The request object to use for the request. |
?Operations\V2DeleteTransactionMetadataResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Export logs
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ExportLogsRequest(
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->exportLogs(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ExportLogsRequest | ✔️ | The request object to use for the request. |
?Operations\V2ExportLogsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\SDKException | 4XX, 5XX | */* |
Get account by its address
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2GetAccountRequest(
address: 'users:001',
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->getAccount(
request: $request
);
if ($response->v2AccountResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetAccountRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetAccountResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get the aggregated balances from selected accounts
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2GetBalancesAggregatedRequest(
requestBody: [
'key' => '<value>',
'key1' => '<value>',
'key2' => '<value>',
],
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->getBalancesAggregated(
request: $request
);
if ($response->v2AggregateBalancesResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetBalancesAggregatedRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetBalancesAggregatedResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get exporter state
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2GetExporterStateRequest(
exporterID: '<id>',
);
$response = $sdk->ledger->v2->getExporterState(
request: $request
);
if ($response->v2GetExporterStateResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetExporterStateRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetExporterStateResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2GetLedgerRequest(
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->getLedger(
request: $request
);
if ($response->v2GetLedgerResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetLedgerRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetLedgerResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get information about a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2GetLedgerInfoRequest(
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->getLedgerInfo(
request: $request
);
if ($response->v2LedgerInfoResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetLedgerInfoRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetLedgerInfoResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get pipeline state
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2GetPipelineStateRequest(
ledger: 'ledger001',
pipelineID: '<id>',
);
$response = $sdk->ledger->v2->getPipelineState(
request: $request
);
if ($response->v2GetPipelineStateResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetPipelineStateRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetPipelineStateResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get a schema for a ledger by version
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2GetSchemaRequest(
ledger: 'ledger001',
version: 'v1.0.0',
);
$response = $sdk->ledger->v2->getSchema(
request: $request
);
if ($response->v2SchemaResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetSchemaRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetSchemaResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get transaction from a ledger by its ID
declare(strict_types=1);
require 'vendor/autoload.php';
use Brick\Math\BigInteger;
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2GetTransactionRequest(
id: BigInteger::of('1234'),
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->getTransaction(
request: $request
);
if ($response->v2GetTransactionResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetTransactionRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetTransactionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get list of volumes with balances for (account/asset)
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2GetVolumesWithBalancesRequest(
requestBody: [
'key' => '<value>',
],
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
groupBy: 3,
ledger: 'ledger001',
pageSize: 100,
sort: 'id:desc',
);
$response = $sdk->ledger->v2->getVolumesWithBalances(
request: $request
);
if ($response->v2VolumesWithBalanceCursorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2GetVolumesWithBalancesRequest | ✔️ | The request object to use for the request. |
?Operations\V2GetVolumesWithBalancesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ImportLogsRequest(
v2ImportLogsRequest: '0xde3EDEE9e6',
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->importLogs(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ImportLogsRequest | ✔️ | The request object to use for the request. |
?Operations\V2ImportLogsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Insert a schema for a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Ledger;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2InsertSchemaRequest(
v2SchemaData: new \formance\stack\Models\Ledger\V2SchemaData(
chart: [
'users' => new \formance\stack\Models\Ledger\V2ChartSegment(
additionalProperties: [
'$userID' => new \formance\stack\Models\Ledger\V2ChartSegment(
dotPattern: '^[0-9]{16}$',
),
],
),
],
queries: [
'key' => new \formance\stack\Models\Ledger\V2QueryTemplate(
params: new Ledger\QueryTemplateAccountParams(
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
pageSize: 100,
sort: 'id:desc',
),
),
],
),
ledger: 'ledger001',
version: 'v1.0.0',
);
$response = $sdk->ledger->v2->insertSchema(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2InsertSchemaRequest | ✔️ | The request object to use for the request. |
?Operations\V2InsertSchemaResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
List accounts from a ledger, sorted by address in descending order.
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ListAccountsRequest(
requestBody: [
],
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
ledger: 'ledger001',
pageSize: 100,
sort: 'id:desc',
);
$response = $sdk->ledger->v2->listAccounts(
request: $request
);
if ($response->v2AccountsCursorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ListAccountsRequest | ✔️ | The request object to use for the request. |
?Operations\V2ListAccountsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
List exporters
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
$sdk = stack\SDK::builder()->build();
$response = $sdk->ledger->v2->listExporters(
);
if ($response->v2ExportersCursorResponse !== null) {
// handle response
}?Operations\V2ListExportersResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
List ledgers
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ListLedgersRequest(
requestBody: [
'key' => '<value>',
'key1' => '<value>',
'key2' => '<value>',
],
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
pageSize: 100,
sort: 'id:desc',
);
$response = $sdk->ledger->v2->listLedgers(
request: $request
);
if ($response->v2LedgerListResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ListLedgersRequest | ✔️ | The request object to use for the request. |
?Operations\V2ListLedgersResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
List the logs from a ledger, sorted by ID in descending order.
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ListLogsRequest(
requestBody: [
],
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
ledger: 'ledger001',
pageSize: 100,
sort: 'id:desc',
);
$response = $sdk->ledger->v2->listLogs(
request: $request
);
if ($response->v2LogsCursorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ListLogsRequest | ✔️ | The request object to use for the request. |
?Operations\V2ListLogsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
List pipelines
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2ListPipelinesRequest(
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->listPipelines(
request: $request
);
if ($response->v2PipelinesCursorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ListPipelinesRequest | ✔️ | The request object to use for the request. |
?Operations\V2ListPipelinesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
List all schemas for a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ListSchemasRequest(
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->listSchemas(
request: $request
);
if ($response->v2SchemasCursorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ListSchemasRequest | ✔️ | The request object to use for the request. |
?Operations\V2ListSchemasResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
List transactions from a ledger, sorted by id in descending order.
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ListTransactionsRequest(
requestBody: [
],
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
ledger: 'ledger001',
pageSize: 100,
sort: 'id:desc',
);
$response = $sdk->ledger->v2->listTransactions(
request: $request
);
if ($response->v2TransactionsCursorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ListTransactionsRequest | ✔️ | The request object to use for the request. |
?Operations\V2ListTransactionsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Get statistics from a ledger. (aggregate metrics on accounts and transactions)
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2ReadStatsRequest(
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->readStats(
request: $request
);
if ($response->v2StatsResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ReadStatsRequest | ✔️ | The request object to use for the request. |
?Operations\V2ReadStatsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Reset pipeline
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2ResetPipelineRequest(
ledger: 'ledger001',
pipelineID: '<id>',
);
$response = $sdk->ledger->v2->resetPipeline(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2ResetPipelineRequest | ✔️ | The request object to use for the request. |
?Operations\V2ResetPipelineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Restore a deleted bucket by unmarking all ledgers in the bucket as deleted. All ledgers in the bucket will have their deleted_at field set to NULL.
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2RestoreBucketRequest(
bucket: '<value>',
);
$response = $sdk->ledger->v2->restoreBucket(
request: $request
);
if ($response->v2ErrorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2RestoreBucketRequest | ✔️ | The request object to use for the request. |
?Operations\V2RestoreBucketResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Revert a ledger transaction by its ID
declare(strict_types=1);
require 'vendor/autoload.php';
use Brick\Math\BigInteger;
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2RevertTransactionRequest(
dryRun: true,
id: BigInteger::of('1234'),
ledger: 'ledger001',
schemaVersion: 'v1.0.0',
);
$response = $sdk->ledger->v2->revertTransaction(
request: $request
);
if ($response->v2CreateTransactionResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2RevertTransactionRequest | ✔️ | The request object to use for the request. |
?Operations\V2RevertTransactionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Run a query template on a ledger
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Ledger;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2RunQueryRequest(
requestBody: new Operations\V2RunQueryRequestBody(
params: new Ledger\QueryTemplateAccountParams(
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
pageSize: 100,
sort: 'id:desc',
),
),
cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
id: 'CUSTOMER_DEPOSIT',
ledger: 'ledger001',
pageSize: 100,
schemaVersion: 'v1.0.0',
sort: 'id:desc',
);
$response = $sdk->ledger->v2->runQuery(
request: $request
);
if ($response->oneOf !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2RunQueryRequest | ✔️ | The request object to use for the request. |
?Operations\V2RunQueryResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Start pipeline
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2StartPipelineRequest(
ledger: 'ledger001',
pipelineID: '<id>',
);
$response = $sdk->ledger->v2->startPipeline(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2StartPipelineRequest | ✔️ | The request object to use for the request. |
?Operations\V2StartPipelineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Stop pipeline
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
$sdk = stack\SDK::builder()->build();
$request = new Operations\V2StopPipelineRequest(
ledger: 'ledger001',
pipelineID: '<id>',
);
$response = $sdk->ledger->v2->stopPipeline(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2StopPipelineRequest | ✔️ | The request object to use for the request. |
?Operations\V2StopPipelineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Update exporter
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Ledger;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2UpdateExporterRequest(
v2ExporterConfiguration: new \formance\stack\Models\Ledger\V2ExporterConfiguration(
config: [
'key' => '<value>',
'key1' => '<value>',
'key2' => '<value>',
],
driver: '<value>',
),
exporterID: '<id>',
);
$response = $sdk->ledger->v2->updateExporter(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2UpdateExporterRequest | ✔️ | The request object to use for the request. |
?Operations\V2UpdateExporterResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Update ledger metadata
declare(strict_types=1);
require 'vendor/autoload.php';
use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;
$sdk = stack\SDK::builder()
->setSecurity(
new Shared\Security(
clientID: '<YOUR_CLIENT_ID_HERE>',
clientSecret: '<YOUR_CLIENT_SECRET_HERE>',
)
)
->build();
$request = new Operations\V2UpdateLedgerMetadataRequest(
requestBody: [
'admin' => 'true',
],
ledger: 'ledger001',
);
$response = $sdk->ledger->v2->updateLedgerMetadata(
request: $request
);
if ($response->v2ErrorResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\V2UpdateLedgerMetadataRequest | ✔️ | The request object to use for the request. |
?Operations\V2UpdateLedgerMetadataResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| \formance\stack\Models\Ledger\V2ErrorResponseError | default | application/json |
| Errors\SDKException | 4XX, 5XX | */* |