0.1.1 • Published 10 months ago

@galliun/react v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@galliun/react

React component for integrating Galliun Payment Protocol into your React applications. Provides a customizable payment button that handles the payment flow.

Features

  • 🎨 Customizable button styles and themes
  • 🔄 Built-in payment flow handling
  • 📱 Responsive design
  • 🎯 TypeScript support
  • 🔌 Easy integration

Installation

npm install @galliun/react
# or
yarn add @galliun/react

Quick Start

import { GalliunButton } from '@galliun/react';

function App() {
	return (
		<GalliunButton
			productId="YOUR_PRODUCT_ID"
			onSuccess={(result) => {
				console.log('Payment successful!', result);
			}}
			onError={(error) => {
				console.error('Payment failed:', error);
			}}
			onClose={() => {
				console.log('Payment window closed');
			}}
			onLoaded={() => {
				console.log('Payment window loaded');
			}}
		/>
	);
}

Props

PropTypeRequiredDescription
productIdstringYesThe ID of the product to be purchased
onSuccessfunctionYesCalled when payment is successful
onErrorfunctionYesCalled when payment fails
onClosefunctionYesCalled when payment window is closed
onLoadedfunctionYesCalled when payment window is loaded
buttonTextstringNoCustom text for the button (default: "Pay with Galliun")
buttonTheme'light' | 'dark'NoButton theme (default: 'light')
buttonSize'small' | 'medium' | 'large'NoButton size (default: 'medium')
customStylesobjectNoCustom CSS styles for the button
disabledbooleanNoWhether the button is disabled
baseUrlstringNoCustom base URL for the payment service

Styling Examples

Basic Theme

<GalliunButton
	productId="YOUR_PRODUCT_ID"
	buttonText="Pay Now"
	buttonTheme="light"
	buttonSize="large"
	onSuccess={handleSuccess}
	onError={handleError}
/>

Custom Styling

<GalliunButton
	productId="YOUR_PRODUCT_ID"
	customStyles={{
		background: '#0369a1',
		color: 'white',
		padding: '1rem',
		borderRadius: '0.5rem',
		fontSize: '1.125rem',
		fontWeight: '600',
		'&:hover': {
			background: '#0284c7',
		},
	}}
	onSuccess={handleSuccess}
	onError={handleError}
/>

Documentation

For detailed documentation, visit our GitBook Documentation.

License

MIT License

0.1.1

10 months ago

0.1.0

10 months ago