Skip to main content

Web3 Payments FAQ

How do I determine the charge state from a charge?

The timeline field on the Charge represents where the payment is in the Commerce flow. For a completed transaction this looks like:

[
{
"status": "NEW",
"time": "2024-04-14T17:15:17Z"
},
{
"status": "SIGNED",
"time": "2024-04-14T17:15:41Z"
},
{
"status": "PENDING",
"time": "2024-04-14T17:16:53Z"
},
{
"status": "COMPLETED",
"time": "2024-04-14T17:30:53Z"
}
],

How can I find the Onchain payment associated with a Charge?

Once a payment has been detected onchain by Commerce, we add a payment entry into the payments field. This looks like:

{
"payment_id": "0x1fd527fb9205c7aaaef26b184de26fc01630f6fb3125f431d27d8313a962196d",
"network": "base",
"transaction_id": "0x1fd527fb9205c7aaaef26b184de26fc01630f6fb3125f431d27d8313a962196d",
"status": "pending",
"detected_at": "2024-04-14T17:16:45Z",
"value": {
"local": {
"amount": "1",
"currency": "USD"
},
"crypto": {
"amount": "1",
"currency": "USDC"
}
},
"payer_addresses": [
"0x5770d0616b99e89817a8d9bde61fddc3a941bdf7"
]
}

The transaction_id field represents the hash of the transaction that can be used to find it on-chain. Web3 Payments can happen on Eth Mainnet, Polygon, or Base, so you must refer to the network field to successfully locate the transaction.

NetworkChain IDBlock Explorer Link
Ethereum Mainnet1https://etherscan.io/tx/<tx_hash>
Polygon Mainnet137https://polygonscan.com/tx/<tx_hash>
Base8453https://basescan.org/tx/<tx_hash>

What do I need to update in my integration with Commerce after migrating to Web3

The primary changes require that you remove addresses, and no longer use the pricing field's entries for individual crypto currencies.

  • For addresses, the typical use case was locating an on-chain transaction, which can be done following the guide above.
  • For pricing, the typical use case was determining the amount received from the Payer. Our Onchain Payment Protocol does not allow over or under payments; so you can be confident that you will always receive the exact amount of USDC that the charge was priced in. If you need to know this, you can refer to the settlement_currency field under pricing to know exactly what you received.

How can I get additional help?

Please join our Discord, where you can post questions and see how others are using Coinbase Commerce.

See Also:

Was this helpful?