Transactions

Bulk commit inflight

Commit multiple independently-created inflight transactions with the Go SDK.

POST/transactions/inflight/bulk/commit

Use client.Transaction.BulkCommitInflight to commit multiple inflight transactions.

Call the method

result, _, _ := client.Transaction.BulkCommitInflight(
 blnkgo.BulkCommitInflightRequest{
	Transactions: []blnkgo.BulkCommitInflightItem{
	 {
		TransactionID: "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96",
	 },
	 {
		TransactionID: "txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6",
		Amount: 40,
	 },
	 {
		TransactionID: "txn_0b59f6e6-6c4a-4efa-915c-526f77ef",
		PreciseAmount: big.NewInt(125034),
	 },
	},
 },
)

Pass SkipQueue: true to process each commit synchronously instead of queuing.

result, _, _ := client.Transaction.BulkCommitInflight(
 blnkgo.BulkCommitInflightRequest{
	SkipQueue: true,
	Transactions: []blnkgo.BulkCommitInflightItem{
	 {
		TransactionID: "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96",
	 },
	 {
		TransactionID: "txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6",
		Amount: 40,
	 },
	},
 },
)

Preview every commit without settling any hold. Use BulkCommitInflightDryRun. See Dry-run transactions.

preview, _, _ := client.Transaction.BulkCommitInflightDryRun(
	blnkgo.BulkCommitInflightRequest{
		Transactions: []blnkgo.BulkCommitInflightItem{
			{
				TransactionID: "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96",
			},
			{
				TransactionID: "txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6",
			},
		},
	},
)
FieldTypeDescription
Transactions[]blnkgo.
BulkCommitInflightItem
Up to 100 inflight transactions to commit.
Transactions.
[].TransactionID
stringInflight transaction ID to commit.
Transactions.
[].Amount
float64Partial commit amount. Omit to commit the full remaining inflight amount.
Transactions.
[].PreciseAmount
*big.IntPrecision-applied partial commit amount. Takes precedence over Amount.
SkipQueueboolWhen true, process synchronously instead of queuing.

Review per-item results

On a posted batch, check result.Results for each transaction’s outcome.

A dry run has no succeeded or failed counts. Check WouldApply and Results.

Response

{
  "succeeded": 2,
  "failed": 1,
  "results": [
    {
      "transaction_id": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b96",
      "status": "succeeded"
    },
    {
      "transaction_id": "txn_6164573b-6cc8-45a4-ad2e-7b4ba6a6",
      "status": "succeeded"
    },
    {
      "transaction_id": "txn_0b59f6e6-6c4a-4efa-915c-526f77ef",
      "status": "failed",
      "code": "INVALID_AMOUNT",
      "message": "cannot commit more than inflight amount"
    }
  ]
}

Go response (*blnkgo.BulkCommitInflightResponse)

FieldTypeDescription
SucceededintNumber committed successfully.
FailedintNumber that failed.
Results[]blnkgo.
BulkCommitInflightResult
Per-transaction outcome in request order.
Results.
[].TransactionID
stringTransaction ID from the request.
Results.
[].Status
stringsucceeded or failed.
Results.
[].Code
stringFailure code (for example NOT_FOUND, ALREADY_VOIDED, INVALID_AMOUNT).
Results.
[].Message
stringHuman-readable failure message.
{
  "dry_run": true,
  "would_apply": true,
  "cumulative": false,
  "atomic": false,
  "results": [
    {
      "dry_run": true,
      "would_apply": true,
      "operation": "commit",
      "status": "APPLIED",
      "reference": "ref_hold_001",
      "currency": "USD",
      "amount": 120,
      "precise_amount": "12000",
      "precision": 100
    }
  ]
}