您的 API 密钥在 React Native 中无效

Your API key is invalid in React Native

我正在使用 @wedoogift/react-native-checkout-payment 通过 checkout.com 集成 cards payments。初始化成功。当我尝试使用库描述中所写的以下代码来获取 access token 时,我得到了 error Your API key is invalid

初始化

useEffect(() => {
    CheckoutModule.initialize('pk', 'sandbox')
      // or 'live' instead of 'sandbox' for production env.
      .then(() => {
        console.log('Initialization is done.');
      });
  }, []);

访问令牌

CheckoutModule.generateToken({
    card: '4242424242424242',
    name: 'Card Owner',
    expiryMonth: '06',
    expiryYear: '25',
    cvv: '100'
}) // or 'live' for production env.
    .then((result) => {
        console.log('Card token is ' + result.id);
        // See CardTokenisationResponse in index.ts or index.d.ts 
        // to see the data structure of the result.
    })
    .catch((error) => {
        console.warn('Failed because: ' + error.message);
    });

我不知道从哪里得到它,把它放在哪里。库描述中没有关于此 API 密钥的任何内容。

如何解决这个问题。

谢谢

API 键应该放在示例代码中 'pk'(我猜这代表 public 键)的位置。

例如,如果您的 API 键是 0123456789

CheckoutModule.initialize('0123456789', 'sandbox')
...