Transactions

Bulk transactions

Submit multiple transactions in one request with the Go SDK.

POST/transactions/bulk

Use client.Transaction.CreateBulk to create many transactions in one request (up to blnkgo.MaxBulkCreateItems, 10,000 per request).

Call the method

result, _, _ := client.Transaction.CreateBulk(blnkgo.CreateBulkTransactionRequest{
	Atomic: true,
	Transactions: []blnkgo.CreateTransactionRequest{
		{
			ParentTransaction: blnkgo.ParentTransaction{
				Amount: 1000,
				Precision: 100,
				Currency: "USD",
				Source: "@source_1",
				Destination: "@dest_1",
				Reference: "bulk_001",
				Description: "Payment 1",
			},
		},
		{
			ParentTransaction: blnkgo.ParentTransaction{
				Amount: 2000,
				Precision: 100,
				Currency: "USD",
				Source: "@source_2",
				Destination: "@dest_2",
				Reference: "bulk_002",
				Description: "Payment 2",
			},
		},
	},
})
FieldTypeDescription
Transactions[]blnkgo.
CreateTransactionRequest
Transaction objects to create; up to 10,000 per request (blnkgo.MaxBulkCreateItems). References must be unique within the batch.
AtomicboolWhen true, every transaction succeeds or fails together.
InflightboolWhen true, transactions are created in INFLIGHT status for a later commit or void.
RunAsyncboolWhen true, Core processes the batch in the background and returns status: "queued".
SkipQueueboolWhen true, transactions bypass the queue and process synchronously.

Preview the batch without writing anything. Use CreateBulkDryRun. SkipQueue selects cumulative vs independent projection. RunAsync is ignored. See Dry-run transactions.

preview, _, _ := client.Transaction.CreateBulkDryRun(blnkgo.CreateBulkTransactionRequest{
	SkipQueue: false,
	Transactions: []blnkgo.CreateTransactionRequest{
		{
			ParentTransaction: blnkgo.ParentTransaction{
				PreciseAmount: big.NewInt(45000),
				Precision:     100,
				Currency:      "USD",
				Source:        "bln_source-bal-001",
				Destination:   "bln_dest-bal-001",
				Reference:     "ref_payout_450",
				Description:   "First payout",
			},
		},
		{
			ParentTransaction: blnkgo.ParentTransaction{
				PreciseAmount: big.NewInt(10000),
				Precision:     100,
				Currency:      "USD",
				Source:        "bln_source-bal-001",
				Destination:   "bln_dest-bal-002",
				Reference:     "ref_payout_100",
				Description:   "Second payout",
			},
		},
	},
})

Save the batch ID

On a posted batch, use result.BatchID as parent transaction to find child transactions.

A dry run has no BatchID. Check WouldApply and Results.

Response

{
  "batch_id": "bulk_c62f200b-905f-4983-a349-cadd279234aa",
  "status": "applied",
  "transaction_count": 4
}
{
  "batch_id": "bulk_c62f200b-905f-4983-a349-cadd279234aa",
  "status": "queued",
  "message": "Bulk transaction processing started"
}

Go response (*blnkgo.CreateBulkTransactionResponse)

FieldTypeDescription
BatchIDstringIdentifier for the batch. Use as ParentTransactionID to find child transactions, or with Update to commit or void an inflight batch.
Statusstringapplied, inflight, or queued depending on the batch.
TransactionCountintNumber of transactions when processed synchronously.
MessagestringStatus message when RunAsync is true.
{
  "dry_run": true,
  "would_apply": true,
  "cumulative": false,
  "atomic": false,
  "results": [
    {
      "dry_run": true,
      "would_apply": true,
      "status": "APPLIED",
      "reference": "ref_payout_450",
      "currency": "USD",
      "amount": 450,
      "precise_amount": "45000",
      "precision": 100
    },
    {
      "dry_run": true,
      "would_apply": true,
      "status": "APPLIED",
      "reference": "ref_payout_100",
      "currency": "USD",
      "amount": 100,
      "precise_amount": "10000",
      "precision": 100
    }
  ]
}