0.0.1 • Published 6 months ago

hydrogenpay-astro v0.0.1

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

Hydrogen Astro JS SDK

Hydrogen AstroJS SDK allows you to accept payment using in your astro application

Installation

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

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

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

---
import HydrogenPayAstro from 'hydrogenpay-astro';
---

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    <meta name="viewport" content="width=device-width" />
    <meta name="generator" content={Astro.generator} />
    <title>Astro</title>
  </head>
  <body>
    <h1>Astro</h1>
    <HydrogenPayAstro
      buttonText="Hydrogen Pay"
      amount={500}
      email="test@mail.com"
      customerName="John Doe"
      apiKey="PK_TEST_cca53e0b3bc7847aff94502b8a585f84"
      description="Test description"
      currency="NGN"
      frequency={1}
      isRecurring={false}
      endDate="2025-10-02"
      meta="ewr34we4w"
    />
  </body>
  <script is:inline>
    window.onload = function () {
      window.onHydrogenPaySuccess = function (response, closeModal) {
        console.log(response);
        setTimeout(() => closeModal(), 3000);
      };
      window.onHydrogenPayClose = function (close) {
        console.log(close);
      };
    };
  </script>
</html>

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
onHydrogenPaySuccessFunctionOptionalCallback when transaction is successful
onHydrogenPayCloseFunctionOptionalCallback when transaction is closed of cancel
buttonTextStringOptionalPayment Button Text. Default: Hydrogen Pay
isRecurringboolOptionalRecurring Payment
frequencyStringOptionalRecurring Payment frequency
endDateStringOptionalRecurring Payment End Date. OPTIONAL but (REQUIRED when isRecurring = true)