You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Crossmint支付按钮集成故障排查求助

Crossmint支付按钮集成信用卡支付异常排查

初始异常情况

在React前端集成Crossmint支付按钮实现信用卡支付功能时,出现如下错误提示:

"An error has occurred
Try again later. If the error persists contact us at crossmint.io/help"

错误截图:
初始错误界面

使用的前端代码:

<CrossmintPayButton
  clientId="028123eb-26ca-4a4e-9b80-02bd5719eb2e"
  mintConfig={{
    type: "erc-721",
    totalPrice: "70",
    _mintAmount: "1",
  }}
  mintTo={walletConnected}
  environment="staging"
/>

对应的智能合约部署在Mumbai测试网,需调用的crossmint函数代码如下:

function crossmint(address _to, uint256 _mintAmount) external payable {
    uint256 totalSupply = totalSupply();

    if (msg.sender != crossmintAddress) revert crossmintErr();
    if (getWhitelistOn()) require(isWhitelisted[_to] || _to == owner());
    if (paused && _to != owner()) revert pausedErr();
    if (_mintAmount <= 0 || _mintAmount > maxMintAmount) revert mintAmountErr();
    if (totalSupply + _mintAmount > maxSupply[mintPhase]) revert totalSupplyErr();

    uint256 payAmount = getMintPayAmount(_to, _mintAmount, cost[mintPhase]);

    if (_to != owner() && msg.value < payAmount.getConversionRate(priceFeed))
        revert payAmountErr();

    unchecked {
        for (uint256 i = 1; i <= _mintAmount; i++) {
            _safeMint(_to, totalSupply + i);
            emit NftMinted(totalSupply + i, _to);
        }
    }
}

注:该函数在正常mint逻辑基础上,新增了msg.sender必须等于crossmintAddress的校验,已确认crossmintAddress已按文档要求设置为"0xDa30ee0788276c093e686780C25f6C9431027234"。另外注意到错误界面中totalPrice显示为空,但未找到原因。

修正后的新异常

发现mintTo参数传入了错误值(非实际接收地址),修正后出现交易回滚提示:

Contract error: execution reverted, no custom error mapping or message found, contact Crossmint support to set up error mapping

回滚错误截图:
交易回滚错误界面

核心疑问

交易回滚是否可能因totalPrice未被正确读取导致?目前交易预览中totalPrice仍显示为空。

内容的提问来源于stack exchange,提问作者Kaladin Stormblessed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 07:55:19