1.0.0 • Published 9 months ago

hydrogenpay-svelte v1.0.0

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

Hydrogen Svelte SDK

Hydrogen Svelte SDK allows you to accept payment using in your svelte application

Installation

Register for a merchant account on Hydrogen Merchant Dashboard to get started.

npm install --save hydrogenpay-svelte
yarn add hydrogenpay-svelte
pnpm add hydrogenpay-svelte

Support

If you have any problems, questions or suggestions, create an issue here or send your inquiry to support@hydrogenpay.com

Implementation

You should already have your api key, If not, go to Profile & Settings.

Usage

<script>
	import HydrogenPay from 'hydrogenpay-svelte';
</script>

<main>
	<HydrogenPay
		amount={500}
		email="test@mail.com"
		customerName="John Doe"
		meta="ewr34we4w"
		apiKey="PK_TEST_cca53e0b3bc7847aff94502b8a585f84"
		description="Test description"
		currency="NGN"
		frequency={1}
		isRecurring={false}
		endDate="2025-10-02"
		buttonText="Pay With Hydrogen"
		onSuccess={(response, closeModal) => {
			console.log(response);

			setTimeout(() => closeModal(), 3000);
		}}
		onClose={(close) => {
			console.log(close);
		}}
		buttonStyle={{
			style:
				'padding-top: 10px; padding-bottom: 10px; width: 50%; border-radius: 8px; color: #000; font-size: 10px',
		}}
	/>
</main>

<style>
	main {
		text-align: center;
		padding: 1em;
		max-width: 240px;
		margin: 0 auto;
	}
</style>

Options Type

NameTypeRequiredDesc
currencyStringRequiredThe currency for the transaction e.g NGN, USD
emailStringRequiredThe email of the user to be charged
descriptionStringOptionalThe transaction description
customerNameStringRequiredThe fullname of the user to be charged
amountNumberRequiredThe transaction amount
apiKeyStringRequiredYour LIVE or TEST apiKey or see above step to get yours
onSuccessFunctionOptionalCallback when transaction is successful
onCloseFunctionOptionalCallback when transaction is closed of cancel
buttonTextStringOptionalPayment Button Text. Default: Hydrogen Pay
buttonStyleObjectOptionalStyling Object
isRecurringbooleanOptionalRecurring Payment
frequencyStringOptionalRecurring Payment frequency
endDateStringOptionalRecurring Payment End Date. OPTIONAL but (REQUIRED when isRecurring = true)
1.0.0

9 months ago