Buy Flow

To purchase an active listing, partners request a pre-constructed smart contract call transaction payload from the Partner API, then send it via the buyer's wallet client (e.g. MetaMask, Rabby, Wagmi).

This endpoint does not execute transactions or spend funds itself. It is a utility to generate correct Web3 calldata payloads.

Get Buy Transaction Payload

Request

POST /v1/listings/:orderHash/buy-transaction

Headers:

  • x-api-key: mp_part_yourkey
JSON
{
"buyer": "0xbuyerwalletaddress...",
"payWithToken": "CRO"
}
  • buyer (string, required) - The wallet address executing the purchase.
  • payWithToken (string, optional) - The payment option: "CRO" (native CRO, default) or "WCRO" (wrapped CRO).

Response

JSON
{
"chainId": 25,
"to": "0xdFbE43b2c154B6a790158fa2696cDb32A86Efc78",
"value": "100000000000000000000",
"data": "0xmatchAskWithTakerBidUsingETHAndWETHCalldata...",
"orderHash": "0xabcde12345...",
"priceWei": "100000000000000000000",
"currency": "WCRO"
}

ERC-20 Token Allowance

If the checkout currency is WCRO, the buyer must have granted a transfer allowance to the MintpadExchange contract to deduct the price of the listing.

Before submitting the buy transaction, check the allowance of the buyer's wallet. If the current allowance is less than the listing price (priceWei), request the user to sign an approval transaction calling approve on the payment token contract:

  • Token Address: 0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23 (WCRO)
  • Exchange Address (Spender): 0xdFbE43b2c154B6a790158fa2696cDb32A86Efc78
  • Approval Function: approve(exchangeAddress, priceWei)

Execute via Wallet (Frontend)

Pass the returned payload to your wallet's transaction execution handler. For example, using viem / wagmi:

TypeScript
const txHash = await walletClient.sendTransaction({
to: payload.to,
data: payload.data,
value: BigInt(payload.value), // sent as value if paying with native CRO
})

If the user chosen to pay with "WCRO", the value field in the response will be "0". Make sure the buyer has approved the MintpadExchange contract to transfer their WCRO before executing the transaction!