@proveanything/smartlinks 2.2.10 → 2.2.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/dist/api/payments.d.ts +7 -1
- package/dist/api/payments.js +9 -0
- package/dist/docs/API_SUMMARY.md +42 -1
- package/dist/docs/bookings.md +541 -539
- package/dist/docs/payments.md +33 -2
- package/dist/openapi.yaml +72 -0
- package/dist/types/bookings.d.ts +4 -1
- package/dist/types/payments.d.ts +43 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +42 -1
- package/docs/bookings.md +541 -539
- package/docs/payments.md +33 -2
- package/openapi.yaml +72 -0
- package/package.json +1 -1
package/docs/payments.md
CHANGED
|
@@ -90,5 +90,36 @@ let page = await payments.admin.intents(collectionId, { appId: 'tap-to-donate',
|
|
|
90
90
|
while (page.hasMore) page = await payments.admin.intents(collectionId, { appId: 'tap-to-donate', after: page.next! })
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
### Payment records: what Stripe says happened
|
|
94
|
+
|
|
95
|
+
SmartLinks keeps every in-page payment's true state for you, from Stripe's own events, never from the
|
|
96
|
+
payer's browser: one **app record of type `payment`** per payment, in your app (visibility admin,
|
|
97
|
+
`customId` = the Stripe payment id). Its `status` follows the money:
|
|
98
|
+
|
|
99
|
+
| status | meaning |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `paid` | taken |
|
|
102
|
+
| `partially_refunded` / `refunded` | refunded in part / in full (from Stripe's dashboard or anywhere else) |
|
|
103
|
+
| `disputed` / `dispute_lost` | the payer's bank is disputing it / the dispute was lost (a won dispute goes back to `paid`) |
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { app, type AppPaymentRecordData } from '@proveanything/smartlinks'
|
|
107
|
+
|
|
108
|
+
const page = await app.records.list(collectionId, 'tap-to-donate', { recordType: 'payment' }, true)
|
|
109
|
+
for (const r of page.data) {
|
|
110
|
+
const p = r.data as AppPaymentRecordData // amounts in pence: p.amount, p.amountRefunded, p.fee
|
|
111
|
+
console.log(r.status, p.paymentIntentId, p.amount - p.amountRefunded, p.metadata.campaignId)
|
|
112
|
+
}
|
|
113
|
+
// one payment: { recordType: 'payment', customId: paymentIntentId }
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Keep `paymentIntentId` (from `createIntent`) on your own record (a donation, a ticket) and read its status
|
|
117
|
+
from the payment record. A payment with no record of yours (the page closed before you saved it) still has
|
|
118
|
+
its payment record: show it, so nothing is missed. Totals should use `amount - amountRefunded`.
|
|
119
|
+
|
|
120
|
+
Payments made before payment records existed, or whose events never arrived, are brought in with:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
let r = await payments.admin.sync(collectionId, { appId: 'tap-to-donate' }) // → { checked, saved, hasMore, next }
|
|
124
|
+
while (r.hasMore) r = await payments.admin.sync(collectionId, { appId: 'tap-to-donate', after: r.next! })
|
|
125
|
+
```
|
package/openapi.yaml
CHANGED
|
@@ -36649,6 +36649,70 @@ components:
|
|
|
36649
36649
|
- data
|
|
36650
36650
|
- hasMore
|
|
36651
36651
|
- next
|
|
36652
|
+
PaymentSyncInput:
|
|
36653
|
+
type: object
|
|
36654
|
+
properties:
|
|
36655
|
+
appId:
|
|
36656
|
+
type: string
|
|
36657
|
+
since:
|
|
36658
|
+
type: string
|
|
36659
|
+
after:
|
|
36660
|
+
type: string
|
|
36661
|
+
PaymentSyncResult:
|
|
36662
|
+
type: object
|
|
36663
|
+
properties:
|
|
36664
|
+
checked:
|
|
36665
|
+
type: number
|
|
36666
|
+
saved:
|
|
36667
|
+
type: number
|
|
36668
|
+
hasMore:
|
|
36669
|
+
type: boolean
|
|
36670
|
+
next:
|
|
36671
|
+
type: string
|
|
36672
|
+
required:
|
|
36673
|
+
- checked
|
|
36674
|
+
- saved
|
|
36675
|
+
- hasMore
|
|
36676
|
+
- next
|
|
36677
|
+
AppPaymentRecordData:
|
|
36678
|
+
type: object
|
|
36679
|
+
properties:
|
|
36680
|
+
paymentIntentId:
|
|
36681
|
+
type: string
|
|
36682
|
+
amount:
|
|
36683
|
+
type: number
|
|
36684
|
+
currency:
|
|
36685
|
+
type: string
|
|
36686
|
+
amountRefunded:
|
|
36687
|
+
type: number
|
|
36688
|
+
fee:
|
|
36689
|
+
type: number
|
|
36690
|
+
email:
|
|
36691
|
+
type: string
|
|
36692
|
+
reference:
|
|
36693
|
+
type: string
|
|
36694
|
+
metadata:
|
|
36695
|
+
type: object
|
|
36696
|
+
additionalProperties:
|
|
36697
|
+
type: string
|
|
36698
|
+
paidAt:
|
|
36699
|
+
type: string
|
|
36700
|
+
refundedAt:
|
|
36701
|
+
type: string
|
|
36702
|
+
dispute:
|
|
36703
|
+
type: object
|
|
36704
|
+
additionalProperties: true
|
|
36705
|
+
required:
|
|
36706
|
+
- paymentIntentId
|
|
36707
|
+
- amount
|
|
36708
|
+
- currency
|
|
36709
|
+
- amountRefunded
|
|
36710
|
+
- fee
|
|
36711
|
+
- email
|
|
36712
|
+
- reference
|
|
36713
|
+
- metadata
|
|
36714
|
+
- paidAt
|
|
36715
|
+
- refundedAt
|
|
36652
36716
|
PaymentDomainResult:
|
|
36653
36717
|
type: object
|
|
36654
36718
|
properties:
|
|
@@ -36662,6 +36726,14 @@ components:
|
|
|
36662
36726
|
- domain
|
|
36663
36727
|
- applePay
|
|
36664
36728
|
- googlePay
|
|
36729
|
+
AppPaymentStatus:
|
|
36730
|
+
type: string
|
|
36731
|
+
enum:
|
|
36732
|
+
- paid
|
|
36733
|
+
- partially_refunded
|
|
36734
|
+
- refunded
|
|
36735
|
+
- disputed
|
|
36736
|
+
- dispute_lost
|
|
36665
36737
|
ProductKey:
|
|
36666
36738
|
type: object
|
|
36667
36739
|
properties:
|