Supplier agent ships a PO line, settlement releases at scan
Goods scanned by the 3PL. Receipt + USDC settlement fire in one APEX transaction. No invoice ever.
01Scenario
A supplier closes an Order line in Salesforce when a 3PL scan event hits the Platform Event bus. The buyer's PO terms include a Hive-Nano payment instruction — pay on shipment, not on net-30 invoice.
The Salesforce Flow fires HiveNanoSettle.settle with the OrderItem's negotiated unit price in micro-USDC. The receipt records the carrier, tracking number, scan timestamp, and product hash. The buyer's Salesforce org sees an INBOUND receipt with both the proof of shipment and the proof of payment.
AP reconciles against the receipt's tx_hash and the carrier scan reference. Disputes (short ship, damage, returns) generate a counter-receipt with type order.line.dispute and reverse settlement.
02Handles
03APEX
OrderItem item = [SELECT Id, OrderId, Quantity, UnitPrice,
Product2.Name, Order.AccountId
FROM OrderItem WHERE Id = :orderItemId];
Map<String, Object> payload = new Map<String, Object>{
'order_id' => item.OrderId,
'orderitem_id' => item.Id,
'product' => item.Product2.Name,
'qty' => item.Quantity,
'unit_micro' => Math.round(item.UnitPrice * 1000000),
'carrier' => carrierCode,
'tracking_no' => trackingNumber,
'scan_ts' => scanTimestamp,
'incoterms' => 'FCA'
};
Long totalMicro = (Long)(item.Quantity * item.UnitPrice * 1000000);
HiveNanoSettleResult res = HiveNanoSettle.settle(
item.OrderId,
'order.line.shipped',
'did:hive:0xBuyerAPAgent',
'0xBuyerTreasuryWallet',
totalMicro,
'salesforce:orderitem:' + item.Id,
payload
);
// AP gets paid the moment the scan fires.
// Buyer org receives INBOUND receipt with tx_hash + carrier ref.
04Flow XML
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<processType>AutoLaunchedFlow</processType>
<start>
<connector><targetReference>nano_settle_shipment</targetReference></connector>
<object>OrderItem</object>
<recordTriggerType>UpdatedAndConditionMet</recordTriggerType>
<filters>
<field>Status</field><operator>EqualTo</operator>
<value><stringValue>Shipped</stringValue></value>
</filters>
<triggerType>RecordAfterSave</triggerType>
</start>
<actionCalls>
<name>nano_settle_shipment</name>
<label>Settle shipment on Base</label>
<actionName>HiveNanoSettle</actionName>
<actionType>apex</actionType>
</actionCalls>
<status>Active</status>
</Flow>
05The receipt that lands in Hive_Receipt__c
{
"agent_id": "did:hive:0xSupplierAgent",
"counterparty_did": "did:hive:0xBuyerAPAgent",
"action_type": "order.line.shipped",
"scope": "salesforce:orderitem:802xxxxxx",
"action_ref": "sha256(...)",
"settlement_tx_hash": "0xa2f1...44de",
"settlement_amount_micro": 14999000,
"settlement_chain": "base-mainnet",
"settlement_token": "USDC",
"verification_status": "VERIFIED"
}
06Verification
Trace the order line from scan to settlement
# Fetch the receipt curl -sS https://api.basescan.org/api?module=transaction\&action=gettxinfo\&txhash=0xa2f1...44de | jq # AP reconciliation script ./scripts/reconcile.sh --receipt order_line_shipped_receipt.json --po PO-2026-04412
07Economics
| Per-line settlement | On-chain USDC, sub-cent gas |
| Hive take | 0% |
| Net terms eliminated | Days-sales-outstanding goes from 30-45 days to seconds |
| Dispute window | Buyer can mint order.line.dispute within negotiated window for reverse settlement |
| Currency | Buyer + supplier negotiate USDC / EURC / PYUSD |
08Compliance and audit shape
- Receipt encodes incoterms, carrier, scan event — defensible against ASC 606 revenue recognition audits.
- Trade receivables vanish from the buyer's books; cash + receipt replace AR.
- Cross-border: jurisdiction field allows US-state vs EU-IE vs APAC routing for tax shape.
09Trust anchors
Every claim on this page is verifiable against these public constants. No login. No NDA.
| Rail | NANO — on-chain USDC on Base |
| Hive Ed25519 pubkey | fd9d10abe60de7510c61ef649c8da598a519468dd2a2b827106d76487a899444 |
| Canonicalization | RFC 8785 JCS over the JSON receipt body |
| Signature algorithm | Ed25519 (RFC 8032) |
| Backend root | https://hivemorph.onrender.com |
| Verify any receipt | thehiveryiq.com/verify |
| MIT starter | thehiveryiq.com/salesforce/install |
| Chain | Base (Ethereum L2, chain id 8453) |
| USDC contract | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| Hive treasury wallet | 0x15184Bf50B3d3F52b60434f8942b7D52F2eB436E |
| Builder split | 80% publisher / 20% Hive, enforced at the rail on the same transaction |