{"id":18542740,"url":"https://github.com/coinbase/commerce-onchain-payment-protocol","last_synced_at":"2025-07-23T02:35:57.699Z","repository":{"id":207645011,"uuid":"718838325","full_name":"coinbase/commerce-onchain-payment-protocol","owner":"coinbase","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-20T17:02:26.000Z","size":21,"stargazers_count":155,"open_issues_count":27,"forks_count":52,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-15T19:43:22.781Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coinbase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-14T22:28:55.000Z","updated_at":"2025-04-13T03:05:28.000Z","dependencies_parsed_at":"2023-11-16T22:07:10.266Z","dependency_job_id":"c48f35b5-2ff1-4f91-bdde-6104a959cbcc","html_url":"https://github.com/coinbase/commerce-onchain-payment-protocol","commit_stats":null,"previous_names":["coinbase/commerce-onchain-payment-protocol"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coinbase/commerce-onchain-payment-protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fcommerce-onchain-payment-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fcommerce-onchain-payment-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fcommerce-onchain-payment-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fcommerce-onchain-payment-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coinbase","download_url":"https://codeload.github.com/coinbase/commerce-onchain-payment-protocol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fcommerce-onchain-payment-protocol/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266606958,"owners_count":23955373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T20:10:20.433Z","updated_at":"2025-07-23T02:35:57.668Z","avatar_url":"https://github.com/coinbase.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coinbase Commerce Onchain Payment Protocol\n\nThe Coinbase Commerce Onchain Payment Protocol allows payers and merchants to transact using the blockchain as a settlement layer and source of truth.\nIt provides the following benefits over \"traditional\" cryptocurrency payments:\n\n- Guaranteed settlement: merchants always receive exactly the amount that they request.\n- Automatic conversion: payers can pay with any token that has liquidity on Uniswap, without exposing merchants to price volatility.\n- Removal of payment errors: it is no longer possible to pay the wrong amount or to the wrong address.\n\n### Contract Deployments\n\nAs of July 31, 2024, the Commerce Onchain Payment Protocol is deployed in the following locations:\n\n| Chain    | Environment     | Address                                      |\n| -------- | --------------- | -------------------------------------------- |\n| Ethereum | Mainnet         | `0x1DAe28D7007703196d6f456e810F67C33b51b25C` |\n| Ethereum | Sepolia Testnet | `0x96A08D8e8631b6dB52Ea0cbd7232d9A85d239147` |\n| Polygon  | Mainnet         | `0xc2252Ce3348B8dAf90583E53e07Be53d3aE728FB` |\n| Polygon  | Amoy Testnet    | `0x1A8f790a10D26bAd97dB8Da887D212eA49461cCC` |\n| Base     | Mainnet         | `0xeADE6bE02d043b3550bE19E960504dbA14A14971` |\n| Base     | Sepolia Testnet | `0x96A08D8e8631b6dB52Ea0cbd7232d9A85d239147` |\n\nSince the contract is non-upgradeable, these addresses will change when new\nversions are deployed.\n\n### Browsing this Repo\n\nThe core source code can be found in [Transfers.sol](contracts/transfers/Transfers.sol).\n\nExcluded from this repo is a copy of [Uniswap/permit2](https://github.com/Uniswap/permit2),\nwhich would be copied to `contracts/permit2` in order to compile.\n\n## Overview\n\n### Operators\n\nThe Transfers contract facilitates payments from a payer to a merchant. Before\nit may be used, an \"operator\" must register with the contract and specify\na destination for fees. This operator is responsible for setting merchants up\nwith the protocol and providing a UI for both merchants and payers to interact\nwith it. Registering as an operator is permissionless, and Coinbase maintains\ncontrol of an address used as the operator for Coinbase Commerce.\n\n### Transfer Intents\n\nOnce an operator is registered, they may begin facilitating payments. Individual\npayments use a primitive called a `TransferIntent`, represented by a Solidity\nstruct of the same name. This struct specifies the following:\n\n- The merchant's address\n- The currency the merchant wishes to receive\n- The amount of that currency the merchant wishes to receive\n- The deadline by which the payment must be made\n- The payer's address\n- The chain the payer will pay on\n- The address any refund should be directed to\n- The operator who is facilitating the payment\n- The fee the operator should receive\n- A unique identifier for identifying the payment\n- A signature (and optional signature prefix) from the operator\n\nAlong with these attributes, a `TransferIntent` must be signed by the operator.\nThis allows an operator to be selective about what payments to allow based on\ninternal policies, legal requirements, or other reasons. It also ensures that\na `TransferIntent` cannot be forged or have its data modified in any way.\n\n### Contract Guarantees\n\nThe contract ensures that, for a given valid `TransferIntent`:\n\n- The merchant always receives the exact amount requested\n- The merchant never receives payments past a stated deadline\n- The merchant never receives more than one payment\n- Payments may be made using the merchant's requested currency, or swapped from\n  another token as part of the payment transaction\n- Unsuccessful or partial payments will never reach the merchant, thus\n  guaranteeing that payments are atomic. Either the merchant is correctly paid\n  in full and the fee is correctly charged, or the transaction reverts and no\n  state is changed onchain.\n\n### Contract payment methods\n\nDepending on the settlement token and the input token, along with the way\nin which the payer allows movement of their input token, a frontend must select\nthe appropriate method by which to pay a `TransferIntent`. These methods are:\n\n- `transferNative`: The merchant wants ETH and the payer wants to pay ETH\n- `transferToken`: The merchant wants a token and the payer wants to pay with\n  that token. Uses Permit2 for token movement.\n- `transferTokenPreApproved`: Same as `transferToken`, except the Transfers\n  contract is directly approved by the payer for the payment token\n- `wrapAndTransfer`: The merchant wants WETH and the payer wants to pay ETH\n- `unwrapAndTransfer`: The merchant wants ETH and the payer wants to pay WETH\n- `unwrapAndTransferPreApproved`: Same as `unwrapAndTransfer`, except the\n  Transfers contract is directly approved by the payer for WETH\n- `swapAndTransferUniswapV3Native`: The merchant wants a token and the payer\n  wants to pay ETH. The token must have sufficient liquidity with ETH on Uniswap\n  V3.\n- `swapAndTransferUniswapV3Token`: The merchant wants either ETH or a token and\n  the payer wants to pay with a different token. The payment token must have\n  sufficient liquidity with the settlement token on Uniswap V3.\n- `swapAndTransferUniswapV3TokenPreApproved`: Same as\n  `swapAndTransferUniswapV3Token`, except the Transfers contract is directly\n  approved by the payer for the payment token\n\nFor any EVM-compatible network where ETH is not the native/gas currency, the\nabove descriptions should substitute that currency. For example, payments on\nPolygon would use MATIC in the above descriptions.\n\n### Payment Transaction Results\n\nWhen the payment is successful, a `Transferred` event is emitted by the contract\nwith details about:\n\n- The operator address\n- The unique id of the `TransferIntent`\n- The merchant (recipient) address\n- The payer (sender) address\n- The input token that was spent by the payer\n- The amount of the input token spent by the payer\n\nIn the case of errors, a specific error type is returned with details about what\nwent wrong.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase%2Fcommerce-onchain-payment-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinbase%2Fcommerce-onchain-payment-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase%2Fcommerce-onchain-payment-protocol/lists"}