Integrating Stablecoins into Your App: From USDC Payment to Service Access

Integrating Stablecoins into Your App: From USDC Payment to Service Access

1. Add “Pay with USDC” to your app

What would you implement if you added a “Pay with USDC” button to the app you are building?
Consider an API service that sells usage packs. A customer selects a 100 USDC payment at checkout and uses their wallet, an app for managing assets, to review and authorise the transfer. We begin with a customer who already holds USDC in that wallet. The app confirms receipt and enables that customer's usage pack. The customer can now use the API, while the operator can review the invoice, payment and access entitlement in the admin view.
Accept the USDC in a customer's wallet as payment for your app, then use that payment to unlock the functionality they purchased. Integrating stablecoins into an app means building this complete flow.

Figure 1 | Pay with USDC and start using the app

The same purchase in Example API moves through three screens: before the 100 USDC payment, payment confirmation in progress, and API access enabled. Once the entitlement is active, the customer can use the purchased service.
The previous article examined how stablecoins are changing corporate money movement and connections to banking. Here, we connect that same USD 100 invoice to a purchase in a service we are developing. Using a fictional service called “Example API,” we work through the customer app, server and admin view to build a flow that accepts USDC directly on Ethereum.
This is where RPC (Remote Procedure Call) is needed. It is the interface through which wallets and apps submit transactions to a blockchain and retrieve state and execution results. In this article, the wallet submits the payment through its own connection, and the server uses RPC to retrieve state and execution results. The server uses that information to decide whether payment for this purchase has been confirmed, then grants service access. [1]
We follow this one purchase throughout the example.
ItemPurchase terms for Example API
ProductA one-time purchase of a USD 100 API usage pack
Invoice IDINV-20261201-001
PaymentAn illustrative agreement accepts 100.000000 USDC as payment for this invoice
NetworkEthereum mainnet and Circle's official USDC
Transfer routeOne direct transfer from a payer's ordinary account (EOA), registered in advance, to the recipient
Fees and service accessThe payer separately pays the network fee in ETH. A finalised transfer is allocated to the invoice, and service access is enabled
USD 100 is the product price; 100 USDC is the token quantity accepted under this agreement. Receiving a net USD 100 in a bank account requires separate checks of the exchange rate, fees and payout terms. This purchase grants service access when the agreed USDC receipt is confirmed.
The purchaser registers the account they will pay from in advance and holds 100 USDC and ETH for the network fee in it. The server looks only for transfers from the registered account. USDC sent from an exchange or another account is not matched to this purchase, and service access is not enabled. Checkout therefore tells the customer to pay from the wallet holding the registered account. Section 4 shows how to register it.
The accompanying local application includes checkout, a server and an admin view. It implements entitlement creation and access to a sample API; usage metering and depletion are outside its scope. Signing, wallet and chain responses are simulated, so without private keys or real transfers you can follow a purchase through to service access and try approving, declining and losing the reply in a browser wallet. It does not reconstruct the internal implementation of the banks or payment providers discussed in the previous article.

Where to start in your role

The table below gives each role its entry point. Whatever your role, running the example once in Section 3 makes it easier to match the text to the code.
RoleWhat to read and which files to openFirst task
Frontend and UX: checkout UI, wallet, status display and wordingThe state table in Section 3; “Approve and submit in a browser wallet” in Section 4; Figure 5 in Section 7. public/wallet-adapter.js and its .d.ts types, public/app.jsTry approve, decline and a lost reply with the mock wallet, then carry each state’s display and wording into your own interface
Backend: orders, RPC monitoring, reconciliation and databaseSections 4 to 6. src/wallet.ts, src/payment.ts, src/ledger.tsBind a payment attempt to an existing order ID, check the registered account, and grant the entitlement once after finality
Payments and operations: invoices, mismatches and enquiriesThe state tables in Section 3; “Investigate in the admin view” in Section 7. The /admin view; customerView in src/application.tsWrite an enquiry procedure that looks up the state, reason, start time and last check from an invoice ID
Infrastructure: RPC connections, recovery and monitoringThe finality conditions in Section 5; Section 7; the monitoring paragraph in Section 8. The monitor in src/server.ts; eth_getLogs in src/wallet.tsCheck that your endpoint returns finalized blocks and historical logs, and measure the time to confirmation
The AI instructions cover incoming-payment verification (A, Section 5), the ledger (C, Section 6), lost wallet replies and recovery (B, Section 7) and RPC architecture (D, Section 8).

2. Apply your card payment integration experience to USDC payments

If you have integrated card payments, the work of creating an order, checking payment results on the server and providing the purchased service will be familiar. Stripe Checkout's official implementation example also shows a server retrieving payment status, granting access to a service and handling repeated processing of the same payment. [2]
With USDC, the app still needs to complete that purchase flow. In the direct RPC architecture used here, the server reads information from the chain and connects it to the app's own invoice.
Work performed by the appCard payments: an example using a payment provider's APIUSDC payments: this direct RPC architecture
Create a purchaseBind the app's order to the provider's checkout sessionSave the chain, asset, recipient and quantity with the app's invoice
Obtain customer approvalComplete the card payment process in the checkout interfaceReview and approve the transfer details in a wallet
Retrieve the payment resultThe server verifies webhook notifications and checks payment status through the APIThe server retrieves the transaction, execution result and token transfer through RPC
Associate it with the purchaseMatch the order to the provider's payment IDMatch the saved payment intent to the transaction and transfer evidence
Provide the serviceGrant the purchaser access onceGrant the purchaser access once
Let the operator review itShow the order, payment status and fulfilment status in the admin viewShow the invoice, payment confirmation status and service entitlement in the admin view
Reverse a paymentRefund through the provider’s API. A cardholder dispute (chargeback) reverses the paymentA finalised transfer cannot be reversed. A refund is a new transfer from the recipient
The card-payment column uses Stripe as a representative example. The source of payment results changes, but connecting the customer, product, invoice and service access remains the app's responsibility. A finalised Ethereum block, by contrast, cannot be reverted short of an economically infeasible attack, so a USDC refund is designed as a new payment. [2] [30] [15]
A payment provider can also handle USDC acceptance. Stripe documents stablecoin payments through Checkout and other interfaces. Where the supported regions and service terms fit, a merchant can connect the provider's payment IDs and statuses to its own app. Not every business needs to contract directly with an RPC provider and build its own monitoring. The choice depends on how much of acceptance and monitoring the business intends to handle itself. [3]
Here, we use RPC directly to learn how to integrate on-chain payment acceptance into our own app. RPC provides the chain connection. The wallet handles signing, the USDC contract updates balances, and the application server manages invoices and service access. The existing USDC contract's transfer function lets us add this payment method to an app we already have. [4]
This article covers a purchaser who pays on the spot from a browser wallet. When the payer is a program rather than a person, such as an automated job or an AI agent, signing and submission are divided differently, and that case is not covered here. The example also contains an exercise for that setup (see the example’s README).

3. Connect checkout, the server and the admin view

Example API has a checkout interface for customers and an admin view for operators. The application server manages the same purchase for both. The customer interface requests a purchase and subsequently asks the server for its status. The admin view uses a separate connection to retrieve invoice and entitlement records from that same server.
In this article, the purchaser’s browser wallet signs the transaction, submits it through its own connection and returns only the transaction hash to the app. Before asking the wallet, the application server saves the payment attempt; it treats the returned hash as a candidate and checks it before binding it to this purchase. This is how an ordinary web app connects to a wallet.

Figure 2 | The purchaser’s wallet sends; the server checks and connects everything through one purchase record

The customer checkout asks the browser wallet to approve a transaction built by the server. After the purchaser approves, the wallet signs, submits it to Ethereum through its own connection and returns a hash. The application server saves the payment attempt, checks and binds the candidate, and monitors it; its own RPC reads state and searches logs. The customer interface and the read-only admin view retrieve the same purchase record independently, and the API checks the saved entitlement. The USDC balance moves only inside Ethereum.
The server establishes the product, price and purchaser, then saves the payment attempt, which carries the invoice ID and terms. The ledger invoice is created when a transaction is bound. From those terms it builds the transaction the wallet is asked to approve. The hash the wallet returns is checked against the saved terms before it is bound, and payment reconciliation uses the same saved values.
The diagram’s communication lines carry purchase requests, the transaction handed to the wallet and the returned hash, and state and execution results. The funds move on Ethereum, where the USDC contract updates the payer’s and recipient’s balances. The application server reads that result and updates its own invoice and entitlement records. [4]
There is an important difference from card integration here. A standard ERC-20 Transfer event contains the sender, recipient and quantity. It does not contain the app's invoice ID or product ID. The app therefore needs to retain the association between this purchase and this payment in its own database. [4]
First, run a purchase from checkout to service access. The local example replaces the wallet and chain responses with simulations; it uses no private keys, signatures or transfers.
Extract the runnable example package and run the following commands from its directory in a development environment with Node.js 24.22.3 and npm already installed. TypeScript is the language used to write the code; Node.js is the environment that runs it.
bash
npm ci --ignore-scripts
npm run check
npm test
npm run web
Open http://127.0.0.1:4173/training in your browser. The example starts in a different exercise that does not use a wallet, so switch to the wallet exercise first.
  1. In /training, choose “Browser wallet (local mock)” and select Start new local exercise.
  2. On the checkout at http://127.0.0.1:4173/, select Pay with wallet. In the in-page mock wallet, choose the registered account (Connect 0x1111…1111 (registered)) and select Approve. The page changes to Confirming your payment, and API access is not yet allowed.
  3. Return to /training and select Advance fixture finality. This advances the example’s simulated chain response to finalised.
  4. The server’s monitor rechecks the bound transaction. When checkout changes to Your usage pack is ready, select Try the sample API. The server checks the entitlement and returns a sample result.
  5. Open http://127.0.0.1:4173/admin and confirm the payment, entitlement and accepted evidence for the same invoice.
The /training interface is specific to the example. It recreates successful payments, connection failures and mismatched terms by letting you change the simulated state that would normally advance on the chain. It is not a feature through which customers or operators finalise actual payment results. The mock wallet also lets you decline, lose the reply after approval, disconnect before sending, or connect an unregistered account. Exercises that do not use the wallet, such as Normal payment, supply a transaction from the example so that you can try the matching and the ledger (Section 8).
Both interfaces read the server's state. The example's purchase API does not accept an invoice amount, recipient, transaction hash or paid flag from the browser; it creates the purchase from the server's saved terms. In the wallet model, POST /api/wallet/start receives only the connected account, and repeating the request reuses the existing payment attempt. The example fixes one product and one invoice per exercise. A real product uses an order or payment-attempt ID for each purchase to distinguish retries of the same action from a separate purchase.
After payment, the customer interface retrieves the status of that same invoice. This call uses the example’s local customer context:
typescript
const response = await fetch('/api/invoices/INV-20261201-001', {
  headers: { 'x-fixture-session': 'shopper-fixture' },
});
const purchase = await response.json();
// purchase.payment: Purchase status shown to the customer.
// purchase.service.enabled: Whether the server has confirmed the entitlement.
This fixed header selects a role for testing. A real product uses its existing login and authorisation system so that customers can retrieve only their own invoices. The admin view uses administrator permissions.
Base the interface on the server’s purchase.payment.state. Customers see four states: not_started, pending, needs_review and paid. The table below lists, moment by moment, what the example’s screen says and who acts next.
Moment and stateWhat the screen says (summary of the example’s text)Who acts next
Before purchase: not_started“Add a usage pack”. Pay 100 USDC to enable a USD 100 API usage packThe customer starts the purchase
Awaiting approval: not_started“Approve the payment in your wallet”. Check the amount and network, then approve. If you already approved, do not pay againThe customer approves or declines
Declined: not_started“Payment not approved”. No payment was sent. The order is still savedThe customer; before asking again, the server checks whether anything was sent
A condition is missing: state unchangedFor example: the registered account needs more ETH for the fee. Nothing was sent. Add ETH, then try againThe customer fixes it and resumes
Confirming: pending“Confirming your payment”. You can close this page. If the wallet did not reply, do not pay againThe monitor keeps tracking the payment
Long wait: pendingThis is taking longer than usual, but there is no need to pay again. If it continues, contact support with the invoice IDOperations checks the saved transaction, RPC connection and finality
Needs review: needs_review“Your payment needs review”. The usage pack is not enabled. Do not pay again; keep the invoice ID and contact supportOperations collects the invoice ID, reason, observed values and times, and hands them to the payment-terms owner
Ready: paid“Your usage pack is ready”. Payment confirmedThe customer uses the API; the API checks the entitlement again
How these states map to the server’s internal records (the ledger hold and reason, and the wallet payment attempt’s state) is covered in “Investigate in the admin view” in Section 7.
When a customer closes the page and comes back, show this purchase’s state and next action before the product pitch, whatever the state. Build each message from server state; do not decide failure or completion from elapsed browser time alone. The example’s screen fetches the same invoice every 1.2 seconds. That interval is for the local exercise; in a real product, set it from the waiting times you measure in Section 5 and your server load. If the interface cannot retrieve state, show a connection error and retry the same invoice without changing payment state or entitlement. Updating the interface and monitoring the payment are separate processes: the example’s server keeps monitoring saved transactions after the browser is closed. The API’s own POST /api/service/run endpoint also checks the entitlement on the server, so payment is connected to the service entry point, not just to a button on the screen.

4. Prepare the payment, then approve and submit it in the wallet

Turn the 100 USDC shown at checkout into a transaction that can be submitted. This section checks the network and asset, prepares the transaction, has the wallet approve and submit it, and registers the account used for payment.
First, check the network, asset and balances. Identify the network by requesting eth_chainId, then compare the result with the stored payment terms. The expected value for Ethereum mainnet is 1, represented as 0x1 in a JSON-RPC hexadecimal quantity. [1] [5]
json
{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}
This is the example's simulated response:
json
{"jsonrpc":"2.0","id":1,"result":"0x1"}
Here, id: 1 pairs a request with its response. It is separate from the invoice ID and from a key used to prevent duplicate payments.
Next, identify the asset. Circle's official list gives 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 as the USDC contract on Ethereum. The application stores the combination of chain ID 1 and this contract address. Another token can use the same name or symbol, so the display label USDC is insufficient to identify the asset. [6]
To read the USDC balance, call that contract's balanceOf function through eth_call. The call returns the result of executing the requested code; this balance query does not make a payment. A library such as viem can encode the call using the ABI, the description of the contract's callable interface. [4] [7]
typescript
import { encodeFunctionData, erc20Abi, parseUnits } from 'viem';

const usdc = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
// Illustrative address, not an actual customer or payment destination.
const payer = '0x1111111111111111111111111111111111111111';

const balanceRequest = {
  jsonrpc: '2.0', id: 2, method: 'eth_call',
  params: [{
    to: usdc,
    data: encodeFunctionData({
      abi: erc20Abi, functionName: 'balanceOf', args: [payer],
    }),
  }, 'latest'],
};
const requiredUnits = parseUnits('100', 6); // 100_000_000n
Ethereum USDC uses six decimal places. A balance of 100 USDC is represented in the contract as the integer 100,000,000. The example's pre-checks (inspectWalletPreconditions and inspectBeforeSigning) fix the official address, check the response from decimals(), and compare the integer balance with the required quantity. It uses bigint instead of converting the amount to a JavaScript floating-point number. Input with more than six decimal places is rejected rather than rounded. [8] [9]
Even with 100 USDC available, this ordinary Ethereum transaction needs ETH for its network fee. Use eth_getBalance for the ETH balance and eth_call to the USDC contract for the USDC balance. The application checks both separately, including the fee budget. A balance query is an observation at a particular point in time; applications with concurrent operations spending the same funds also need internal funds reservation. [10]
Use the recipient saved when the invoice was issued. Example API uses 0x2222222222222222222222222222222222222222 as an illustrative recipient and does not replace it with a mutable UI field halfway through processing. Saving the network, asset, recipient and quantity together gives the final payment check the same terms to validate.
To send 100 USDC, prepare a transaction calling transfer(recipient, quantity) on the USDC contract. The transaction's own to field is the contract; the token recipient is encoded in data. A value of 0n means the transaction directly sends zero ETH. The USDC quantity is encoded elsewhere, so these two values have different meanings. [4]
typescript
import { encodeFunctionData, erc20Abi, parseUnits } from 'viem';

const recipient = '0x2222222222222222222222222222222222222222';
const transferCall = {
  to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  value: 0n,
  data: encodeFunctionData({
    abi: erc20Abi,
    functionName: 'transfer',
    args: [recipient, parseUnits('100', 6)],
  }),
};
// Build call data only. No signing or submission takes place here.
Signing also needs the chain ID, the nonce (the sender account’s transaction number), a gas limit and fee parameters. The wallet chooses these and shows them to the purchaser. Before asking for approval, the server records the pending value of eth_getTransactionCount and later uses it as the lower bound when searching for the transfer. The example supplies a fixed fee quote and checks that the registered account holds enough ETH. [11] [12]

Approve and submit in a browser wallet

With the browser wallets that ordinary web apps connect to, the wallet signs and submits the transaction itself once the user approves, and returns only the transaction hash to the app. MetaMask’s eth_sendTransaction behaves this way, and its published JSON-RPC method list (checked on 1 December 2026) has no eth_signTransaction. [26] [27] The server therefore cannot know the transaction hash before submission, and when a reply is lost it traces the transfer itself.
The example’s checkout uses this model once you choose “Browser wallet (local mock)” in /training (Section 3). The browser side runs as follows.
javascript
import { connectAccount, ensureChain, sendPayment }
  from './wallet-adapter.js';

// provider: the EIP-1193 provider your app selected
// (for example, a wallet found through EIP-6963)
async function payWithWallet(provider) {
  const account = await connectAccount(provider);
  await ensureChain(provider, '0x1');
  const started = await post('/api/wallet/start', { account });
  // Unregistered account or no ETH: nothing is sent
  if (started.refusal) return showRefusal(started.refusal);
  // No request: the server is still checking an earlier result
  if (!started.request) return;
  const result = await sendPayment(provider, started.request);
  // Report sent, rejected or unknown to the server
  await post('/api/wallet/result', result);
}
connectAccount calls eth_requestAccounts, ensureChain calls eth_chainId and wallet_switchEthereumChain, and sendPayment calls eth_sendTransaction. post and showRefusal are your own functions that send JSON within the existing signed-in session and display the reason. At /api/wallet/start, the server checks that the connected account matches the purchaser’s registered account and that it holds the USDC and the ETH for the fee. If the checks pass, it saves payment attempt INV-20261201-001/attempt-1, the expected transfer and the current pending value of eth_getTransactionCount before returning the transaction for the wallet. The server builds the recipient, quantity and data; the browser passes them to the wallet unchanged. [13] [28]
The wallet result falls into three cases (Figure 5 in Section 7). A returned hash means sent, but for the server it is still only a candidate. The server binds a transaction to the payment attempt only when its sender, USDC contract, data and chain match the saved terms, its nonce is at least the value recorded when the attempt started, and it has been included in a block. The nonce condition stops an earlier transfer of the same amount from being reused for this purchase. EIP-1193 code 4001 means the user declined, so no transaction was sent. A disconnect, a lost reply, or a page closed during approval is unknown: the wallet may have sent the payment. [13]
After a decline or an unknown, the server asks for approval again for the same payment attempt only once it has confirmed that the registered account’s nonce has not moved since the attempt started and that no matching Transfer exists. If eth_getLogs finds a matching transfer, the server binds that hash; a transaction replaced by the wallet’s speed-up is found the same way. While the nonce has moved but no match is found, the purchase stays in confirmation and the search continues. Two matching transfers, or reported transactions that all fail the terms, lead to needs_review. After binding, the verification in Section 5 and the ledger in Section 6 run unchanged.
The app cannot see transactions waiting inside the wallet. A submission that the app’s own RPC has not seen yet could lead to a second payment. The unknown screen therefore says “Do not pay again”. In case a second payment still arrives, a real product keeps watching for matching transfers from the registered account after binding and routes them to operations, and it allows only one open payment attempt per registered account at a time. The example is fixed to a single invoice, so it implements neither. Proving ownership of the registered account (for example, with a signature at registration) and refund procedures are also outside the example’s scope.
PartForm used for a real connectionReplacement in this example
public/wallet-adapter.jsConnection code that receives an EIP-1193 providerExercised only with the mock wallet and unit tests
Obtaining the providerYour app selects one, for example through EIP-6963The in-page public/mock-wallet.js; it never looks for an installed wallet
Submission by the walletThe wallet’s own network connectionMock submission through /training, with no private key or signature
src/wallet.tsSaving the payment attempt, checking candidates, searching for the TransferRPC answers come from the mock in src/wallet-mock.ts
Verification and ledgerThe checks in Sections 5 and 6The same code
The example simulates a connection to a wallet built into the browser, such as an extension. It does not cover switching to a wallet app on mobile and returning to checkout after approval. The recipient and other addresses in the example are illustrative. Do not connect a real wallet to the example or send funds.

Register the account used for payment

/api/wallet/start first checks that the connected account matches the purchaser’s registered account. The example fixes that registration, but a real product confirms, before any purchase, that the user controls the account, and then saves it. A common method is to have the wallet sign a message in the ERC-4361 Sign-In with Ethereum (SIWE) format. This signature is neither a transfer nor a transaction, and it costs no fee. [31] [32]
typescript
// Not part of the example. Done once, at registration.
import { toHex, type Hex } from 'viem';
import { createSiweMessage, generateSiweNonce }
  from 'viem/siwe';

// 1. Server: create a nonce and save it for the signed-in user
const nonce = generateSiweNonce();
const message = createSiweMessage({
  address, chainId: 1, nonce, version: '1',
  domain: 'app.example.com',
  uri: 'https://app.example.com/billing',
  statement: 'Register this account for payments.',
});
// 2. Browser: the wallet signs (no transfer)
const signature = await provider.request({
  method: 'personal_sign', params: [toHex(message), address],
}) as Hex;
// 3. Server: check signature, domain and nonce, then register
const valid = await publicClient.verifySiweMessage({
  message, signature, address,
  domain: 'app.example.com', nonce,
});
The server’s nonce prevents the same signature from being reused; it is tied to the signed-in user and used once. address is the connected account, provider is the wallet’s EIP-1193 provider and publicClient is a viem Public Client. personal_sign takes the message encoded as hex and the signing account. [33] After the check passes, the server saves the account as the user’s registered account. This code is not part of the example; only its type check against viem 2.58.8 was verified.

5. Detect the payment on the server and match it to the purchase terms

What runs on the server while checkout says “Confirming your payment”? We can now build the receipt checks that determine whether API access may be granted. Calling eth_getTransactionReceipt for the bound hash retrieves the transaction's execution result. A node may return null when it cannot supply a receipt yet. In a raw JSON-RPC receipt, status: "0x1" means successful execution and "0x0" means execution failure. A receipt decoded by viem uses values such as 'success', so keep the representation consistent. This example validates raw JSON-RPC responses. [1] [14]
After confirming successful execution, inspect the receipt's logs. An ERC-20 Transfer event carries the sender, recipient and integer quantity. Check that the event-emitting address is the configured USDC contract, then decode the event and compare it with the invoice's payment terms. An identically shaped event emitted by another contract is not evidence of this invoice's USDC payment. [4]
ObservationWhat it establishes
Bound hashThe transaction can be identified for tracking
Successful receiptThat transaction executed successfully in the observed block
Transfer from the official USDC contractThe expected integer quantity moved from the specified sender to the recipient
Finalized and canonical checksThe transfer satisfies the chain finality condition chosen for this example
Invoice binding and unique allocationPayment for this purchase can be recorded, allowing entitlement provisioning to proceed
For this transaction, receipt.to also identifies the USDC contract. The recipient to check is Transfer.to. The example additionally calls eth_getTransactionByHash and compares the hash, sender, nonce, contract and call data with the saved payment terms. A valid 100 USDC transfer still needs to belong to the correct invoice.
Decoding the mock receipt in the local example's successful fixture produces the following values for verification.
json
{
  "invoiceId": "INV-20261201-001",
  "receiptStatus": "0x1",
  "receiptBlockNumber": "0x64",
  "contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "from": "0x1111111111111111111111111111111111111111",
  "to": "0x2222222222222222222222222222222222222222",
  "amountUnits": "100000000",
  "logIndex": "0x0"
}
The source is logs[0] in the receipt within evidence/rpc-fixtures.json. The mock receipt in the wallet exercise has the same block and values. Its address is the emitting contract; topics[1] and topics[2] encode sender and recipient; and data encodes the quantity. Inside inspectPayment in src/payment.ts, decodeEventLog converts the checked log into addresses and an integer quantity.
Execution succeeded, and 100,000,000 units of the specified USDC moved to the specified recipient. The application can now say it observed the expected transfer. Marking the invoice paid still requires checking finality for block 100 (0x64) and allocating the evidence to the saved invoice.
Next, check finality. A transaction recently included in a block can be affected by a chain reorganisation, or reorg, which changes the accepted history. This example waits until the transaction's block is covered by Ethereum's finalized head. Finality is a property of the consensus process; it is not a decision based only on how many seconds have elapsed since submission. [15]
Under this policy, service access waits until finality is verified. Ethereum divides time into 12-second slots and 32-slot epochs, and finality advances through votes on the checkpoints at epoch boundaries. [15] ethereum.org explains that it takes about 15 minutes for an Ethereum block to finalise. [29] Design checkout on the assumption that access does not begin immediately after submission. Decide when a wait counts as long not from that general figure but from the distribution you measure on your own endpoint in three parts: from submission to inclusion in a block, from inclusion to finalized, and until the monitor confirms the payment. The example makes this threshold a setting with no default value, DEMO_LONG_WAIT_MINUTES. Passing it never marks a payment complete. It tells the customer that there is no need to pay again, and tells operators to start investigating.
The application obtains the finalised head with eth_getBlockByNumber("finalized", false) and checks that the receipt's block number falls within that range. It then retrieves the block at the receipt's height by number and compares its hash with receipt.blockHash. This checks whether the observed transfer remains on the node's current canonical chain. [16] [17]
A block number identifies a position in the history; a block hash identifies the particular block at that position. Suppose the saved receipt names height 100 and hash A, but the current block at height 100 has hash B. The application rejects that receipt as evidence even if the finalised head is numbered 101; the mismatch is a reason to hold.
typescript
// Finality-check excerpt from inspectPayment.
// Transaction, receipt and Transfer checks precede this step.
const finalized = record(await rpc.request(
  'eth_getBlockByNumber', ['finalized', false],
));
if (quantity(finalized.number) < blockNumber) {
  return hold('awaiting_finality');
}
const canonical = record(await rpc.request(
  'eth_getBlockByNumber', [`0x${blockNumber.toString(16)}`, false],
));
if (quantity(canonical.number) !== blockNumber ||
    hash(canonical.hash) !== blockHash) {
  return hold('canonical_mismatch');
}
The full implementation also checks the finalised head's hash against a lookup by height, then rereads the receipt and canonical block. It leaves the payment decision on hold if the view changes during verification. The viem function waitForTransactionReceipt defaults to one confirmation, which alone does not satisfy this example's finalized policy. [18]
In the successful fixture, the finalised head is block 101 (0x65), and the hash of block 100 matches the receipt. Evidence that passes every check can then reach the ledger to record payment completion and the entitlement for this invoice. A 99 USDC transfer would fail these payment terms even in a finalised block. Split payments, overpayments and payments routed through smart contracts each need their own acceptance policy.

Figure 3 | Match the purchase and evidence, then save access rights. Unfinished payments lead to the appropriate next task

The invoice and payment attempt saved for INV-20261201-001, and the transaction hash bound to them, join validated execution, official-USDC Transfer, finality and canonical evidence at the same purchase-matching step. When every condition matches, allocate once and save paid plus entitlement in the same database transaction. The API checks that entitlement before allowing access. Unknown or pre-finality outcomes recheck the same hash. For execution failures or conflicting histories, the monitoring team investigates while the payment stays incomplete. Hold mismatched terms for the monitoring team to investigate; a finalised shortfall goes to the payment-terms owner.
The figure describes how the required evidence depends on other conditions. A monitoring service and an invoice reconciliation service can run concurrently. Whichever receives information first, the invoice is not marked paid and service access is not enabled until all required conditions are satisfied. The example's monitor continues rechecking unfinished invoices. The lower section also shows the investigation and operational decisions needed while observation continues.
This design trusts a synchronised, consistent view from an RPC endpoint chosen through authenticated configuration. A matching chain ID does not establish that the endpoint itself is trustworthy. If switching endpoints exposes conflicting histories, leave the payment decision on hold and investigate synchronisation or failure. A majority of RPC responses is not a replacement for Ethereum consensus finality.
AI instruction A: Verify USDC payment detection
text
AI instruction A: Verify USDC payment detection
Application: [repository, product purchased with USDC, and service entitlement]
Invoice and terms: [invoice ID, chain, token, sender, recipient, integer amount, finality policy]

Start by inspecting the current code, SDK and runtime versions, existing tests, and ownership of signing and monitoring. Check the official USDC address for the selected chain against Circle's primary documentation.
Check receipt success, the Transfer emitted by the official contract, sender, recipient, integer amount, the pre-existing transaction-to-invoice binding, and finalized/canonical consistency.
State where the approach fits the current acceptance policy. Define handling for out-of-policy cases such as split payments, overpayments and third-party transfers, and specify failure and unknown-result conditions that require a hold.
Use the same fixtures for success, wrong token, amount or recipient, wrong invoice, duplicates, reorgs and changes during lookup. Compare correctness, counts of false completion and incorrect entitlement grants, and detection time before and after the change under the same inputs, load and finality policy. Do not remove incorrect or missing results to make the implementation appear faster.
Stay within existing permissions for code inspection and local simulated tests. Do not make real transfers, obtain or operate private keys, enter contracts, incur charges or change production settings. Keep payments with insufficient evidence on hold. If no change is needed, explain why.

6. Update the invoice and API entitlement only once

Once the payment evidence is ready, complete the purchase in Example API. Start by determining which purchaser and invoice the transfer belongs to. When several equal amounts arrive at a shared address, matching only by amount and arrival time can attach the transfer to the wrong invoice.
This example saves the payment attempt for INV-20261201-001 first and starts reconciliation only from a transaction hash bound after its terms are checked. A hash supplied by the browser is a candidate, not evidence for the invoice. Products accepting deposits from third parties or exchanges need another explicit binding scheme, such as a dedicated deposit address, payment reference or provider-issued payment ID.
The monitor can also deliver the same event twice. To separate notification count from accounting count, give finalised evidence a uniqueness constraint on chainId + transactionHash + logIndex. The logIndex is a position within the block. Store blockHash with observations while monitoring so that an old observation invalidated by a reorg remains distinguishable. This example allocates the evidence only after finalized and canonical checks pass.
Then combine evidence insertion, invoice update and API entitlement provisioning in a single database transaction. This is a persistence unit that commits the updates together or rolls them all back if a step fails. A crash after recording evidence must not leave the invoice unmodified, and an invoice must not become paid without its evidence. The SQLite implementation begins a transaction that serialises writes, inserts unused evidence, changes the invoice state, adds an entitlement to service_entitlements, and records a notification for later delivery, all in one commit. The outbox stores notifications in the database for downstream processing. This is the application's chosen design.
sql
BEGIN IMMEDIATE;
-- Match the persisted intent and verified evidence
-- to the same invoice.
-- Evidence has UNIQUE(chain_id, tx_hash, log_index).
-- Allocation to an invoice is also unique.
-- Insert evidence, mark the invoice paid, add the
-- entitlement and save the notification outbox row.
-- The entitlement's invoice_id is a PRIMARY KEY:
-- the same purchase is never granted twice.
COMMIT;
This SQL illustrates the transaction boundary. The actual schema, parameterised statements and conflict handling are included in src/ledger.ts. Reconciliation of the same evidence returns the existing result. Reuse for another invoice or inconsistent evidence is rejected without marking that invoice paid.

Figure 4 | Complete a purchase once despite repeated observations

Repeated observations of the same Transfer enter a single database transaction containing evidence uniqueness and invoice matching. It records one paid transition and one API entitlement. The notification outbox entry is saved in the same commit.
An entitlement is a server-side record associated with the purchaser, product and invoice. The example's API permits the sample operation only when this record exists. The product price, creditUsdCents: 10000, and the received USDC quantity, 100000000, use different units and are stored in separate fields. This demo verifies the connection between purchase and access permission. Per-call usage billing and balance consumption are outside its scope.
If access is provisioned in an external service, that API cannot participate in the same local database commit. Save a “Paid; entitlement provisioning pending” state, deliver the request recorded in the outbox, and have the receiver suppress duplicates using the same business ID. Show service access as enabled only after provisioning is confirmed in the external system too. Design the local database update and external delivery as distinct steps.
If the business requires money in a bank account, add a separate state beyond this point. For example, record “USDC receipt finalised; bank deposit pending,” then bind the provider's payout ID and the bank's deposit record to the same invoice. The example's paid state covers the on-chain USDC allocation defined at the start. For a contract requiring bank funds, adapt the completion condition to that required form of receipt.
AI instruction C: Reconcile invoices with on-chain payments
text
AI instruction C: Reconcile invoices with on-chain payments
Business process: [product, purchaser, invoice, ledger and service entitlement]
Completion condition: [required form of receipt, such as USDC or a bank deposit]

Inspect the current code, ledger, event monitor, SDK and database versions, payment-provider API, and responsibility split between the business and its providers.
Link the invoice ID, authenticated payment intent, transaction ID, verified Transfer and finality state. Where required, include the payout ID and bank deposit evidence. Adoption requires a provable association and atomic preservation of unique evidence use, invoice updates and entitlement updates. For provisioning in an external service, distinguish the durable request from confirmation of completion.
Test equal-amount invoices, reuse of a historical transfer, duplicate or missing notifications, out-of-order delivery, concurrent processing, and restarts around commit with the same fixtures. Define incorrect joins, duplicate accounting, duplicate or missing entitlements, lost allocations and completion without evidence as failures.
Compare correctness, allocation counts, entitlement-grant counts, unmatched items and post-restart consistency before and after under the same conditions. Check duplicate external notifications too. Leave items unmatched when evidence is insufficient.
Stay within existing permissions for code inspection and local simulated tests. Do not make real transfers, obtain or operate private keys, enter contracts, incur charges or change production settings.

7. Investigate connection failures and incomplete purchases in the admin view

When a connection drops mid-payment, all the application sees is that no reply arrived. A failure before the request reached the wallet or node looks the same as one where only the reply was lost. Treating a network error as proof of non-payment risks asking for approval of a payment that has already arrived.

When the wallet’s reply does not arrive

The wallet submits the transaction, so a lost reply leaves no hash behind. As described in Section 4, the server uses the saved payment attempt to search, with eth_getLogs, for a transfer from the registered account. It asks for approval again only after finding none and confirming that the nonce has not moved.

Figure 5 | Recovery in the browser-wallet model. A returned hash is checked as a candidate; with no reply, the server searches for the transfer before asking for approval again

When the purchase button is pressed, the server saves the invoice ID, payment attempt, registered account, expected transfer and the nonce at the start of the attempt. The wallet’s result after approval and submission is sent with a hash, declined with 4001, or unknown with no reply. A sent hash is a candidate, bound only after its content, nonce and inclusion in a block are checked. After a decline or unknown, the server confirms that the nonce has not moved and no matching Transfer exists before asking for approval again. A matching transfer is bound; two matches need review. A bound transaction goes to the verification in Section 5 and the ledger in Section 6.
When a wallet speeds up or cancels a transaction, it sends another transaction with the same nonce and a different fee or content, under a different hash. The hash reported first then never appears in a block. Because the example binds only transactions included in a block, the search also finds the replacement transfer. If a cancellation means no transfer happened, the nonce moves on while no matching transfer exists. The example keeps confirming and searching, and marks the purchase in the admin view once it passes the long-wait threshold. When to stop and allow a new payment is for operations to decide under the contract. A nonce too low submission error or a consumed nonce alone does not show that this invoice was paid. [11]

Track the bound transaction

Once a transaction is bound, its hash is used to track the execution result and finality. For each query result, the application decides as follows.
Result of querying the bound transactionApplication decision
No receipt availableContinue tracking an unknown outcome; do not conclude that it was never submitted
Receipt reports execution failureKeep the invoice unpaid; check finality and the failure reason. Decide separately whether another payment is needed
Correct execution and Transfer, awaiting finalityContinue monitoring the same transaction
A finalised transfer has the wrong amount, recipient or other termsKeep the invoice unpaid and hand the mismatch to the responsible operator
Finality, canonical state and terms matchProceed to unique allocation against the invoice
RPC response lost or histories disagreeHold and recover using the saved transaction and connection state
The same design enables restart recovery. Persist the payment attempt and reload incomplete ones after startup. Losing an in-memory “processing” flag does not prevent monitoring and reconciliation from resuming: from the hash of the bound transaction if there is one, and otherwise from the search for transfers from the registered account.

Investigate in the admin view

The example stores the reason it cannot mark a payment as paid using a hold state and its reason. The admin summary uses the same customer-facing states as the table in Section 3. The internal state and reason code remain in the details, while the main display helps the operator identify the next task. The customer-facing states map to the server’s internal records as follows. The mapping is the same as customerView in the example’s src/application.ts.
State shown to the customerServer record (ledger hold and reason; wallet.state in the wallet model)
not_startedNo ledger invoice yet (the invoice ID and terms are saved in the payment attempt). wallet.state is awaiting_wallet or wallet_rejected. When a condition is missing, no payment attempt is created and only a reason such as wallet_account_not_registered, insufficient_usdc, insufficient_eth or wrong_chain is returned
pendingLedger hold reasons prepared, receipt_unknown, awaiting_finality, rpc_timeout, transaction_unknown and finality_unavailable; before binding, wallet_result_unknown and transaction_reported. A long wait sets timing.longWait to true
needs_reviewAny other hold reason (amount_mismatch, wrong_recipient, execution_failed, canonical_mismatch and so on); before binding, two matching transfers, or reported transactions that all fail the terms
paidThe invoice is paid and the entitlement exists. The monitor stops here
Once a transaction is bound, wallet.state becomes bound (reason transaction_bound) and the display follows the ledger rows. While needs_review is displayed, the monitor keeps re-observing the transaction recorded on the invoice. A needs_review reached before any transaction is bound stops the search and waits for operations. review_required is not a screen state. It is the result when an explicit recheck of a paid invoice from /training finds a contradiction: the record stays paid and operations decides.
In the details, Submission shows whether a submission was acknowledged, while Accepted payment evidence shows the payment evidence accepted for the invoice, keeping acknowledgement and allocation apart. A wallet payment attempt also shows the nonce at the start (Minimum nonce), the block the search started from (Searched from block), how many times approval was requested (Wallet prompts) and how the transaction was found (Found by: wallet_response for the wallet’s reply, log_scan for the search).
In the amount-mismatch exercise where the example supplies the transaction (Insufficient evidence: 99 USDC), the page compares the required 100 USDC with the 99 USDC observed in the simulated response. This verifier stops at the amount mismatch, so it has not checked that observation’s finality or canonical state. It saves the values as unaccepted investigation information, separately from evidence that passed every condition and was allocated to the invoice. Having no accepted evidence for this invoice does not establish that no assets moved. Preserve both the observed amount and the extent of its verification during investigation.
When verification stops at a mismatch, the monitoring or connectivity investigation team first checks the saved transaction's execution, finality and chain-history consistency. Requerying an actually finalised 99 USDC transfer will not turn it into 100 USDC. Collect the invoice ID, purchaser, agreement terms, known transaction, reason and observed details, and hand the case to the team responsible for payment terms. If connection or chain-history conditions remain unknown, continue that technical investigation. The example’s admin view lists the start time, last check, reason and payment attempt for the same invoice, and flags purchases that have passed the long-wait threshold. Map the specific owner and customer contact channel to existing operations.
The customer’s review-needed screen asks them to avoid another payment, keep the invoice ID and contact their usual support or billing channel. The example implements status display and investigation records. Assignment, notifications, refunds and underpayment handling need to be defined under the product’s own agreement and operations. USDC sent from an unregistered account or an exchange stays at the recipient without being matched to any invoice, and the example does not detect it. A real product watches the recipient for payments outside the terms; operations confirms the sender and the invoice with the customer, then allocates or refunds the funds under the agreement.
The invoice ID is also the starting point for answering customer questions in the admin view. If a customer says they purchased a pack but cannot use the API, the same records show whether INV-20261201-001 is still awaiting payment confirmation, has mismatched terms, or already has an entitlement. Reconciliation rechecks a known transaction. It does not overwrite payment status without evidence. The example places the explicit recheck operation in /training; /admin is a read-only investigation view.
When a recheck of a paid transaction finds a contradiction (review_required above), a real product assigns responsibility for investigation, any corrective ledger entries or access suspension, and customer communication.
AI instruction B: Prevent duplicate payments after a lost wallet reply
text
AI instruction B: Prevent duplicate payments after a lost wallet reply
Application: [repository, checkout and wallet connection, saved payment attempts]

Inspect the current code, the wallet connection library and its version, and when the payment attempt, the registered account, the nonce at the start of the attempt and the block the search starts from are persisted. Work with structure and synthetic inputs without copying real transaction data.
Separate wallet results into sent, declined by the user and unknown, and define the conditions for checking a returned hash as a candidate. Trace a payment attempt whose reply was lost through the registered account’s nonce and a search for its `Transfer`, and check before requesting approval again. Adoption requires binding only a matching transfer included in a block and keeping the same payment attempt.
Reproduce a reply lost after approval, a disconnect before sending, a retry after a decline, a replacement by a wallet speed-up, a same-amount transfer before the attempt, two matching transfers and a restart during reconciliation. Treat a second approval request, reuse of an earlier transfer, false completion and unrecoverable state as failures.
Compare before and after under identical simulated inputs and failure points. Report correctness, the number of approval requests, the bound transaction, allocations recorded and recovery outcomes. Keep unknown outcomes on hold; do not casually request approval again.
Stay within existing read permissions and local simulated tests. Do not make real transfers, obtain or operate private keys, enter contracts, incur charges or change production settings.

8. Integrate with an existing app and connect to RPC

The example introduced in Section 3 uses Node.js 24.22.3, TypeScript 5.9.3 and viem 2.58.8. The viem library is MIT-licensed. We checked its 26 November 2026 release and pinned the version and lockfile. Its ABI encoding, decoding and integer utilities fit naturally into an existing TypeScript application, which is why it was chosen for this example. [19] [20]
The example uses SQLite included with Node.js as a small persistence implementation. The viem library itself supports Deno and other runtimes, but this package, including its SQLite code, is verified only on Node.js. Existing Rust, Go or Python applications can implement the same contract for evidence and state. A wholesale language migration is not a requirement for using the design. [21]
When moving this code into your app, map the interfaces, business logic and chain connection to their corresponding components.
Example codeImplemented responsibility
src/server.tsCustomer, admin and training HTTP APIs and interfaces, plus the service entry point
src/application.tsConnects the product, purchaser and invoice; runs monitoring; returns display state and entitlements
src/preflight.tsChecks the network, asset, balances, nonce and fees
src/wallet.ts, public/wallet-adapter.jsBrowser-wallet payment attempts, candidate checks, Transfer search and classification of EIP-1193 results
src/payment.tsVerifies the transaction, receipt, Transfer, finality and canonical state
src/ledger.tsPersists evidence allocations, invoices, entitlements and the outbox
src/fixture.ts, src/wallet-mock.ts, public/mock-wallet.jsSupply local simulated RPC responses, connection failures and the mock wallet
In /training, choose an exercise and select “Start new local exercise” to repeat the same purchase. In Browser wallet (local mock), try the mock wallet’s Reject, Approve, then lose the reply and Disconnect before sending, and connecting an unregistered account. Browser wallet: not enough ETH for the fee shows the shortfall before asking for approval. After the purchase is paid, press Observe saved intent again to confirm that matching the same transaction again adds no allocation, entitlement or notification record.
Mismatched terms can be tried in the exercises where the example supplies the transaction (Insufficient evidence: 99 USDC, Wrong recipient, Wrong token contract and others). In these exercises the checkout button reads Pay 100 USDC; no wallet is used, and the example’s server sends a simulated transaction. The matching and ledger code is the same as in the wallet exercise. The 99 USDC and wrong-recipient cases are synthetic RPC responses used to check that the verifier rejects inconsistencies. They do not claim that a correctly specified direct transfer of 100 USDC actually moved only 99 USDC.
To try restart recovery, stop npm run web and run it again from the same directory. The invoice, payment attempt and persisted simulated chain state remain in data/example-api.sqlite, and monitoring resumes from the saved payment attempt. Even after choosing Approve, then lose the reply and restarting, the monitor searches for the transfer and binds it.
The tests check that the following inputs produce the intended business outcomes. Restart tests close and reopen a file-backed database, then check whether another monitoring instance can recover the persisted payment attempt.
Simulated inputRequired outcome
Official USDC, correct recipient, exactly 100.000000, finalisedOne invoice allocation and one corresponding entitlement
Wrong contract, wrong recipient or insufficient amountInvoice remains unpaid
Repeated event or reconciliationAllocation, entitlement and notification records do not multiply
Receipt reports execution failureInvoice remains unpaid
Pending finality, canonical mismatch, a reorg during lookup or an RPC timeoutHold and continue tracking the same transaction
Wallet decline, lost wallet reply, replacement by a speed-up, or a same-amount transfer before the attemptKeep the same payment attempt, do not ask again once a payment was sent, find the replacement transfer, and never reuse an earlier transfer
Restart, concurrent reconciliation or evidence reused for another invoicePreserve ledger uniqueness and invoice binding
Real-chain submission, speed, success rate and availability are unmeasured. These tests establish the code's decisions and persistence behaviour for defined simulated inputs. When adapting the design, preserve the verification conditions and map these connections and responsibilities to the existing application.
Responsibility in the exampleCorresponding integration in an existing application
Customer and admin interfacesExisting login, invoice ownership checks, administrator permissions and the service interface after purchase
Saving the payment attempt and the registered accountAuthentication of the user and invoice, proof that the user controls the registered account (for example SIWE), provider selection, and a way to keep only one payment attempt open per registered account at a time
Queries through FixtureRpcAuthenticated RPC transport, timeouts and requerying, monitoring saved transactions, and a consistent view when switching endpoints
Recovery by searching for the transferSplitting the search range, watching for further transfers on the same terms after binding, and the threshold for closing an attempt whose transfer is never found
Atomic reconciliation and entitlements in SQLiteThe chosen database's unique constraints and transaction semantics, access checks in the service, concurrent outcomes and duplicate protection at external provisioning consumers
The table in Section 1 gives each role its entry point. When these components are connected in staging, verify that the same successful and failing inputs still produce the same invoice outcomes.
Monitoring is where the infrastructure owner makes the first design decisions. The example runs one process that, by default, rereads incomplete invoices every second and handles them one at a time. In the wallet model, the search reads from the block recorded at the start of the attempt to latest in a single eth_getLogs call, filtered by sender, recipient and amount. A real product decides how to split ranges to fit the endpoint’s limits, how to stop several workers from processing the same invoice twice (database locks or leases), how often to reread, and when to hand a payment attempt whose nonce moved without a matching transfer to operations (for example, the long-wait threshold).
We have now connected checkout to API access. When connecting that server to a real chain, check the methods used here, availability of finalized, required history, usage limits and reconciliation after failure. ERPC's current Ethereum documentation describes HTTP access at https://edge.erpc.global/eth and WebSocket connectivity. Consult the current Quickstart for authentication and usage conditions, then match them to the application. Preserve the same payment acceptance policy when switching endpoints. [22]
For Solana, the general principle still applies: track the execution after submission, then bind evidence to an invoice. The details involve signature status, execution errors, mint and token accounts, and commitment. Renaming Ethereum's Transfer and nonce fields does not produce a correct Solana implementation. The official sendTransaction documentation also separates RPC acceptance from subsequent processing and confirmation. [23]
Arc's current official specification uses USDC as its native gas asset, with 18-decimal native units and a 6-decimal ERC-20 interface. The name USDC therefore does not justify importing Ethereum's assumption of separate ETH fee funds and token balances. ERPC also documents HTTP access for Arc, but this work has not measured the chain ID returned by that endpoint. Treat network selection, units and finality as separate adaptation checks. [24] [25]
AI instruction D: Diagnose RPC configuration and failure recovery
text
AI instruction D: Diagnose RPC configuration and failure recovery
Application: [repository; customer interface, server and admin view; monitoring and reconciliation architecture]
Requirements: [chain, asset, finality policy, volume and recovery conditions]

Inspect the current code, SDK and runtime versions, RPC endpoints, polling or subscriptions, history retention, persistence and failure domains. Confirm the existing permissions and responsibility split for connectivity, signing and reconciliation.
An endpoint switch is eligible only if it preserves the intended chain, required methods and history, and finalized/canonical verification. Define conflicting responses, synchronisation lag, missing history, rate limits and subscription gaps as failure cases. Do not decide payment completion by response majority alone.
Compare the current and proposed configuration with the same transaction fixtures, load, checking frequency and failure points. Measure correctness, unmatched items and recovery time. Reconcile saved transactions or missing ranges as well as restoring the subscription.
Explain what needs improvement and what can remain unchanged, with evidence. Hold cases that fail the conditions and distinguish measured results from unmeasured items.
Stay within existing read permissions and local simulated tests. Do not make real transfers, obtain or operate private keys, enter contracts, incur charges or change production settings.
Add USDC to checkout, have the server connect receipt of payment to the invoice, and enable the purchaser's usage pack once. The customer can start using the service, and the operator can review the status of that same purchase. With this complete flow, stablecoins become a payment method in your own app. RPC connects that app to the blockchain, letting it check the payment the wallet submitted and retrieve the information needed for the app's decision.