@adonis-agora/payments 0.19.0 → 0.19.1
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 +6 -0
- package/README.md +67 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @adonis-agora/payments
|
|
2
2
|
|
|
3
|
+
## 0.19.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#146](https://github.com/DavideCarvalho/adonis-agora-payments/pull/146) [`c071147`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/c071147d5e455ad3514055db5fb1c19c4279f79a) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Ship a README. The package listed `README.md` in `files` but had none, so its npm page was empty.
|
|
8
|
+
|
|
3
9
|
## 0.19.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# `@adonis-agora/payments`
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@adonis-agora/payments) [](https://www.npmjs.com/package/@adonis-agora/payments) [](https://github.com/DavideCarvalho/adonis-agora-payments/actions/workflows/ci.yml) [](https://www.npmjs.com/package/@adonis-agora/payments)
|
|
4
|
+
|
|
5
|
+
> Payments and billing for **AdonisJS** — 18 gateways behind one driver contract, a
|
|
6
|
+
> Cashier-style subscription layer, idempotent webhook processing and invoice emission. Part of
|
|
7
|
+
> the [Agora](https://davidecarvalho.github.io/agora/) ecosystem.
|
|
8
|
+
|
|
9
|
+
**Gateways:** Asaas, AbacatePay, Woovi, Pagar.me, PagBank, Efí, InfinitePay, Mercado Pago ·
|
|
10
|
+
Stripe, Adyen, PayPal, Mollie, Razorpay, Square · Paddle, Lemon Squeezy, Polar, Dodo Payments.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
node ace add @adonis-agora/payments
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Use
|
|
19
|
+
|
|
20
|
+
Configure gateways in `config/payments.ts` and route each payment method to one:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import env from '#start/env'
|
|
24
|
+
import { defineConfig, payments } from '@adonis-agora/payments'
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
default: 'asaas',
|
|
28
|
+
providers: {
|
|
29
|
+
asaas: payments.asaas({
|
|
30
|
+
apiKey: env.get('PAYMENTS_ASAAS_KEY'),
|
|
31
|
+
webhookToken: env.get('PAYMENTS_ASAAS_WEBHOOK_TOKEN'),
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
methods: { pix: 'asaas', credit_card: 'asaas' },
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then charge through the routed driver:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { getPayments } from '@adonis-agora/payments/services/main'
|
|
42
|
+
|
|
43
|
+
const payments = getPayments()
|
|
44
|
+
|
|
45
|
+
const customer = await payments.driver('pix').createCustomer({
|
|
46
|
+
name: 'Jane Doe',
|
|
47
|
+
email: 'jane@example.com',
|
|
48
|
+
taxId: '123.456.789-00',
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const payment = await payments.driver('pix').charge({
|
|
52
|
+
customerId: customer.id,
|
|
53
|
+
amount: 1990, // integer cents: R$ 19,90
|
|
54
|
+
externalReference: order.id, // your own row; comes back on every webhook for this charge
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
// payment.pixCode → the copy-paste BR code to show the customer
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
Gateways, webhooks, subscriptions and billing, invoices, testing and production notes:
|
|
63
|
+
**https://davidecarvalho.github.io/agora/docs/payments**
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/payments",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Billing library for AdonisJS — 18 payment gateways behind one driver contract, with a Cashier-style subscription billing layer: Billable mixin, Lucid stores, idempotent webhook processing and an optional Durable-backed dispatcher. Part of the Agora ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|