@astropay/payments-lib 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  ![AstroPay](https://getapp.astropay.com/img/astropay/2023/logo-black.svg)
5
5
  </a>
6
+
6
7
  </div>
7
8
 
8
9
  AstroPay's official frontend library that allows you to easily embed customizable and secure payment components into your website or e-commerce platform. It supports seamless international transactions, theming, localization, and real-time payment processing — all with minimal setup.
@@ -11,6 +12,7 @@ AstroPay's official frontend library that allows you to easily embed customizabl
11
12
 
12
13
  [![NPM version](https://img.shields.io/npm/v/@astropay/payments-lib/latest.svg)](https://www.npmjs.com/package/@astropay/payments-lib)
13
14
  [![NPM downloads](https://img.shields.io/npm/dm/@astropay/payments-lib.svg)](https://www.npmjs.com/package/@astropay/payments-lib)
15
+
14
16
  </div>
15
17
 
16
18
  ## 🚀 Quick Links
@@ -30,7 +32,7 @@ AstroPay's official frontend library that allows you to easily embed customizabl
30
32
  - [Yarn](#yarn)
31
33
  - [🚀 Basic Usage](#-basic-usage)
32
34
  - [🧩 Components](#-components)
33
- - [AstroPayPaymentComponent](#astropaypaymentcomponent)
35
+ - [AstroPayFullCheckout](#astropayfullcheckout)
34
36
  - [Props](#props)
35
37
  - [Example](#example)
36
38
  - [🎨 Styling \& Theming](#-styling--theming)
@@ -81,10 +83,10 @@ yarn add @astropay/payments-lib
81
83
  Initialize the library with your API token and optional configuration:
82
84
 
83
85
  ```typescript
84
- import AstroPayPaymentsLib, { AstroPayPaymentComponent } from '@astropay/payments-lib';
86
+ import AstroPayCore, { AstroPayFullCheckout } from '@astropay/payments-lib';
85
87
 
86
88
  // Initialize the library
87
- AstroPayPaymentsLib.init('app-id', {
89
+ AstroPayCore.init('app-id', {
88
90
  environment: 'production', // or 'sandbox'
89
91
  theme: 'light', // or 'dark'
90
92
  language: 'en', // or 'es', 'pt'
@@ -94,7 +96,7 @@ AstroPayPaymentsLib.init('app-id', {
94
96
  // Use the payment component in your application
95
97
  // Note: Make sure an HTML element with id="payment-container" exists in your DOM before running this code
96
98
  const paymentElement = document.getElementById('payment-container');
97
- const payment = new AstroPayPaymentComponent({
99
+ const payment = new AstroPayFullCheckout({
98
100
  amount: 100,
99
101
  currency: 'USD',
100
102
  country: 'BR',
@@ -105,26 +107,26 @@ paymentElement.appendChild(payment.element);
105
107
 
106
108
  ## 🧩 Components
107
109
 
108
- ### AstroPayPaymentComponent
110
+ ### AstroPayFullCheckout
109
111
 
110
112
  The main component for rendering a payment interface.
111
113
 
112
114
  #### Props
113
115
 
114
- | Prop | Type | Required | Description |
115
- |------|------|----------|-------------|
116
- | amount | number | Yes | The payment amount |
117
- | currency | string | Yes | The currency code (e.g., 'USD') |
118
- | country | string | Yes | The country code (e.g., 'BR', 'US') |
119
- | showTitle | boolean | No | Whether to show the component title (defaults to `true`) |
120
- | showDescription | boolean | No | Whether to show the payment description (defaults to `true`) |
116
+ | Prop | Type | Required | Description |
117
+ | --------------- | ------- | -------- | ------------------------------------------------------------ |
118
+ | amount | number | Yes | The payment amount |
119
+ | currency | string | Yes | The currency code (e.g., 'USD') |
120
+ | country | string | Yes | The country code (e.g., 'BR', 'US') |
121
+ | showTitle | boolean | No | Whether to show the component title (defaults to `true`) |
122
+ | showDescription | boolean | No | Whether to show the payment description (defaults to `true`) |
121
123
 
122
124
  #### Example
123
125
 
124
126
  ```typescript
125
- import { AstroPayPaymentComponent } from '@astropay/payments-lib';
127
+ import { AstroPayFullCheckout } from '@astropay/payments-lib';
126
128
 
127
- const paymentComponent = new AstroPayPaymentComponent({
129
+ const fullCheckoutComponent = new AstroPayFullCheckout({
128
130
  amount: 100,
129
131
  currency: 'USD',
130
132
  country: 'US',
@@ -134,7 +136,7 @@ const paymentComponent = new AstroPayPaymentComponent({
134
136
  });
135
137
 
136
138
  // Note: Make sure an HTML element with id="payment-container" exists in your DOM before running this code
137
- document.getElementById('payment-container').appendChild(paymentComponent.element);
139
+ document.getElementById('payment-container').appendChild(fullCheckoutComponent.element);
138
140
  ```
139
141
 
140
142
  ## 🎨 Styling & Theming
@@ -151,7 +153,7 @@ The library comes with two built-in themes:
151
153
  You can specify the theme during initialization:
152
154
 
153
155
  ```typescript
154
- AstroPayPaymentsLib.init('app-id', {
156
+ AstroPayCore.init('app-id', {
155
157
  theme: 'dark',
156
158
  environment: 'production', // or 'sandbox'
157
159
  language: 'en',
@@ -164,7 +166,7 @@ AstroPayPaymentsLib.init('app-id', {
164
166
  You can customize the styling by providing a `styles` object in the initialization configuration:
165
167
 
166
168
  ```typescript
167
- AstroPayPaymentsLib.init('app-id', {
169
+ AstroPayCore.init('app-id', {
168
170
  styles: {
169
171
  primaryColor: '#FF5500',
170
172
  secondaryColor: '#00AAFF',
@@ -179,15 +181,15 @@ AstroPayPaymentsLib.init('app-id', {
179
181
 
180
182
  #### Available Style Properties
181
183
 
182
- | Property | Type | Description |
183
- |----------|------|-------------|
184
- | primaryColor | string | Primary brand color |
185
- | secondaryColor | string | Secondary brand color |
186
- | backgroundColor | string | Background color |
187
- | textPrimaryColor | string | Primary text color |
188
- | textSecondaryColor | string | Secondary text color |
189
- | fontFamily | string | Font family |
190
- | width | number | Component width in pixels |
184
+ | Property | Type | Description |
185
+ | ------------------ | ------ | ------------------------- |
186
+ | primaryColor | string | Primary brand color |
187
+ | secondaryColor | string | Secondary brand color |
188
+ | backgroundColor | string | Background color |
189
+ | textPrimaryColor | string | Primary text color |
190
+ | textSecondaryColor | string | Secondary text color |
191
+ | fontFamily | string | Font family |
192
+ | width | number | Component width in pixels |
191
193
 
192
194
  ## 🌐 Internationalization
193
195
 
@@ -202,7 +204,7 @@ The library supports multiple languages through the i18next internationalization
202
204
  You can specify the language during initialization:
203
205
 
204
206
  ```typescript
205
- AstroPayPaymentsLib.init('app-id', {
207
+ AstroPayCore.init('app-id', {
206
208
  language: 'es',
207
209
  });
208
210
  ```