Try   HackMD

EthPay Draft Standard

~ DC Posch and Nalin, thanks to Austin Griffith for working with us on the initial idea.

This is currently a working draft, we would appreciate comments and feedback.

Goal

Our goal is to create a shared standard for payment requests on Ethereum. This supports a range of related use cases including online checkout, point-of-sale, and P2P payment requests.

Desired attributes:

  • Simple. Just token payments, not arbitrary contract calls.
  • Deterministic. Affords great UX, without need for slow and approximate simulation.
  • URL based. Users can request payment via plain link, popup window (like PayPal Checkout), QR, NFC, and so on. This makes the standard transport-agnostic.
  • Neutral. Not tied to any specific company, wallet or rollup.
  • Open. Community governed, easy to implement in any wallet.

Domain

We use a single domain that is community owned and managed for mobile deeplinks.

💡 We bought eth.pro for this purpose and could buy ethpay.org. Open to other ideas.

To support EthPay, a wallet app will add this domain as a valid deeplink domain and make a PR to a shared open source repository be added as a valid deeplink destination. Web wallets are also supported.

When a user taps an EthPay link anywhere, there are three possibilities:

  • No wallet installed: The user sees a webpage summarizing the payment request. The page shows a list of wallets supporting EthPay (including mobile and web wallets). User can also complete payment using the traditional Connect Wallet flow.
  • One compatible wallet installed: User is directly deeplinked to the wallet, one-tap payment.
  • Multiple compatible wallets installed: User is shown a system-native prompt to pick which wallet they would like to use to open the URL. On Android, the user is additionally able to pick a permanent default. Two-tap payment.

Examples

Pay $1.23 USDC to Vitalik on Optimism

https://ethpay.org/pay/vitalik.eth/10?token=0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85&amount=1.23

or equivalently,

https://ethpay.org/pay/vitalik.eth/10?token=usdc.tkn.eth&amount=1.23

Pay 0.1 ETH to Ansgar on Base, with a memo and a callback

Specify Rainbow as the recommended wallet. If the user has no wallet installed, the fallback webpage shows Rainbow first. (EthPay links are neutral, so by default no wallet is prioritized.)

Specify a callback. Once payment is sent, the wallet links back to myapp://payment-done?txhash=... or myapp://payment-done?ophash=...

https://ethpay.org/pay/ansgar.eth/8453?token=native&amount=0.1&wallet=rainbow&memo=Hello+World&callback=myapp://payment-done

Specification

Simple URL standard using similar building blocks as EIP-681.

https://<domain>/<intent>/<recipient>/<chain>?token=<...>&amount=<...>

…with additional, optional query parameters.

Required parameters

domain            ethpay.org or TBD -- community owned, openly managed domain
intent            "pay" for now, can support additional functionality in future
recipient         hex address or ENS
chain             chain ID
token             hex address or ENS or "native" to denote native token of chain
amount            human-readable precise decimal amount, eg 1.23

Optional query parameters

memo              optional memo, which may be transmitted offchain
wallet            recommended wallet, in case recipient has no wallet installed
callback          callback URL. redirect back on tx or userop success

Semantics

Wallet MUST prefill recipient, chain, token, and amount. The user should be able to complete payment immediately without re-entering information.

Wallet MUST parse amount as exact decimals. Also, wallet MUST show an error if the amount specifies more decimal digits than the token decimals().

Wallet SHOULD redirect back immediately on transaction or userop success, without waiting for the transaction or userop to be confirmed in a block. This minimizes user-felt latency.

When resolving ENS, wallet MUST respect per-chain addresses, if present. For example, usdc.tkn.eth points to separate token addresses on each chain.