velirapay 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this library are documented here. It follows [Semantic Versioning](https://semver.org).
4
4
 
5
+ ## 0.2.2 - 2026-11-12
6
+
7
+ - `charge.customer.ipCountry`, `ipAsn` and `ipNetwork`: what VeliraPay works out from the customer's IP address, in the API's answers and in webhooks alike. `ipCountry` is the country the hosted checkout placed the address in, as an ISO 3166 two-letter code or `T1` for Tor, and `null` for a charge created through the API; `ipAsn` is the number of the network (autonomous system) the address belongs to, and `ipNetwork` who runs it, such as `24940` and `'Hetzner Online GmbH'`. A customer on a hosting company's network is often a bot or someone hiding behind a server. They are read only, and `null` in a payload that leaves them out.
8
+
9
+ ## 0.2.1 - 2026-11-12
10
+
11
+ - `invoices.create()` takes `success_url` and `cancel_url`, public https:// addresses the invoice's page and its charges' checkout offer the customer a way back to: a button once they have paid, and a link while it is open. `invoice.successUrl` and `invoice.cancelUrl` read them back, and are `null` in webhooks, which leave them out.
12
+
5
13
  ## 0.2.0 - 2026-11-12
6
14
 
7
15
  ### Breaking
package/README.md CHANGED
@@ -203,6 +203,8 @@ charge.customer.metadata; // { orders: 7 }
203
203
 
204
204
  Every field is optional, and any other key is refused with a `ValidationError`. The older `customer_email` parameter still works.
205
205
 
206
+ The customer also comes back with what VeliraPay works out from the IP address, which you cannot send: `ipCountry`, the country the hosted checkout placed it in, as an ISO 3166 two-letter code or `'T1'` for Tor (`null` for a charge created through the API), and `ipAsn` and `ipNetwork`, the number of the network it belongs to and who runs it, such as `24940` and `'Hetzner Online GmbH'`. A customer on a hosting company's network is often a bot or someone hiding behind a server, and a country that differs from the one they gave is worth a second look.
207
+
206
208
  ### Network surcharges
207
209
 
208
210
  Passing a payment on costs the same whatever its size on some networks, so the customer pays that part: a charge in USDT on Tron (`Asset.USDT_TRON`) asks for 2.50 USDT on top of the price. The coin says so before it is chosen, as `coin.networkSurcharge` from `assets.list()`, so tell the customer; the checkout does. A charge counts it in `assetAmount` and gives it again as `charge.networkSurcharge`, which is `null` for every coin without one. VeliraPay keeps it: it is not part of your payout, and a refund can never include it.
@@ -243,6 +245,7 @@ const invoice = await velirapay.invoices.create({
243
245
  { description: 'Hosting', quantity: '1', unit_amount: '250.00' },
244
246
  ],
245
247
  due_at: '2026-12-01', // a day, as YYYY-MM-DD
248
+ success_url: 'https://example.com/orders/1042',
246
249
  send_email: true,
247
250
  });
248
251
 
@@ -469,7 +472,7 @@ The charge and invoice in a delivery are not quite the ones the API answers with
469
472
 
470
473
  - A charge's coin amounts and exchange rate carry all 18 decimal places (`"0.002500000000000000"` rather than `"0.0025"`). Compare amounts as numbers, not as strings.
471
474
  - A charge has no `timeline`, `refunds`, `checkoutUrl`, `receiptUrl`, `successUrl`, `cancelUrl` or `successMessage`. It names its payment link with its title and its invoice with its number: `charge.paymentLink` and `charge.invoice` hold the codes, and `charge.paymentLinkTitle` and `charge.invoiceNumber` the rest, which are `null` on the API's charges.
472
- - An invoice has no `overdue` or `documentUrl`; both are `null`.
475
+ - An invoice has no `overdue`, `documentUrl`, `successUrl` or `cancelUrl`; all four are `null`.
473
476
  - `charge.refunded` carries no refund. Read its amount, txid and reason from the event: `(await velirapay.events.retrieve(eventId)).details`.
474
477
 
475
478
  Fetch the object when you need what a delivery leaves out.
@@ -36,7 +36,7 @@ export interface ClientOptions {
36
36
  export declare class VeliraPayClient {
37
37
  #private;
38
38
  /** The version of this library. */
39
- static readonly VERSION = "0.2.0";
39
+ static readonly VERSION = "0.2.2";
40
40
  /** The address of the VeliraPay API. */
41
41
  static readonly DEFAULT_BASE_URL = "https://api.velirapay.com";
42
42
  /** The account the API key belongs to. */
@@ -93,6 +93,10 @@ export interface InvoiceCreateParams {
93
93
  memo?: string | null;
94
94
  /** The day it is due, as YYYY-MM-DD. */
95
95
  due_at?: string | null;
96
+ /** A public https:// address the customer is offered a button back to once they have paid. */
97
+ success_url?: string | null;
98
+ /** A public https:// address the customer can go back to from the invoice without paying. */
99
+ cancel_url?: string | null;
96
100
  send_email?: boolean;
97
101
  }
98
102
  export interface InvoiceListParams extends PageParams {
@@ -112,6 +112,12 @@ export declare class Customer extends ApiResource {
112
112
  readonly name: string | null;
113
113
  /** The IP address the customer paid from, recorded by the checkout or passed when the charge was created. */
114
114
  readonly ipAddress: string | null;
115
+ /** The country the hosted checkout placed the IP address in, as an ISO 3166 two-letter code, or T1 for Tor; null for a charge created through the API. */
116
+ readonly ipCountry: string | null;
117
+ /** The number of the network (autonomous system) the IP address belongs to, such as 24940. */
118
+ readonly ipAsn: number | null;
119
+ /** Who runs that network, such as an internet provider or a hosting company. */
120
+ readonly ipNetwork: string | null;
115
121
  /** The user agent of the browser the customer paid from. */
116
122
  readonly userAgent: string | null;
117
123
  /** Your own id for the customer. */
@@ -153,6 +153,12 @@ class Customer extends api_resource_ts_1.ApiResource {
153
153
  name;
154
154
  /** The IP address the customer paid from, recorded by the checkout or passed when the charge was created. */
155
155
  ipAddress;
156
+ /** The country the hosted checkout placed the IP address in, as an ISO 3166 two-letter code, or T1 for Tor; null for a charge created through the API. */
157
+ ipCountry;
158
+ /** The number of the network (autonomous system) the IP address belongs to, such as 24940. */
159
+ ipAsn;
160
+ /** Who runs that network, such as an internet provider or a hosting company. */
161
+ ipNetwork;
156
162
  /** The user agent of the browser the customer paid from. */
157
163
  userAgent;
158
164
  /** Your own id for the customer. */
@@ -168,6 +174,9 @@ class Customer extends api_resource_ts_1.ApiResource {
168
174
  this.email = (0, api_resource_ts_1.nullableString)(attributes, 'email');
169
175
  this.name = (0, api_resource_ts_1.nullableString)(attributes, 'name');
170
176
  this.ipAddress = (0, api_resource_ts_1.nullableString)(attributes, 'ip_address');
177
+ this.ipCountry = (0, api_resource_ts_1.nullableString)(attributes, 'ip_country');
178
+ this.ipAsn = (0, api_resource_ts_1.nullableInt)(attributes, 'ip_asn');
179
+ this.ipNetwork = (0, api_resource_ts_1.nullableString)(attributes, 'ip_network');
171
180
  this.userAgent = (0, api_resource_ts_1.nullableString)(attributes, 'user_agent');
172
181
  this.reference = (0, api_resource_ts_1.nullableString)(attributes, 'reference');
173
182
  this.phone = (0, api_resource_ts_1.nullableString)(attributes, 'phone');
@@ -46,6 +46,10 @@ export declare class Invoice extends ApiResource {
46
46
  readonly voidedAt: Date | null;
47
47
  /** When it was created. */
48
48
  readonly createdAt: Date | null;
49
+ /** The page the customer is offered a button back to once they have paid; absent from webhooks. */
50
+ readonly successUrl: string | null;
51
+ /** The page the customer can go back to from the invoice without paying; absent from webhooks. */
52
+ readonly cancelUrl: string | null;
49
53
  constructor(attributes: Attributes);
50
54
  /** Whether the invoice can still be paid. */
51
55
  isOpen(): boolean;
@@ -43,6 +43,10 @@ class Invoice extends api_resource_ts_1.ApiResource {
43
43
  voidedAt;
44
44
  /** When it was created. */
45
45
  createdAt;
46
+ /** The page the customer is offered a button back to once they have paid; absent from webhooks. */
47
+ successUrl;
48
+ /** The page the customer can go back to from the invoice without paying; absent from webhooks. */
49
+ cancelUrl;
46
50
  constructor(attributes) {
47
51
  super(attributes);
48
52
  this.id = (0, api_resource_ts_1.string)(attributes, 'id', (0, api_resource_ts_1.string)(attributes, 'code'));
@@ -68,6 +72,8 @@ class Invoice extends api_resource_ts_1.ApiResource {
68
72
  this.paidAt = (0, api_resource_ts_1.date)(attributes, 'paid_at');
69
73
  this.voidedAt = (0, api_resource_ts_1.date)(attributes, 'voided_at');
70
74
  this.createdAt = (0, api_resource_ts_1.date)(attributes, 'created_at');
75
+ this.successUrl = (0, api_resource_ts_1.nullableString)(attributes, 'success_url');
76
+ this.cancelUrl = (0, api_resource_ts_1.nullableString)(attributes, 'cancel_url');
71
77
  }
72
78
  /** Whether the invoice can still be paid. */
73
79
  isOpen() {
@@ -1,2 +1,2 @@
1
1
  /** The version of this library. */
2
- export declare const VERSION = "0.2.0";
2
+ export declare const VERSION = "0.2.2";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  /** The version of this library. */
5
- exports.VERSION = '0.2.0';
5
+ exports.VERSION = '0.2.2';
@@ -36,7 +36,7 @@ export interface ClientOptions {
36
36
  export declare class VeliraPayClient {
37
37
  #private;
38
38
  /** The version of this library. */
39
- static readonly VERSION = "0.2.0";
39
+ static readonly VERSION = "0.2.2";
40
40
  /** The address of the VeliraPay API. */
41
41
  static readonly DEFAULT_BASE_URL = "https://api.velirapay.com";
42
42
  /** The account the API key belongs to. */
@@ -93,6 +93,10 @@ export interface InvoiceCreateParams {
93
93
  memo?: string | null;
94
94
  /** The day it is due, as YYYY-MM-DD. */
95
95
  due_at?: string | null;
96
+ /** A public https:// address the customer is offered a button back to once they have paid. */
97
+ success_url?: string | null;
98
+ /** A public https:// address the customer can go back to from the invoice without paying. */
99
+ cancel_url?: string | null;
96
100
  send_email?: boolean;
97
101
  }
98
102
  export interface InvoiceListParams extends PageParams {
@@ -112,6 +112,12 @@ export declare class Customer extends ApiResource {
112
112
  readonly name: string | null;
113
113
  /** The IP address the customer paid from, recorded by the checkout or passed when the charge was created. */
114
114
  readonly ipAddress: string | null;
115
+ /** The country the hosted checkout placed the IP address in, as an ISO 3166 two-letter code, or T1 for Tor; null for a charge created through the API. */
116
+ readonly ipCountry: string | null;
117
+ /** The number of the network (autonomous system) the IP address belongs to, such as 24940. */
118
+ readonly ipAsn: number | null;
119
+ /** Who runs that network, such as an internet provider or a hosting company. */
120
+ readonly ipNetwork: string | null;
115
121
  /** The user agent of the browser the customer paid from. */
116
122
  readonly userAgent: string | null;
117
123
  /** Your own id for the customer. */
@@ -1,5 +1,5 @@
1
1
  import { ChargeStatus } from '../enums.js';
2
- import { ApiResource, bool, date, int, map, nullableString, objects, records, reference, string } from './api-resource.js';
2
+ import { ApiResource, bool, date, int, map, nullableInt, nullableString, objects, records, reference, string } from './api-resource.js';
3
3
  /** A single payment in one coin, with the rate locked and a deposit address of its own. */
4
4
  export class Charge extends ApiResource {
5
5
  /** The charge's public code, also the last segment of its checkout URL. */
@@ -149,6 +149,12 @@ export class Customer extends ApiResource {
149
149
  name;
150
150
  /** The IP address the customer paid from, recorded by the checkout or passed when the charge was created. */
151
151
  ipAddress;
152
+ /** The country the hosted checkout placed the IP address in, as an ISO 3166 two-letter code, or T1 for Tor; null for a charge created through the API. */
153
+ ipCountry;
154
+ /** The number of the network (autonomous system) the IP address belongs to, such as 24940. */
155
+ ipAsn;
156
+ /** Who runs that network, such as an internet provider or a hosting company. */
157
+ ipNetwork;
152
158
  /** The user agent of the browser the customer paid from. */
153
159
  userAgent;
154
160
  /** Your own id for the customer. */
@@ -164,6 +170,9 @@ export class Customer extends ApiResource {
164
170
  this.email = nullableString(attributes, 'email');
165
171
  this.name = nullableString(attributes, 'name');
166
172
  this.ipAddress = nullableString(attributes, 'ip_address');
173
+ this.ipCountry = nullableString(attributes, 'ip_country');
174
+ this.ipAsn = nullableInt(attributes, 'ip_asn');
175
+ this.ipNetwork = nullableString(attributes, 'ip_network');
167
176
  this.userAgent = nullableString(attributes, 'user_agent');
168
177
  this.reference = nullableString(attributes, 'reference');
169
178
  this.phone = nullableString(attributes, 'phone');
@@ -46,6 +46,10 @@ export declare class Invoice extends ApiResource {
46
46
  readonly voidedAt: Date | null;
47
47
  /** When it was created. */
48
48
  readonly createdAt: Date | null;
49
+ /** The page the customer is offered a button back to once they have paid; absent from webhooks. */
50
+ readonly successUrl: string | null;
51
+ /** The page the customer can go back to from the invoice without paying; absent from webhooks. */
52
+ readonly cancelUrl: string | null;
49
53
  constructor(attributes: Attributes);
50
54
  /** Whether the invoice can still be paid. */
51
55
  isOpen(): boolean;
@@ -40,6 +40,10 @@ export class Invoice extends ApiResource {
40
40
  voidedAt;
41
41
  /** When it was created. */
42
42
  createdAt;
43
+ /** The page the customer is offered a button back to once they have paid; absent from webhooks. */
44
+ successUrl;
45
+ /** The page the customer can go back to from the invoice without paying; absent from webhooks. */
46
+ cancelUrl;
43
47
  constructor(attributes) {
44
48
  super(attributes);
45
49
  this.id = string(attributes, 'id', string(attributes, 'code'));
@@ -65,6 +69,8 @@ export class Invoice extends ApiResource {
65
69
  this.paidAt = date(attributes, 'paid_at');
66
70
  this.voidedAt = date(attributes, 'voided_at');
67
71
  this.createdAt = date(attributes, 'created_at');
72
+ this.successUrl = nullableString(attributes, 'success_url');
73
+ this.cancelUrl = nullableString(attributes, 'cancel_url');
68
74
  }
69
75
  /** Whether the invoice can still be paid. */
70
76
  isOpen() {
@@ -1,2 +1,2 @@
1
1
  /** The version of this library. */
2
- export declare const VERSION = "0.2.0";
2
+ export declare const VERSION = "0.2.2";
@@ -1,2 +1,2 @@
1
1
  /** The version of this library. */
2
- export const VERSION = '0.2.0';
2
+ export const VERSION = '0.2.2';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package.json",
3
3
  "name": "velirapay",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "description": "The official Node.js library for VeliraPay crypto payments: charges, payment links, invoices, payouts, events and webhook verification.",
6
6
  "keywords": [
7
7
  "velirapay",