The foundation for all Reevit payment SDKs. It provides the shared API client, state machine logic, type definitions, and utility functions used by the React, Vue, and Svelte SDKs.
npm install @reevit/core
If you're building a custom integration or another framework SDK, you can use the core components directly.
import { ReevitAPIClient } from '@reevit/core';
const client = new ReevitAPIClient({
publicKey: 'pk_test_xxx',
});
// Create a payment intent
const { data, error } = await client.createPaymentIntent({
amount: 5000,
currency: 'GHS',
email: '[email protected]',
}, 'card');
if (data) {
console.log('Intent created:', data.id);
}
import { formatAmount, validatePhone, detectNetwork } from '@reevit/core';
console.log(formatAmount(10000, 'GHS')); // "GH₵ 100.00"
console.log(validatePhone('0241234567')); // true
console.log(detectNetwork('0241234567')); // "mtn"
MIT © Reevit