liqpay-nestjs 0.2.15 → 0.2.17
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 +338 -6
- package/dist/core/__devtypes/documented/checkout.callback.d.ts +10 -10
- package/dist/core/__devtypes/documented/checkout.request.d.ts +13 -13
- package/dist/core/__devtypes/documented/detail-addenda.d.ts +1 -1
- package/dist/core/__devtypes/documented/envelope.d.ts +1 -1
- package/dist/core/__devtypes/documented/fiscal-data.d.ts +7 -7
- package/dist/core/__devtypes/documented/payment-status.request.d.ts +1 -1
- package/dist/core/__devtypes/documented/payment-status.response.d.ts +13 -13
- package/dist/core/__devtypes/documented/split-rule.d.ts +5 -5
- package/dist/core/__devtypes/documented/types.d.ts +29 -29
- package/dist/core/__devtypes/documented/types.js +153 -153
- package/dist/core/__devtypes/payloads.d.ts +7 -7
- package/dist/core/__devtypes/undocumented/checkout.callback.d.ts +10 -10
- package/dist/core/__devtypes/undocumented/checkout.request.d.ts +13 -13
- package/dist/core/__devtypes/undocumented/detail-addenda.d.ts +1 -1
- package/dist/core/__devtypes/undocumented/envelope.d.ts +1 -1
- package/dist/core/__devtypes/undocumented/fiscal-data.d.ts +7 -7
- package/dist/core/__devtypes/undocumented/payment-status.request.d.ts +1 -1
- package/dist/core/__devtypes/undocumented/payment-status.response.d.ts +13 -13
- package/dist/core/__devtypes/undocumented/split-rule.d.ts +5 -5
- package/dist/core/__devtypes/undocumented/types.d.ts +29 -29
- package/dist/core/__devtypes/undocumented/types.js +153 -153
- package/dist/core/clients/liqpay.client.d.ts +4 -4
- package/dist/core/clients/liqpay.client.js +3 -3
- package/dist/core/clients/payments.client.d.ts +10 -10
- package/dist/core/clients/payments.client.js +7 -7
- package/dist/core/clients/utils.client.d.ts +7 -7
- package/dist/core/clients/utils.client.js +3 -3
- package/dist/core/clients/webhooks.client.d.ts +6 -6
- package/dist/core/clients/webhooks.client.js +4 -4
- package/dist/core/types/base/request.type.d.ts +4 -4
- package/dist/core/types/base/response.type.d.ts +5 -5
- package/dist/core/types/checkout/checkout-callback.schema.d.ts +8 -8
- package/dist/core/types/checkout/checkout-callback.schema.js +11 -11
- package/dist/core/types/checkout/checkout-request.schema.d.ts +11 -11
- package/dist/core/types/checkout/checkout-request.schema.js +11 -11
- package/dist/core/types/common/detail-addenda.schema.d.ts +2 -2
- package/dist/core/types/common/detail-addenda.schema.js +2 -2
- package/dist/core/types/common/enums/action.schema.d.ts +2 -2
- package/dist/core/types/common/enums/action.schema.js +2 -2
- package/dist/core/types/common/enums/bonus-type.schema.d.ts +2 -2
- package/dist/core/types/common/enums/bonus-type.schema.js +2 -2
- package/dist/core/types/common/enums/commission-payer.schema.d.ts +2 -2
- package/dist/core/types/common/enums/commission-payer.schema.js +2 -2
- package/dist/core/types/common/enums/currency.schema.d.ts +2 -2
- package/dist/core/types/common/enums/currency.schema.js +2 -2
- package/dist/core/types/common/enums/language.schema.d.ts +2 -2
- package/dist/core/types/common/enums/language.schema.js +2 -2
- package/dist/core/types/common/enums/mpi-eci.schema.d.ts +2 -2
- package/dist/core/types/common/enums/mpi-eci.schema.js +2 -2
- package/dist/core/types/common/enums/payment-status.schema.d.ts +8 -8
- package/dist/core/types/common/enums/payment-status.schema.js +8 -8
- package/dist/core/types/common/enums/paytype.schema.d.ts +2 -2
- package/dist/core/types/common/enums/paytype.schema.js +2 -2
- package/dist/core/types/common/enums/request-result.schema.d.ts +2 -2
- package/dist/core/types/common/enums/request-result.schema.js +2 -2
- package/dist/core/types/common/enums/subscribe-period.schema.d.ts +2 -2
- package/dist/core/types/common/enums/subscribe-period.schema.js +2 -2
- package/dist/core/types/common/enums/unit.schema.d.ts +3 -3
- package/dist/core/types/common/enums/unit.schema.js +52 -52
- package/dist/core/types/common/enums/version.schema.d.ts +1 -0
- package/dist/core/types/common/fiscal-data.schema.d.ts +12 -12
- package/dist/core/types/common/fiscal-data.schema.js +9 -9
- package/dist/core/types/common/split-rule.schema.d.ts +3 -3
- package/dist/core/types/common/split-rule.schema.js +4 -4
- package/dist/core/types/payment-status/payment-status-request.schema.d.ts +4 -4
- package/dist/core/types/payment-status/payment-status-request.schema.js +4 -4
- package/dist/core/types/payment-status/payment-status-response.schema.d.ts +4 -4
- package/dist/core/types/payment-status/payment-status-response.schema.js +13 -13
- package/dist/core/url.type.d.ts +3 -3
- package/dist/core/url.type.js +5 -5
- package/dist/core/utils/is-success.util.d.ts +2 -2
- package/dist/nest/liqpay.service.d.ts +3 -3
- package/dist/nest/liqpay.service.js +2 -2
- package/dist/nest/services/payments.service.d.ts +8 -8
- package/dist/nest/services/payments.service.js +3 -3
- package/dist/nest/services/webhooks.service.d.ts +3 -3
- package/dist/nest/services/webhooks.service.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,347 @@
|
|
|
1
1
|
# liqpay-nestjs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
NestJS module for LiqPay payments with DI-friendly configuration, signed checkout helpers, typed request and response models, and webhook callback parsing.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- NestJS module with `forRoot` and `forRootAsync`
|
|
8
|
+
- `LiqpayService` with payment and webhook helpers
|
|
9
|
+
- Signed checkout URL and checkout form generation
|
|
10
|
+
- Typed payment status requests
|
|
11
|
+
- Callback signature validation and payload parsing
|
|
12
|
+
- Exported Zod schemas and TypeScript types from the package root
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- Node.js `>= 18`
|
|
17
|
+
- `@nestjs/common` `^10 || ^11`
|
|
18
|
+
- `@nestjs/core` `^10 || ^11`
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
4
21
|
|
|
5
22
|
```bash
|
|
6
|
-
|
|
23
|
+
npm install liqpay-nestjs
|
|
7
24
|
```
|
|
8
25
|
|
|
9
|
-
|
|
26
|
+
## Quick Start
|
|
10
27
|
|
|
11
|
-
|
|
12
|
-
|
|
28
|
+
### Register the module
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { Module } from '@nestjs/common'
|
|
32
|
+
import { LiqPayModule } from 'liqpay-nestjs'
|
|
33
|
+
|
|
34
|
+
@Module({
|
|
35
|
+
imports: [
|
|
36
|
+
LiqPayModule.forRoot({
|
|
37
|
+
publicKey: process.env.LIQPAY_PUBLIC_KEY!,
|
|
38
|
+
privateKey: process.env.LIQPAY_PRIVATE_KEY!,
|
|
39
|
+
resultUrl: 'https://example.com/payments/result',
|
|
40
|
+
serverUrl: 'https://example.com/payments/webhook',
|
|
41
|
+
isGlobal: true,
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
})
|
|
45
|
+
export class AppModule {}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Register the module asynchronously
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { Module } from '@nestjs/common'
|
|
52
|
+
import { ConfigModule, ConfigService } from '@nestjs/config'
|
|
53
|
+
import { LiqPayModule } from 'liqpay-nestjs'
|
|
54
|
+
|
|
55
|
+
@Module({
|
|
56
|
+
imports: [
|
|
57
|
+
ConfigModule.forRoot(),
|
|
58
|
+
LiqPayModule.forRootAsync({
|
|
59
|
+
imports: [ConfigModule],
|
|
60
|
+
inject: [ConfigService],
|
|
61
|
+
useFactory: (config: ConfigService) => ({
|
|
62
|
+
publicKey: config.getOrThrow<string>('LIQPAY_PUBLIC_KEY'),
|
|
63
|
+
privateKey: config.getOrThrow<string>('LIQPAY_PRIVATE_KEY'),
|
|
64
|
+
resultUrl: config.get<string>('LIQPAY_RESULT_URL'),
|
|
65
|
+
serverUrl: config.get<string>('LIQPAY_SERVER_URL'),
|
|
66
|
+
isGlobal: true,
|
|
67
|
+
}),
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
})
|
|
71
|
+
export class AppModule {}
|
|
13
72
|
```
|
|
14
73
|
|
|
15
|
-
|
|
74
|
+
### Inject and use `LiqpayService`
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { Controller, Get, Query } from '@nestjs/common'
|
|
78
|
+
import { CheckoutRequest, LiqpayService } from 'liqpay-nestjs'
|
|
79
|
+
|
|
80
|
+
@Controller('payments')
|
|
81
|
+
export class PaymentsController {
|
|
82
|
+
constructor(private readonly liqpay: LiqpayService) {}
|
|
83
|
+
|
|
84
|
+
@Get('checkout-url')
|
|
85
|
+
getCheckoutUrl(@Query('orderId') orderId: string) {
|
|
86
|
+
const payload: CheckoutRequest = {
|
|
87
|
+
action: 'pay',
|
|
88
|
+
amount: 199,
|
|
89
|
+
currency: 'UAH',
|
|
90
|
+
description: 'Order payment',
|
|
91
|
+
orderId,
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
url: this.liqpay.payments.getCheckoutUrl(payload),
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Typical Flow
|
|
102
|
+
|
|
103
|
+
1. Register `LiqPayModule` with your public and private keys.
|
|
104
|
+
2. Create a checkout URL or checkout form from a `CheckoutRequest`.
|
|
105
|
+
3. Point `serverUrl` to a Nest endpoint that receives the LiqPay callback envelope.
|
|
106
|
+
4. Parse the callback with `liqpay.webhooks.parseCheckoutCallback(...)`.
|
|
107
|
+
5. Optionally confirm the final state with `liqpay.payments.getPaymentStatus(orderId)`.
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
Both `LiqPayModule.forRoot(...)` and `LiqPayModule.forRootAsync(...)` resolve to the same options shape.
|
|
112
|
+
|
|
113
|
+
| Option | Type | Required | Description |
|
|
114
|
+
| ------------ | --------- | -------- | ------------------------------------------------------------------------------------ |
|
|
115
|
+
| `publicKey` | `string` | Yes | LiqPay public key. |
|
|
116
|
+
| `privateKey` | `string` | Yes | LiqPay private key used for request signing. |
|
|
117
|
+
| `resultUrl` | `string` | No | Default redirect URL after checkout. Can be overridden per request. |
|
|
118
|
+
| `serverUrl` | `string` | No | Default callback URL for LiqPay server notifications. Can be overridden per request. |
|
|
119
|
+
| `isGlobal` | `boolean` | No | Registers the Nest module as global when set to `true`. Defaults to `false`. |
|
|
120
|
+
|
|
121
|
+
The async registration path validates the resolved options at runtime and throws if `publicKey` or `privateKey` are missing or not strings.
|
|
122
|
+
|
|
123
|
+
## LiqpayService API
|
|
124
|
+
|
|
125
|
+
`LiqpayService` exposes two sub-services:
|
|
126
|
+
|
|
127
|
+
- `payments`
|
|
128
|
+
- `webhooks`
|
|
129
|
+
|
|
130
|
+
### `payments.getCheckoutUrl(payload)`
|
|
131
|
+
|
|
132
|
+
Builds a signed LiqPay checkout URL.
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
const url = liqpay.payments.getCheckoutUrl({
|
|
136
|
+
action: 'pay',
|
|
137
|
+
amount: 100,
|
|
138
|
+
currency: 'UAH',
|
|
139
|
+
description: 'Order #123',
|
|
140
|
+
orderId: 'order-123',
|
|
141
|
+
})
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Notes:
|
|
145
|
+
|
|
146
|
+
- This is a pure helper and does not perform an HTTP request.
|
|
147
|
+
- The library signs the payload with the configured private key.
|
|
148
|
+
- `version` is always sent as `7`.
|
|
149
|
+
- `resultUrl` and `serverUrl` fall back to module-level defaults if omitted from the payload.
|
|
150
|
+
|
|
151
|
+
### `payments.getCheckoutForm(payload, buttonText?, buttonColor?)`
|
|
152
|
+
|
|
153
|
+
Returns an HTML form string with LiqPay's `sdk-button` widget.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const html = liqpay.payments.getCheckoutForm(
|
|
157
|
+
{
|
|
158
|
+
action: 'pay',
|
|
159
|
+
amount: 100,
|
|
160
|
+
currency: 'UAH',
|
|
161
|
+
description: 'Order #123',
|
|
162
|
+
orderId: 'order-123',
|
|
163
|
+
},
|
|
164
|
+
'Pay now',
|
|
165
|
+
'#1f9d55',
|
|
166
|
+
)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Defaults:
|
|
170
|
+
|
|
171
|
+
- `buttonText`: `Pay`
|
|
172
|
+
- `buttonColor`: `#77CC5D`
|
|
173
|
+
|
|
174
|
+
### `payments.create(payload)`
|
|
175
|
+
|
|
176
|
+
Returns the normalized checkout payload together with the generated `checkoutUrl`.
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
const checkout = liqpay.payments.create({
|
|
180
|
+
action: 'pay',
|
|
181
|
+
amount: 100,
|
|
182
|
+
currency: 'UAH',
|
|
183
|
+
description: 'Order #123',
|
|
184
|
+
orderId: 'order-123',
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
console.log(checkout.checkoutUrl)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Use this when you want both the prepared payload and the final redirect URL without making a network call.
|
|
191
|
+
|
|
192
|
+
### `payments.getPaymentStatus(orderId)`
|
|
193
|
+
|
|
194
|
+
Calls LiqPay's status API and returns `Promise<Result<PaymentStatusResponse>>`.
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
const result = await liqpay.payments.getPaymentStatus('order-123')
|
|
198
|
+
|
|
199
|
+
if (result.error) {
|
|
200
|
+
console.error(result.error.code, result.error.description)
|
|
201
|
+
} else {
|
|
202
|
+
console.log(result.data.status)
|
|
203
|
+
console.log(result.data.amount)
|
|
204
|
+
console.log(result.data.orderId)
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
You only pass `orderId`; the library builds the `status` request internally.
|
|
209
|
+
|
|
210
|
+
### `webhooks.parseCheckoutCallback(envelope)`
|
|
211
|
+
|
|
212
|
+
Validates the callback signature, decodes the Base64 payload, and parses it into `Promise<Result<CheckoutCallback>>`.
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
import { Body, Controller, Post } from '@nestjs/common'
|
|
216
|
+
import { LiqPayEnvelope, LiqpayService } from 'liqpay-nestjs'
|
|
217
|
+
|
|
218
|
+
@Controller('payments')
|
|
219
|
+
export class WebhookController {
|
|
220
|
+
constructor(private readonly liqpay: LiqpayService) {}
|
|
221
|
+
|
|
222
|
+
@Post('webhook')
|
|
223
|
+
async handleWebhook(@Body() envelope: LiqPayEnvelope) {
|
|
224
|
+
const result = await this.liqpay.webhooks.parseCheckoutCallback(envelope)
|
|
225
|
+
|
|
226
|
+
if (result.error) {
|
|
227
|
+
return { ok: false, error: result.error }
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return { ok: true, callback: result.data }
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
The expected envelope shape is:
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
type LiqPayEnvelope = {
|
|
239
|
+
data: string
|
|
240
|
+
signature: string
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Request and Response Normalization
|
|
245
|
+
|
|
246
|
+
The library normalizes the most common application-facing models and handles LiqPay's wire format for you.
|
|
247
|
+
|
|
248
|
+
- Top-level checkout and status request fields use the expected TypeScript property names, for example `orderId`, `resultUrl`, `serverUrl`, and `senderFirstName`.
|
|
249
|
+
- Some nested LiqPay-specific helper objects keep the exact field names defined by their exported schemas. When in doubt, validate against the schema you are using.
|
|
250
|
+
- Outgoing requests are serialized into the format LiqPay expects.
|
|
251
|
+
- Callback and status responses are transformed back to camelCase.
|
|
252
|
+
- Dates, booleans, and several enum-backed fields are normalized where possible.
|
|
253
|
+
- Checkout signing always uses the module's configured public and private keys.
|
|
254
|
+
|
|
255
|
+
## Minimal Checkout Payload
|
|
256
|
+
|
|
257
|
+
The smallest useful `CheckoutRequest` usually looks like this:
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
import { CheckoutRequest } from 'liqpay-nestjs'
|
|
261
|
+
|
|
262
|
+
const payload: CheckoutRequest = {
|
|
263
|
+
action: 'pay',
|
|
264
|
+
amount: 100,
|
|
265
|
+
currency: 'UAH',
|
|
266
|
+
description: 'Order #123',
|
|
267
|
+
orderId: 'order-123',
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
`CheckoutRequest` also supports many LiqPay-specific fields for advanced scenarios, including:
|
|
272
|
+
|
|
273
|
+
- recurring payments: `subscribe`, `subscribeDateStart`, `subscribePeriodicity`
|
|
274
|
+
- one-click and tokenized flows: `cardToken`, `customer`, `customerUserId`, `recurringbytoken`
|
|
275
|
+
- fiscalization: `rroInfo`, `dae`
|
|
276
|
+
- split payments: `splitRules`
|
|
277
|
+
- customer and sender metadata: `ip`, `senderFirstName`, `senderLastName`, `senderAddress`, and related fields
|
|
278
|
+
|
|
279
|
+
## Schemas and Types
|
|
280
|
+
|
|
281
|
+
All public schemas and types are exported from the package root, so you can import them directly from `liqpay-nestjs`.
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
import {
|
|
285
|
+
CheckoutCallback,
|
|
286
|
+
CheckoutCallbackSchema,
|
|
287
|
+
CheckoutRequest,
|
|
288
|
+
CheckoutRequestSchema,
|
|
289
|
+
PaymentStatusResponse,
|
|
290
|
+
PaymentStatusResponseSchema,
|
|
291
|
+
Result,
|
|
292
|
+
} from 'liqpay-nestjs'
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Main export groups:
|
|
296
|
+
|
|
297
|
+
- base: `LiqPayEnvelope`, `LiqPayEnvelopeSchema`, `Result<T>`, request and response base unions
|
|
298
|
+
- checkout: `CheckoutRequest`, `CheckoutRequestSchema`, `CheckoutCallback`, `CheckoutCallbackSchema`
|
|
299
|
+
- payment status: `PaymentStatusRequest`, `PaymentStatusRequestSchema`, `PaymentStatusResponse`, `PaymentStatusResponseSchema`
|
|
300
|
+
- common: `DetailAddenda`, `FiscalData`, `SplitRule` and their schemas
|
|
301
|
+
- enums: action, currency, language, paytype, payment status, version, and related schema exports
|
|
302
|
+
- error: LiqPay error response and error code schemas and types
|
|
303
|
+
- nest: `LiqPayModule`, `LiqpayService`, `LiqPayOptions`, `LiqPayAsyncOptions`, `LIQPAY_OPTIONS`
|
|
304
|
+
|
|
305
|
+
### Validating your own DTOs with the exported schemas
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
import { CheckoutRequestSchema, LiqpayService } from 'liqpay-nestjs'
|
|
309
|
+
|
|
310
|
+
const payload = CheckoutRequestSchema.parse(input)
|
|
311
|
+
const checkout = liqpay.payments.create(payload)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
This is useful if you want to validate incoming controller data before passing it to the service.
|
|
315
|
+
|
|
316
|
+
## Result Contract and Error Handling
|
|
317
|
+
|
|
318
|
+
Methods that parse LiqPay responses use this result shape:
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
type Result<T> =
|
|
322
|
+
| { data: T; error?: null }
|
|
323
|
+
| { data: null; error: { code: string; description: string } }
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
The library can return:
|
|
327
|
+
|
|
328
|
+
- LiqPay provider errors parsed from `err_code` and `err_description`
|
|
329
|
+
- internal parsing or transport errors such as `invalid_signature`, `decode_error`, `validation_error`, `invalid_response`, and `http_error`
|
|
330
|
+
|
|
331
|
+
Always check `result.error` before using `result.data`.
|
|
332
|
+
|
|
333
|
+
## Advanced Nest Exports
|
|
334
|
+
|
|
335
|
+
The package root also exports:
|
|
336
|
+
|
|
337
|
+
- `LIQPAY_OPTIONS`
|
|
338
|
+
- `createLiqpayOptionsProvider(...)`
|
|
339
|
+
- `createLiqpayAsyncOptionsProvider(...)`
|
|
340
|
+
|
|
341
|
+
These helpers are useful if you want to compose your own providers around the package token instead of using `LiqPayModule` directly.
|
|
342
|
+
|
|
343
|
+
## Build
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
npm run build
|
|
347
|
+
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Action, Currency, MpiEci, PaymentStatus, Paytype } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Contract of decoded format of API parameters received in a request from LiqPay after payment
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface CheckoutCallback {
|
|
6
6
|
/**
|
|
7
7
|
* Acquirer ID
|
|
8
8
|
*/
|
|
@@ -14,7 +14,7 @@ export interface LiqPayCheckoutCallback {
|
|
|
14
14
|
* - `subscribe` - creation of a regular payment
|
|
15
15
|
* - `regular` - regular payment
|
|
16
16
|
*/
|
|
17
|
-
action:
|
|
17
|
+
action: Action;
|
|
18
18
|
/**
|
|
19
19
|
* Agent commission in payment currency
|
|
20
20
|
*/
|
|
@@ -66,15 +66,15 @@ export interface LiqPayCheckoutCallback {
|
|
|
66
66
|
/**
|
|
67
67
|
* Payment currency
|
|
68
68
|
*/
|
|
69
|
-
currency:
|
|
69
|
+
currency: Currency;
|
|
70
70
|
/**
|
|
71
71
|
* Transaction currency credit
|
|
72
72
|
*/
|
|
73
|
-
currency_credit:
|
|
73
|
+
currency_credit: Currency;
|
|
74
74
|
/**
|
|
75
75
|
* Transaction currency debit
|
|
76
76
|
*/
|
|
77
|
-
currency_debit:
|
|
77
|
+
currency_debit: Currency;
|
|
78
78
|
/**
|
|
79
79
|
* A unique user identifier on the merchant's website. Maximum length __100__ characters.
|
|
80
80
|
*/
|
|
@@ -110,14 +110,14 @@ export interface LiqPayCheckoutCallback {
|
|
|
110
110
|
/**
|
|
111
111
|
* `Order_id` of payment in the LiqPay system
|
|
112
112
|
*/
|
|
113
|
-
|
|
113
|
+
_order_id: string;
|
|
114
114
|
/**
|
|
115
115
|
* Code that represents whether 3D-Secure verification was performed during payment. Possible values:
|
|
116
116
|
* - `5` - the transaction was completed with 3DS (the issuer and acquirer support 3D-Secure technology)
|
|
117
117
|
* - `6` - the payer's card issuer does not support 3D-Secure technology
|
|
118
118
|
* - `7` - the transaction was completed without 3D-Secure
|
|
119
119
|
*/
|
|
120
|
-
mpi_eci:
|
|
120
|
+
mpi_eci: MpiEci;
|
|
121
121
|
/**
|
|
122
122
|
* Payment `Order_id`
|
|
123
123
|
*/
|
|
@@ -134,7 +134,7 @@ export interface LiqPayCheckoutCallback {
|
|
|
134
134
|
* - invoice - invoice to e-mail
|
|
135
135
|
* - qr - scan qr code
|
|
136
136
|
*/
|
|
137
|
-
paytype:
|
|
137
|
+
paytype: Paytype;
|
|
138
138
|
/**
|
|
139
139
|
* Store public key
|
|
140
140
|
*/
|
|
@@ -202,7 +202,7 @@ export interface LiqPayCheckoutCallback {
|
|
|
202
202
|
/**
|
|
203
203
|
* Payment status
|
|
204
204
|
*/
|
|
205
|
-
status:
|
|
205
|
+
status: PaymentStatus;
|
|
206
206
|
/**
|
|
207
207
|
* An additional payment status indicating that the current payment is reserved for a refund on your store. Possible values: `true` - the payment is reserved for a refund
|
|
208
208
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { DetailAddenda } from './detail-addenda';
|
|
2
|
+
import { FiscalData } from './fiscal-data';
|
|
3
|
+
import { SplitRule } from './split-rule';
|
|
4
|
+
import { Action, Currency, Language, Paytype, SubscribePeriodicity } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Contract of data that is passed when forming a payment request as `base64` encoded string data when calling the LiqPay API
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface CheckoutRequest {
|
|
9
9
|
/**
|
|
10
10
|
* @group shared
|
|
11
11
|
*/
|
|
@@ -29,7 +29,7 @@ export interface LiqPayCheckoutRequest {
|
|
|
29
29
|
* - `subscribe` - regular payment
|
|
30
30
|
* - `paydonate` - donation
|
|
31
31
|
*/
|
|
32
|
-
action:
|
|
32
|
+
action: Action;
|
|
33
33
|
/**
|
|
34
34
|
* Payment amount. For example: `5`, `7.34`
|
|
35
35
|
*/
|
|
@@ -37,7 +37,7 @@ export interface LiqPayCheckoutRequest {
|
|
|
37
37
|
/**
|
|
38
38
|
* Payment currency. Possible values: `USD`, `EUR`, `UAH`
|
|
39
39
|
*/
|
|
40
|
-
currency:
|
|
40
|
+
currency: Currency;
|
|
41
41
|
/**
|
|
42
42
|
* Payment purpose
|
|
43
43
|
*/
|
|
@@ -59,7 +59,7 @@ export interface LiqPayCheckoutRequest {
|
|
|
59
59
|
/**
|
|
60
60
|
* Client language: `uk`, `en`
|
|
61
61
|
*/
|
|
62
|
-
language?:
|
|
62
|
+
language?: Language;
|
|
63
63
|
/**
|
|
64
64
|
* Parameter that transmits payment methods to be displayed at checkout.
|
|
65
65
|
* If the parameter is not provided, the store settings are applied. Possible values:
|
|
@@ -73,7 +73,7 @@ export interface LiqPayCheckoutRequest {
|
|
|
73
73
|
* - `invoice` - invoice to e-mail
|
|
74
74
|
* - `qr` - scanning a QR code
|
|
75
75
|
*/
|
|
76
|
-
paytypes?:
|
|
76
|
+
paytypes?: Paytype[];
|
|
77
77
|
/**
|
|
78
78
|
* @group checkout flow
|
|
79
79
|
*/
|
|
@@ -91,7 +91,7 @@ export interface LiqPayCheckoutRequest {
|
|
|
91
91
|
/**
|
|
92
92
|
* Data for fiscalization
|
|
93
93
|
*/
|
|
94
|
-
rro_info?:
|
|
94
|
+
rro_info?: FiscalData;
|
|
95
95
|
/**
|
|
96
96
|
* @group sender
|
|
97
97
|
*/
|
|
@@ -137,7 +137,7 @@ export interface LiqPayCheckoutRequest {
|
|
|
137
137
|
* - `month` - once a month
|
|
138
138
|
* - `year` - once a year, раз
|
|
139
139
|
*/
|
|
140
|
-
subscribe_periodicity?:
|
|
140
|
+
subscribe_periodicity?: SubscribePeriodicity;
|
|
141
141
|
/**
|
|
142
142
|
* Payment with splitting the amount into several recipients. This parameter specifies a `JSON` array with payment splitting rules.
|
|
143
143
|
* One debit is made from the client and several credits are made to the recipients. If you need to transfer your purpose for each amount, use the `description` parameter.
|
|
@@ -174,7 +174,7 @@ export interface LiqPayCheckoutRequest {
|
|
|
174
174
|
* ]
|
|
175
175
|
* ```
|
|
176
176
|
*/
|
|
177
|
-
split_rules?:
|
|
177
|
+
split_rules?: SplitRule[];
|
|
178
178
|
/**
|
|
179
179
|
* @group one-click payment / tokenization
|
|
180
180
|
*/
|
|
@@ -232,5 +232,5 @@ export interface LiqPayCheckoutRequest {
|
|
|
232
232
|
* The `dae` parameter is a `JSON` string to which `base64` has been applied.
|
|
233
233
|
* It can contain the parameters given in the example below.
|
|
234
234
|
*/
|
|
235
|
-
dae?:
|
|
235
|
+
dae?: DetailAddenda;
|
|
236
236
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FiscalTax, Unit } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Fiscalization data provided by ID contract
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface FiscalData {
|
|
6
6
|
/**
|
|
7
7
|
* Data about the goods for which payment is made
|
|
8
8
|
*/
|
|
9
|
-
items?:
|
|
9
|
+
items?: FiscalProductById[] | FiscalProductByApi[];
|
|
10
10
|
/**
|
|
11
11
|
* List of e-mails to which receipts should be sent after fiscalization
|
|
12
12
|
*/
|
|
@@ -15,7 +15,7 @@ export interface LiqPayFiscalData {
|
|
|
15
15
|
/**
|
|
16
16
|
* Contract of data about the product for which payment is being made provided by ID
|
|
17
17
|
*/
|
|
18
|
-
export interface
|
|
18
|
+
export interface FiscalProductById {
|
|
19
19
|
/**
|
|
20
20
|
* Quantity/volume
|
|
21
21
|
*/
|
|
@@ -36,7 +36,7 @@ export interface LiqPayFiscalProductById {
|
|
|
36
36
|
/**
|
|
37
37
|
* Contract of data about the product for which payment is being made provided by API
|
|
38
38
|
*/
|
|
39
|
-
export interface
|
|
39
|
+
export interface FiscalProductByApi {
|
|
40
40
|
/**
|
|
41
41
|
* Quantity/volume
|
|
42
42
|
*/
|
|
@@ -60,7 +60,7 @@ export interface LiqPayFiscalProductByApi {
|
|
|
60
60
|
/**
|
|
61
61
|
* Unit of measure code
|
|
62
62
|
*/
|
|
63
|
-
unitcode:
|
|
63
|
+
unitcode: Unit;
|
|
64
64
|
/**
|
|
65
65
|
* Digital value of the product barcode
|
|
66
66
|
*/
|
|
@@ -76,5 +76,5 @@ export interface LiqPayFiscalProductByApi {
|
|
|
76
76
|
/**
|
|
77
77
|
* Tax rate for the product
|
|
78
78
|
*/
|
|
79
|
-
taxs?:
|
|
79
|
+
taxs?: FiscalTax[];
|
|
80
80
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contract of data that is passed when forming a request to receive payment status as data in `base64` encoded string form when calling the LiqPay API
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface PaymentStatusRequest {
|
|
5
5
|
/**
|
|
6
6
|
* API version. Current version: `7`
|
|
7
7
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Action, BonusType, Currency, Language, MpiEci, PaymentStatus, Paytype, RequestResult } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Contract of data that comes in response to a request to get payment status
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface PaymentStatusResponse {
|
|
6
6
|
/**
|
|
7
7
|
* Acquirer ID
|
|
8
8
|
*/
|
|
@@ -17,7 +17,7 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
17
17
|
* - `auth` - card pre-authorization
|
|
18
18
|
* - `regular` - regular payment
|
|
19
19
|
*/
|
|
20
|
-
action:
|
|
20
|
+
action: Action;
|
|
21
21
|
/**
|
|
22
22
|
* Agent commission in payment currency
|
|
23
23
|
*/
|
|
@@ -53,7 +53,7 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
53
53
|
/**
|
|
54
54
|
* Bonus type, possible values: `bonusplus`, `discount_club`, `personal`, `promo`
|
|
55
55
|
*/
|
|
56
|
-
bonus_type:
|
|
56
|
+
bonus_type: BonusType;
|
|
57
57
|
/**
|
|
58
58
|
* Sender card token
|
|
59
59
|
*/
|
|
@@ -77,15 +77,15 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
77
77
|
/**
|
|
78
78
|
* Payment currency
|
|
79
79
|
*/
|
|
80
|
-
currency:
|
|
80
|
+
currency: Currency;
|
|
81
81
|
/**
|
|
82
82
|
* Transaction currency credit
|
|
83
83
|
*/
|
|
84
|
-
currency_credit:
|
|
84
|
+
currency_credit: Currency;
|
|
85
85
|
/**
|
|
86
86
|
* Transaction currency debit
|
|
87
87
|
*/
|
|
88
|
-
currency_debit:
|
|
88
|
+
currency_debit: Currency;
|
|
89
89
|
/**
|
|
90
90
|
* Payment comment
|
|
91
91
|
*/
|
|
@@ -109,11 +109,11 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
109
109
|
/**
|
|
110
110
|
* Client language: `uk`, `en`
|
|
111
111
|
*/
|
|
112
|
-
language:
|
|
112
|
+
language: Language;
|
|
113
113
|
/**
|
|
114
114
|
* `Order_id` of payment in the LiqPay system
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
_order_id: string;
|
|
117
117
|
/**
|
|
118
118
|
* Payment in installments sign
|
|
119
119
|
*/
|
|
@@ -124,7 +124,7 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
124
124
|
* - `6` - the payer's card issuer does not support 3D-Secure technology
|
|
125
125
|
* - `7` - the transaction was completed without 3D-Secure
|
|
126
126
|
*/
|
|
127
|
-
mpi_eci:
|
|
127
|
+
mpi_eci: MpiEci;
|
|
128
128
|
/**
|
|
129
129
|
* Payment `Order_id`
|
|
130
130
|
*/
|
|
@@ -141,7 +141,7 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
141
141
|
* - `invoice` - invoice to e-mail
|
|
142
142
|
* - `qr` - scan qr code
|
|
143
143
|
*/
|
|
144
|
-
paytype:
|
|
144
|
+
paytype: Paytype;
|
|
145
145
|
/**
|
|
146
146
|
* Store public key
|
|
147
147
|
*/
|
|
@@ -153,7 +153,7 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
153
153
|
/**
|
|
154
154
|
* Result of query execution: `ok`, `error`
|
|
155
155
|
*/
|
|
156
|
-
result:
|
|
156
|
+
result: RequestResult;
|
|
157
157
|
/**
|
|
158
158
|
* Unique transaction number in the authorization and settlement system of the servicing bank `Retrieval Reference number`
|
|
159
159
|
*/
|
|
@@ -205,7 +205,7 @@ export interface LiqPayPaymentStatusResponse {
|
|
|
205
205
|
/**
|
|
206
206
|
* Payment status
|
|
207
207
|
*/
|
|
208
|
-
status:
|
|
208
|
+
status: PaymentStatus;
|
|
209
209
|
/**
|
|
210
210
|
* An additional payment status indicating that the current payment is reserved for a refund on your store. Possible values: `true` - the payment is reserved for a refund
|
|
211
211
|
*/
|