如何在 react-stripe-checkout 中传递自定义数据

问题描述

我想将一些自定义数据传递给在我的 React 应用程序中处理令牌的函数。 但我找不到办法。 StripeCheckout 组件接受处理函数的 token prop 来调用后端,但显然这个函数不支持额外的参数。

这是结帐按钮组件:

import StripeCheckout from "react-stripe-checkout";

<StripeCheckout stripeKey={"public_key"} token={handletoken} />

这是处理令牌的函数

const handletoken = async (token) => {
    //I want to have access to the custom data here
}

我试过:<StripeCheckout stripeKey={"public_key"} token={() => handletoken("customValue")} /> 但我传递的值会删除令牌本身。 无论如何通过保留令牌信息将自定义数据传递给函数? 提前致谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)