@vexpay/node 0.17.0 → 0.19.0
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 +11 -25
- package/dist/index.cjs +6 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -145
- package/dist/index.d.ts +112 -145
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ const vexpay = new VexPay(process.env.VEXPAY_API_KEY!);
|
|
|
39
39
|
const intent = await vexpay.payments.c2p.request({
|
|
40
40
|
usdAmount: 25,
|
|
41
41
|
debtorId: 'V12345678',
|
|
42
|
-
debtorCellPhone: '
|
|
42
|
+
debtorCellPhone: '584141873562',
|
|
43
43
|
debtorBankCode: 102,
|
|
44
44
|
externalRef: 'order-1042',
|
|
45
45
|
});
|
|
@@ -51,7 +51,7 @@ const payment = await vexpay.payments.c2p.execute({
|
|
|
51
51
|
intentId: intent.intentId,
|
|
52
52
|
usdAmount: 25,
|
|
53
53
|
debtorId: 'V12345678',
|
|
54
|
-
debtorCellPhone: '
|
|
54
|
+
debtorCellPhone: '584141873562',
|
|
55
55
|
debtorBankCode: 102,
|
|
56
56
|
token,
|
|
57
57
|
});
|
|
@@ -180,27 +180,15 @@ await vexpay.conversions.settings.update({ autoConvert: { COP: { percent: 50 } }
|
|
|
180
180
|
|
|
181
181
|
## Colombian pesos (COP)
|
|
182
182
|
|
|
183
|
-
Collect pesos from buyers in Colombia through
|
|
183
|
+
Collect pesos from buyers in Colombia through Bre-B, Nequi or Daviplata. Amounts are whole pesos, payments complete asynchronously (`payment.completed` / `payment.failed`), and completed payments go to your COP balance net of the COP fee. COP must be enabled on your account — otherwise the calls fail with `method_not_allowed` (403).
|
|
184
184
|
|
|
185
185
|
```ts
|
|
186
186
|
import VexPay from '@vexpay/node';
|
|
187
187
|
|
|
188
188
|
const vexpay = new VexPay(process.env.VEXPAY_API_KEY!);
|
|
189
189
|
|
|
190
|
-
// What your account can use now,
|
|
191
|
-
const { channels
|
|
192
|
-
|
|
193
|
-
// PSE: send the buyer to their bank (next.url). On redirect_pending, retrieve again in a few seconds.
|
|
194
|
-
const pse = await vexpay.cop.payments.create({
|
|
195
|
-
amountCop: 80000,
|
|
196
|
-
channel: 'pse',
|
|
197
|
-
pse: { bankCode: pseBanks![0]!.code },
|
|
198
|
-
buyer: {
|
|
199
|
-
firstName: 'Juan', lastName: 'Pérez', personType: 'natural', email: 'juan@example.com', phone: '3001234567',
|
|
200
|
-
documentType: 'CC', documentNumber: '1234567890', termsAccepted: true, // the buyer accepted `terms`
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
if (pse.next?.type === 'redirect') console.log('Send the buyer to', pse.next.url);
|
|
190
|
+
// What your account can use now (Bre-B, Nequi, Daviplata) and what each needs.
|
|
191
|
+
const { channels } = await vexpay.cop.channels();
|
|
204
192
|
|
|
205
193
|
// Bre-B: no buyer data. Show next.qrPngBase64 as an image and next.transferKey as text.
|
|
206
194
|
const breb = await vexpay.cop.payments.create(
|
|
@@ -212,10 +200,10 @@ const breb = await vexpay.cop.payments.create(
|
|
|
212
200
|
await vexpay.cop.payments.create({
|
|
213
201
|
amountCop: 50000,
|
|
214
202
|
channel: 'nequi',
|
|
215
|
-
buyer: { email: 'juan@example.com', phone: '3001234567', documentType: 'CC', documentNumber: '1234567890'
|
|
203
|
+
buyer: { email: 'juan@example.com', phone: '3001234567', documentType: 'CC', documentNumber: '1234567890' },
|
|
216
204
|
});
|
|
217
205
|
|
|
218
|
-
// Daviplata: with next.type 'submit_otp' the buyer reads you the SMS code; submit it
|
|
206
|
+
// Daviplata: with next.type 'submit_otp' the buyer reads you the SMS code; submit it.
|
|
219
207
|
const davi = await vexpay.cop.payments.create({
|
|
220
208
|
amountCop: 50000,
|
|
221
209
|
channel: 'daviplata',
|
|
@@ -227,7 +215,7 @@ const status = (await vexpay.cop.payments.retrieve(breb.id)).status; // pending
|
|
|
227
215
|
const { availableCop } = await vexpay.cop.balance.retrieve();
|
|
228
216
|
```
|
|
229
217
|
|
|
230
|
-
`cancel(id)` cancels a pending payment and `refund(id)` refunds a completed one in full
|
|
218
|
+
`cancel(id)` cancels a pending payment and `refund(id)` refunds a completed one in full within 96 hours (a payment that can no longer be refunded through the API fails with `refund_not_supported`). A webhook for a COP payment has `data.method === 'COP'`; read it as `CopPaymentWebhookData`.
|
|
231
219
|
|
|
232
220
|
**Test mode** (test API keys use a sandbox):
|
|
233
221
|
|
|
@@ -235,9 +223,7 @@ const { availableCop } = await vexpay.cop.balance.retrieve();
|
|
|
235
223
|
|---|---|---|
|
|
236
224
|
| Bre-B | No buyer data | QR and key from the sandbox. **Never send real money to them** — sandbox keys are reachable from real banks and the money is not credited. |
|
|
237
225
|
| Nequi | Phone `3991111111`, any valid document and email | Completes on its own within about a minute; `3992222222` is declined |
|
|
238
|
-
| Daviplata | Same buyer data (`CC`, `CE` or `TI` only) | With `submit_otp`, OTP `123456`, `000000` or `111111` completes it; any other code fails with `invalid_otp
|
|
239
|
-
| PSE | Any valid buyer data | Bank code `1` approves, `2` declines |
|
|
240
|
-
| Card (hosted checkout) | `4242 4242 4242 4242`, any future expiry and CVC | Approved; `4111 1111 1111 1111` is declined |
|
|
226
|
+
| Daviplata | Same buyer data (`CC`, `CE` or `TI` only) | With `submit_otp`, OTP `123456`, `000000` or `111111` completes it; any other code fails with `invalid_otp` |
|
|
241
227
|
|
|
242
228
|
## Subscriptions
|
|
243
229
|
|
|
@@ -346,7 +332,7 @@ const vexpay = new VexPay(process.env.VEXPAY_API_KEY!);
|
|
|
346
332
|
|
|
347
333
|
const topup = await vexpay.balance.topups.create({
|
|
348
334
|
amountVes: '100000.00',
|
|
349
|
-
payerPhone: '
|
|
335
|
+
payerPhone: '04121873562',
|
|
350
336
|
payerCedula: 'V12345678',
|
|
351
337
|
sourceNote: 'Ingresos publicidad quincena 2',
|
|
352
338
|
});
|
|
@@ -415,7 +401,7 @@ await vexpay.payments.c2p.execute(
|
|
|
415
401
|
intentId: '00000000-0000-4000-8000-000000000001',
|
|
416
402
|
usdAmount: 25,
|
|
417
403
|
debtorId: 'V12345678',
|
|
418
|
-
debtorCellPhone: '
|
|
404
|
+
debtorCellPhone: '584141873562',
|
|
419
405
|
debtorBankCode: 102,
|
|
420
406
|
token: '123456',
|
|
421
407
|
},
|
package/dist/index.cjs
CHANGED
|
@@ -107,7 +107,7 @@ function errorFromResponse(status, body, requestId) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// src/version.ts
|
|
110
|
-
var VERSION = "0.
|
|
110
|
+
var VERSION = "0.19.0";
|
|
111
111
|
|
|
112
112
|
// src/core.ts
|
|
113
113
|
var INITIAL_RETRY_DELAY_MS = 500;
|
|
@@ -766,10 +766,8 @@ var Conversions = class extends APIResource {
|
|
|
766
766
|
// src/resources/cop.ts
|
|
767
767
|
var CopPayments = class extends APIResource {
|
|
768
768
|
/**
|
|
769
|
-
* Create a payment in whole pesos. `buyer` is required for every channel except `breb
|
|
770
|
-
*
|
|
771
|
-
* `pse.bankCode`. The response `next` says what the buyer does: `show_qr`, `approve_in_app`,
|
|
772
|
-
* `submit_otp`, `redirect` (send them to `next.url`) or `redirect_pending` (retrieve again shortly).
|
|
769
|
+
* Create a payment in whole pesos. `buyer` is required for every channel except `breb`. The
|
|
770
|
+
* response `next` says what the buyer does: `show_qr`, `approve_in_app` or `submit_otp`.
|
|
773
771
|
* Pass `idempotencyKey` in options to retry safely.
|
|
774
772
|
*/
|
|
775
773
|
create(params, options) {
|
|
@@ -787,8 +785,8 @@ var CopPayments = class extends APIResource {
|
|
|
787
785
|
return this.call("CopPayments_cancel", { path: { id } }, options);
|
|
788
786
|
}
|
|
789
787
|
/**
|
|
790
|
-
* Full refund of a completed payment, within
|
|
791
|
-
*
|
|
788
|
+
* Full refund of a completed payment, within 96 hours of completion. A payment that can no
|
|
789
|
+
* longer be refunded through the API fails with `refund_not_supported`.
|
|
792
790
|
*/
|
|
793
791
|
refund(id, options) {
|
|
794
792
|
return this.call("CopPayments_refund", { path: { id } }, options);
|
|
@@ -802,7 +800,7 @@ var CopBalance = class extends APIResource {
|
|
|
802
800
|
var Cop = class extends APIResource {
|
|
803
801
|
payments = new CopPayments(this.http);
|
|
804
802
|
balance = new CopBalance(this.http);
|
|
805
|
-
/** Channels you can use right now, with what each needs
|
|
803
|
+
/** Channels you can use right now, with what each needs. */
|
|
806
804
|
channels(options) {
|
|
807
805
|
return this.call("CopPayments_channels", {}, options);
|
|
808
806
|
}
|