Reputation: 792
I'm using @wedoogift/react-native-checkout-payment
to integrate cards payments
via checkout.com
. Initialization is done successfully. When I tried to get access token by using following piece of code as written in the library description, I got the error Your API key is invalid
.
Initialization
useEffect(() => {
CheckoutModule.initialize('pk', 'sandbox')
// or 'live' instead of 'sandbox' for production env.
.then(() => {
console.log('Initialization is done.');
});
}, []);
Access Token
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);
});
I don't know where to get it and where to place it. There is nothing in the library description about this API key.
How to resolve this thing.
Thanks
Upvotes: 0
Views: 512
Reputation: 30957
The API key should go where 'pk'
(I guess this stands for public key) is in the example code.
For example if your API key is 0123456789
CheckoutModule.initialize('0123456789', 'sandbox')
...
Upvotes: 1