@peable.to/contracts 0.4.0 → 1.1.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/dist/cjs/common/address.js +81 -0
- package/dist/cjs/common/envelopes.js +101 -0
- package/dist/cjs/common/objects.js +85 -0
- package/dist/cjs/common/params.js +211 -0
- package/dist/cjs/common/primitives.js +39 -0
- package/dist/cjs/contributions.js +22 -0
- package/dist/cjs/index.js +40 -137
- package/dist/cjs/openapi/document.js +297 -0
- package/dist/cjs/openapi/index.js +7 -0
- package/dist/cjs/openapi/webhooks.js +17 -0
- package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
- package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
- package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
- package/dist/cjs/resources/billingEngine/index.js +43 -0
- package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
- package/dist/cjs/resources/billingEngine/invoices.js +509 -0
- package/dist/cjs/resources/billingEngine/params.js +43 -0
- package/dist/cjs/resources/billingEngine/public.js +326 -0
- package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
- package/dist/cjs/resources/catalog/billing.js +755 -0
- package/dist/cjs/resources/catalog/billingSettings.js +131 -0
- package/dist/cjs/resources/catalog/coupons.js +222 -0
- package/dist/cjs/resources/catalog/entitlements.js +257 -0
- package/dist/cjs/resources/catalog/index.js +58 -0
- package/dist/cjs/resources/catalog/meters.js +279 -0
- package/dist/cjs/resources/catalog/prices.js +423 -0
- package/dist/cjs/resources/catalog/products.js +228 -0
- package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
- package/dist/cjs/resources/catalog/shared.js +75 -0
- package/dist/cjs/resources/catalog/testClocks.js +127 -0
- package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
- package/dist/cjs/resources/checkout/contributions.js +172 -0
- package/dist/cjs/resources/checkout/files.js +133 -0
- package/dist/cjs/resources/checkout/index.js +57 -0
- package/dist/cjs/resources/checkout/merchants.js +290 -0
- package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
- package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
- package/dist/cjs/resources/checkout/shared.js +368 -0
- package/dist/cjs/resources/connect/account.js +332 -0
- package/dist/cjs/resources/connect/applicationFees.js +113 -0
- package/dist/cjs/resources/connect/balance.js +212 -0
- package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
- package/dist/cjs/resources/connect/index.js +51 -0
- package/dist/cjs/resources/connect/onboarding.js +82 -0
- package/dist/cjs/resources/connect/payouts.js +196 -0
- package/dist/cjs/resources/connect/reporting.js +235 -0
- package/dist/cjs/resources/connect/requestLogs.js +110 -0
- package/dist/cjs/resources/connect/transfers.js +227 -0
- package/dist/cjs/resources/core/customers.js +194 -0
- package/dist/cjs/resources/core/index.js +23 -0
- package/dist/cjs/resources/core/paymentMethods.js +134 -0
- package/dist/cjs/resources/events/events.js +357 -0
- package/dist/cjs/resources/events/index.js +29 -0
- package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
- package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
- package/dist/cjs/resources/payments/charges.js +157 -0
- package/dist/cjs/resources/payments/disputes.js +204 -0
- package/dist/cjs/resources/payments/index.js +41 -0
- package/dist/cjs/resources/payments/paymentIntents.js +529 -0
- package/dist/cjs/resources/payments/refunds.js +245 -0
- package/dist/cjs/resources/payments/setupIntents.js +158 -0
- package/dist/cjs/resources/payments/social.js +182 -0
- package/dist/cjs/resources/payments/testHelpers.js +39 -0
- package/dist/cjs/resources/tax/assessments.js +217 -0
- package/dist/cjs/resources/tax/businessProfile.js +99 -0
- package/dist/cjs/resources/tax/calculations.js +176 -0
- package/dist/cjs/resources/tax/capabilities.js +42 -0
- package/dist/cjs/resources/tax/codes.js +37 -0
- package/dist/cjs/resources/tax/complianceActions.js +56 -0
- package/dist/cjs/resources/tax/deadlines.js +59 -0
- package/dist/cjs/resources/tax/documents.js +128 -0
- package/dist/cjs/resources/tax/index.js +80 -0
- package/dist/cjs/resources/tax/locationEvidence.js +131 -0
- package/dist/cjs/resources/tax/operatingLocations.js +98 -0
- package/dist/cjs/resources/tax/products.js +67 -0
- package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
- package/dist/cjs/resources/tax/registrations.js +82 -0
- package/dist/cjs/resources/tax/reports.js +92 -0
- package/dist/cjs/resources/tax/reviewItems.js +116 -0
- package/dist/cjs/resources/tax/ruleSet.js +68 -0
- package/dist/cjs/resources/tax/salesDestinations.js +94 -0
- package/dist/cjs/resources/tax/settings.js +104 -0
- package/dist/cjs/resources/tax/shared.js +62 -0
- package/dist/cjs/resources/tax/transactions.js +102 -0
- package/dist/cjs/route.js +22 -0
- package/dist/cjs/routes.js +31 -0
- package/dist/cjs/vocabulary/billingPortal.js +15 -0
- package/dist/cjs/vocabulary/catalog.js +110 -0
- package/dist/cjs/vocabulary/checkout.js +53 -0
- package/dist/cjs/vocabulary/connect.js +95 -0
- package/dist/cjs/vocabulary/dashboard.js +68 -0
- package/dist/cjs/vocabulary/errors.js +175 -0
- package/dist/cjs/vocabulary/events.js +176 -0
- package/dist/cjs/vocabulary/files.js +44 -0
- package/dist/cjs/vocabulary/identity.js +12 -0
- package/dist/cjs/vocabulary/index.js +39 -0
- package/dist/cjs/vocabulary/invoices.js +52 -0
- package/dist/cjs/vocabulary/lists.js +22 -0
- package/dist/cjs/vocabulary/merchants.js +23 -0
- package/dist/cjs/vocabulary/money.js +104 -0
- package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
- package/dist/cjs/vocabulary/payments.js +195 -0
- package/dist/cjs/vocabulary/reporting.js +27 -0
- package/dist/cjs/vocabulary/subscriptions.js +60 -0
- package/dist/cjs/vocabulary/tax.js +237 -0
- package/dist/cjs/vocabulary/version.js +12 -0
- package/dist/esm/common/address.js +76 -0
- package/dist/esm/common/envelopes.js +95 -0
- package/dist/esm/common/objects.js +74 -0
- package/dist/esm/common/params.js +203 -0
- package/dist/esm/common/primitives.js +35 -0
- package/dist/esm/contributions.js +5 -0
- package/dist/esm/index.js +26 -134
- package/dist/esm/openapi/document.js +294 -0
- package/dist/esm/openapi/index.js +2 -0
- package/dist/esm/openapi/webhooks.js +14 -0
- package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
- package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
- package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
- package/dist/esm/resources/billingEngine/index.js +26 -0
- package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
- package/dist/esm/resources/billingEngine/invoices.js +506 -0
- package/dist/esm/resources/billingEngine/params.js +39 -0
- package/dist/esm/resources/billingEngine/public.js +323 -0
- package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
- package/dist/esm/resources/catalog/billing.js +752 -0
- package/dist/esm/resources/catalog/billingSettings.js +128 -0
- package/dist/esm/resources/catalog/coupons.js +219 -0
- package/dist/esm/resources/catalog/entitlements.js +254 -0
- package/dist/esm/resources/catalog/index.js +38 -0
- package/dist/esm/resources/catalog/meters.js +276 -0
- package/dist/esm/resources/catalog/prices.js +419 -0
- package/dist/esm/resources/catalog/products.js +225 -0
- package/dist/esm/resources/catalog/promotionCodes.js +171 -0
- package/dist/esm/resources/catalog/shared.js +67 -0
- package/dist/esm/resources/catalog/testClocks.js +124 -0
- package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
- package/dist/esm/resources/checkout/contributions.js +167 -0
- package/dist/esm/resources/checkout/files.js +130 -0
- package/dist/esm/resources/checkout/index.js +25 -0
- package/dist/esm/resources/checkout/merchants.js +287 -0
- package/dist/esm/resources/checkout/paymentLinks.js +327 -0
- package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
- package/dist/esm/resources/checkout/shared.js +363 -0
- package/dist/esm/resources/connect/account.js +329 -0
- package/dist/esm/resources/connect/applicationFees.js +110 -0
- package/dist/esm/resources/connect/balance.js +209 -0
- package/dist/esm/resources/connect/connectedAccounts.js +257 -0
- package/dist/esm/resources/connect/index.js +34 -0
- package/dist/esm/resources/connect/onboarding.js +79 -0
- package/dist/esm/resources/connect/payouts.js +193 -0
- package/dist/esm/resources/connect/reporting.js +232 -0
- package/dist/esm/resources/connect/requestLogs.js +107 -0
- package/dist/esm/resources/connect/transfers.js +224 -0
- package/dist/esm/resources/core/customers.js +191 -0
- package/dist/esm/resources/core/index.js +6 -0
- package/dist/esm/resources/core/paymentMethods.js +131 -0
- package/dist/esm/resources/events/events.js +353 -0
- package/dist/esm/resources/events/index.js +12 -0
- package/dist/esm/resources/events/webhookDeliveries.js +90 -0
- package/dist/esm/resources/events/webhookEndpoints.js +212 -0
- package/dist/esm/resources/payments/charges.js +154 -0
- package/dist/esm/resources/payments/disputes.js +201 -0
- package/dist/esm/resources/payments/index.js +24 -0
- package/dist/esm/resources/payments/paymentIntents.js +526 -0
- package/dist/esm/resources/payments/refunds.js +242 -0
- package/dist/esm/resources/payments/setupIntents.js +155 -0
- package/dist/esm/resources/payments/social.js +179 -0
- package/dist/esm/resources/payments/testHelpers.js +36 -0
- package/dist/esm/resources/tax/assessments.js +214 -0
- package/dist/esm/resources/tax/businessProfile.js +96 -0
- package/dist/esm/resources/tax/calculations.js +173 -0
- package/dist/esm/resources/tax/capabilities.js +39 -0
- package/dist/esm/resources/tax/codes.js +34 -0
- package/dist/esm/resources/tax/complianceActions.js +53 -0
- package/dist/esm/resources/tax/deadlines.js +56 -0
- package/dist/esm/resources/tax/documents.js +125 -0
- package/dist/esm/resources/tax/index.js +63 -0
- package/dist/esm/resources/tax/locationEvidence.js +128 -0
- package/dist/esm/resources/tax/operatingLocations.js +95 -0
- package/dist/esm/resources/tax/products.js +64 -0
- package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
- package/dist/esm/resources/tax/registrations.js +79 -0
- package/dist/esm/resources/tax/reports.js +89 -0
- package/dist/esm/resources/tax/reviewItems.js +113 -0
- package/dist/esm/resources/tax/ruleSet.js +65 -0
- package/dist/esm/resources/tax/salesDestinations.js +91 -0
- package/dist/esm/resources/tax/settings.js +101 -0
- package/dist/esm/resources/tax/shared.js +58 -0
- package/dist/esm/resources/tax/transactions.js +99 -0
- package/dist/esm/route.js +16 -0
- package/dist/esm/routes.js +27 -0
- package/dist/esm/vocabulary/billingPortal.js +12 -0
- package/dist/esm/vocabulary/catalog.js +106 -0
- package/dist/esm/vocabulary/checkout.js +50 -0
- package/dist/esm/vocabulary/connect.js +92 -0
- package/dist/esm/vocabulary/dashboard.js +64 -0
- package/dist/esm/vocabulary/errors.js +170 -0
- package/dist/esm/vocabulary/events.js +173 -0
- package/dist/esm/vocabulary/files.js +41 -0
- package/dist/esm/vocabulary/identity.js +9 -0
- package/dist/esm/vocabulary/index.js +23 -0
- package/dist/esm/vocabulary/invoices.js +49 -0
- package/dist/esm/vocabulary/lists.js +19 -0
- package/dist/esm/vocabulary/merchants.js +20 -0
- package/dist/esm/vocabulary/money.js +98 -0
- package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
- package/dist/esm/vocabulary/payments.js +192 -0
- package/dist/esm/vocabulary/reporting.js +24 -0
- package/dist/esm/vocabulary/subscriptions.js +57 -0
- package/dist/esm/vocabulary/tax.js +233 -0
- package/dist/esm/vocabulary/version.js +9 -0
- package/dist/types/common/address.d.ts +62 -0
- package/dist/types/common/envelopes.d.ts +88 -0
- package/dist/types/common/objects.d.ts +107 -0
- package/dist/types/common/params.d.ts +156 -0
- package/dist/types/common/primitives.d.ts +56 -0
- package/dist/types/contributions.d.ts +1 -0
- package/dist/types/index.d.ts +16 -171
- package/dist/types/openapi/document.d.ts +16 -0
- package/dist/types/openapi/index.d.ts +2 -0
- package/dist/types/openapi/webhooks.d.ts +15 -0
- package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
- package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
- package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
- package/dist/types/resources/billingEngine/index.d.ts +6071 -0
- package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
- package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
- package/dist/types/resources/billingEngine/params.d.ts +51 -0
- package/dist/types/resources/billingEngine/public.d.ts +1860 -0
- package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
- package/dist/types/resources/catalog/billing.d.ts +1723 -0
- package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
- package/dist/types/resources/catalog/coupons.d.ts +403 -0
- package/dist/types/resources/catalog/entitlements.d.ts +422 -0
- package/dist/types/resources/catalog/index.d.ts +3155 -0
- package/dist/types/resources/catalog/meters.d.ts +474 -0
- package/dist/types/resources/catalog/prices.d.ts +1091 -0
- package/dist/types/resources/catalog/products.d.ts +430 -0
- package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
- package/dist/types/resources/catalog/shared.d.ts +34 -0
- package/dist/types/resources/catalog/testClocks.d.ts +220 -0
- package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
- package/dist/types/resources/checkout/contributions.d.ts +375 -0
- package/dist/types/resources/checkout/files.d.ts +280 -0
- package/dist/types/resources/checkout/index.d.ts +5678 -0
- package/dist/types/resources/checkout/merchants.d.ts +395 -0
- package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
- package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
- package/dist/types/resources/checkout/shared.d.ts +419 -0
- package/dist/types/resources/connect/account.d.ts +483 -0
- package/dist/types/resources/connect/applicationFees.d.ts +198 -0
- package/dist/types/resources/connect/balance.d.ts +399 -0
- package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
- package/dist/types/resources/connect/index.d.ts +2094 -0
- package/dist/types/resources/connect/onboarding.d.ts +95 -0
- package/dist/types/resources/connect/payouts.d.ts +527 -0
- package/dist/types/resources/connect/reporting.d.ts +506 -0
- package/dist/types/resources/connect/requestLogs.d.ts +236 -0
- package/dist/types/resources/connect/transfers.d.ts +436 -0
- package/dist/types/resources/core/customers.d.ts +619 -0
- package/dist/types/resources/core/index.d.ts +679 -0
- package/dist/types/resources/core/paymentMethods.d.ts +336 -0
- package/dist/types/resources/events/events.d.ts +731 -0
- package/dist/types/resources/events/index.d.ts +1727 -0
- package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
- package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
- package/dist/types/resources/payments/charges.d.ts +390 -0
- package/dist/types/resources/payments/disputes.d.ts +822 -0
- package/dist/types/resources/payments/index.d.ts +3517 -0
- package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
- package/dist/types/resources/payments/refunds.d.ts +684 -0
- package/dist/types/resources/payments/setupIntents.d.ts +391 -0
- package/dist/types/resources/payments/social.d.ts +266 -0
- package/dist/types/resources/payments/testHelpers.d.ts +178 -0
- package/dist/types/resources/tax/assessments.d.ts +787 -0
- package/dist/types/resources/tax/businessProfile.d.ts +134 -0
- package/dist/types/resources/tax/calculations.d.ts +261 -0
- package/dist/types/resources/tax/capabilities.d.ts +81 -0
- package/dist/types/resources/tax/codes.d.ts +29 -0
- package/dist/types/resources/tax/complianceActions.d.ts +97 -0
- package/dist/types/resources/tax/deadlines.d.ts +133 -0
- package/dist/types/resources/tax/documents.d.ts +257 -0
- package/dist/types/resources/tax/index.d.ts +1946 -0
- package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
- package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
- package/dist/types/resources/tax/products.d.ts +68 -0
- package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
- package/dist/types/resources/tax/registrations.d.ts +103 -0
- package/dist/types/resources/tax/reports.d.ts +129 -0
- package/dist/types/resources/tax/reviewItems.d.ts +226 -0
- package/dist/types/resources/tax/ruleSet.d.ts +219 -0
- package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
- package/dist/types/resources/tax/settings.d.ts +122 -0
- package/dist/types/resources/tax/shared.d.ts +43 -0
- package/dist/types/resources/tax/transactions.d.ts +404 -0
- package/dist/types/route.d.ts +86 -0
- package/dist/types/routes.d.ts +23 -0
- package/dist/types/vocabulary/billingPortal.d.ts +15 -0
- package/dist/types/vocabulary/catalog.d.ts +97 -0
- package/dist/types/vocabulary/checkout.d.ts +49 -0
- package/dist/types/vocabulary/connect.d.ts +62 -0
- package/dist/types/vocabulary/dashboard.d.ts +44 -0
- package/dist/types/vocabulary/errors.d.ts +146 -0
- package/dist/types/vocabulary/events.d.ts +171 -0
- package/dist/types/vocabulary/files.d.ts +30 -0
- package/dist/types/vocabulary/identity.d.ts +9 -0
- package/dist/types/vocabulary/index.d.ts +19 -0
- package/dist/types/vocabulary/invoices.d.ts +39 -0
- package/dist/types/vocabulary/lists.d.ts +9 -0
- package/dist/types/vocabulary/merchants.d.ts +9 -0
- package/dist/types/vocabulary/money.d.ts +59 -0
- package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
- package/dist/types/vocabulary/payments.d.ts +117 -0
- package/dist/types/vocabulary/reporting.d.ts +18 -0
- package/dist/types/vocabulary/subscriptions.d.ts +45 -0
- package/dist/types/vocabulary/tax.d.ts +163 -0
- package/dist/types/vocabulary/version.d.ts +10 -0
- package/package.json +51 -11
- package/dist/cjs/openapi.js +0 -165
- package/dist/esm/openapi.js +0 -161
- package/dist/types/openapi.d.ts +0 -148
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paymentIntentRoutes = exports.clientSecretQuery = exports.retrievePaymentIntentQuery = exports.clientSecretParam = exports.listPaymentIntentsQuery = exports.submitPaymentIntentTxParams = exports.cancelPaymentIntentParams = exports.capturePaymentIntentParams = exports.confirmPaymentIntentParams = exports.updatePaymentIntentParams = exports.createPaymentIntentParams = exports.connectedAccountParam = exports.railParams = exports.paymentIntentSchema = exports.paymentIntentClientActionSchema = exports.clientActionSchema = exports.paymentIntentTransferDataSchema = exports.paymentIntentFaircoinSchema = exports.paymentIntentNextActionSchema = exports.paymentErrorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const address_1 = require("../../common/address");
|
|
6
|
+
const envelopes_1 = require("../../common/envelopes");
|
|
7
|
+
const objects_1 = require("../../common/objects");
|
|
8
|
+
const params_1 = require("../../common/params");
|
|
9
|
+
const primitives_1 = require("../../common/primitives");
|
|
10
|
+
const route_1 = require("../../route");
|
|
11
|
+
const money_1 = require("../../vocabulary/money");
|
|
12
|
+
const payments_1 = require("../../vocabulary/payments");
|
|
13
|
+
/**
|
|
14
|
+
* PaymentIntents (`pi_…`) — Stripe's PaymentIntent, at the root (ADR 0019):
|
|
15
|
+
* one status vocabulary over two rails, the non-custodial FairCoin lifecycle
|
|
16
|
+
* and a fiat card payment served by a provider behind the gateway (ADR 0001).
|
|
17
|
+
*/
|
|
18
|
+
/** Why the last attempt failed. Peable's words, never the provider's raw prose. */
|
|
19
|
+
exports.paymentErrorSchema = (0, objects_1.defineComponent)('PaymentError', zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
type: zod_1.z
|
|
22
|
+
.enum(payments_1.PAYMENT_ERROR_TYPES)
|
|
23
|
+
.describe('`card_error` for a declined card; `payment_error` for a FairCoin underpayment.'),
|
|
24
|
+
code: primitives_1.nullableString,
|
|
25
|
+
decline_code: primitives_1.nullableString,
|
|
26
|
+
message: zod_1.z.string(),
|
|
27
|
+
})
|
|
28
|
+
.strict());
|
|
29
|
+
/**
|
|
30
|
+
* What the payer must do next (`status: 'requires_action'`).
|
|
31
|
+
*
|
|
32
|
+
* - `faircoin_payment` — send exactly `amount` (base units) to `address` on
|
|
33
|
+
* `network`; `uri` is the BIP21-style `faircoin:` URI a wallet scans.
|
|
34
|
+
* - `use_peable_sdk` — a card challenge; `@peable.to/sdk/checkout` fetches the
|
|
35
|
+
* provider's confirmation credential through `POST …/client_action` and
|
|
36
|
+
* completes it. The credential is never on the intent itself.
|
|
37
|
+
*/
|
|
38
|
+
exports.paymentIntentNextActionSchema = (0, objects_1.defineComponent)('PaymentIntentNextAction', zod_1.z.discriminatedUnion('type', [
|
|
39
|
+
zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
type: zod_1.z.literal('faircoin_payment'),
|
|
42
|
+
faircoin_payment: zod_1.z
|
|
43
|
+
.object({
|
|
44
|
+
address: zod_1.z.string(),
|
|
45
|
+
network: primitives_1.network,
|
|
46
|
+
amount: primitives_1.amount,
|
|
47
|
+
currency: zod_1.z.literal('FAIR'),
|
|
48
|
+
uri: zod_1.z.string().describe('The `faircoin:` URI a wallet scans.'),
|
|
49
|
+
})
|
|
50
|
+
.strict(),
|
|
51
|
+
})
|
|
52
|
+
.strict(),
|
|
53
|
+
zod_1.z.object({ type: zod_1.z.literal('use_peable_sdk') }).strict(),
|
|
54
|
+
]));
|
|
55
|
+
/**
|
|
56
|
+
* The chain side of a FairCoin payment. `txid` and `confirmations` describe the
|
|
57
|
+
* transaction the payer reported: `null`/`0` while `requires_action`, the
|
|
58
|
+
* watcher's count against `required_confirmations` while `processing`.
|
|
59
|
+
*/
|
|
60
|
+
exports.paymentIntentFaircoinSchema = (0, objects_1.defineComponent)('PaymentIntentFaircoin', zod_1.z
|
|
61
|
+
.object({
|
|
62
|
+
network: primitives_1.network,
|
|
63
|
+
address: zod_1.z
|
|
64
|
+
.string()
|
|
65
|
+
.describe("Watch-only receive address derived per intent from the merchant's (or seller's) xpub."),
|
|
66
|
+
txid: primitives_1.nullableString,
|
|
67
|
+
confirmations: zod_1.z.number().int().nonnegative(),
|
|
68
|
+
required_confirmations: zod_1.z.number().int().nonnegative(),
|
|
69
|
+
})
|
|
70
|
+
.strict());
|
|
71
|
+
/** Where a destination charge's funds go (`transfer_data`, ADR 0015 §2). */
|
|
72
|
+
exports.paymentIntentTransferDataSchema = (0, objects_1.defineComponent)('PaymentIntentTransferData', zod_1.z
|
|
73
|
+
.object({
|
|
74
|
+
destination: zod_1.z.string().describe('The connected account (`ca_…`).'),
|
|
75
|
+
amount: primitives_1.amount
|
|
76
|
+
.nullable()
|
|
77
|
+
.describe('Base units transferred; `null`: the whole amount less `application_fee_amount`.'),
|
|
78
|
+
})
|
|
79
|
+
.strict());
|
|
80
|
+
const clientActionFields = {
|
|
81
|
+
kind: zod_1.z
|
|
82
|
+
.enum(payments_1.CLIENT_ACTION_KINDS)
|
|
83
|
+
.describe('`client_secret`: confirm with the provider; `redirect`: send the payer to `value`.'),
|
|
84
|
+
value: zod_1.z
|
|
85
|
+
.string()
|
|
86
|
+
.describe('Opaque and provider-specific: a confirmation credential or a redirect target. Never store, log or put it in a URL.'),
|
|
87
|
+
publishable_key: zod_1.z
|
|
88
|
+
.string()
|
|
89
|
+
.optional()
|
|
90
|
+
.describe("The provider's PUBLIC key for this payment's mode, when the deployment has one."),
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The payer's next step on the card rail, as `POST …/client_action` answers it:
|
|
94
|
+
* read live from the provider, `Cache-Control: no-store`, never on a list.
|
|
95
|
+
*/
|
|
96
|
+
exports.clientActionSchema = (0, objects_1.defineComponent)('ClientAction', zod_1.z.object({ object: zod_1.z.literal('client_action'), ...clientActionFields }).strict());
|
|
97
|
+
/** The same next step, as a create or a single merchant retrieve carries it on the intent. */
|
|
98
|
+
exports.paymentIntentClientActionSchema = (0, objects_1.defineComponent)('PaymentIntentClientAction', zod_1.z.object(clientActionFields).strict());
|
|
99
|
+
exports.paymentIntentSchema = (0, objects_1.defineObject)('payment_intent', 'PaymentIntent', zod_1.z
|
|
100
|
+
.object({
|
|
101
|
+
id: zod_1.z.string(),
|
|
102
|
+
object: zod_1.z.literal('payment_intent'),
|
|
103
|
+
livemode: primitives_1.livemode,
|
|
104
|
+
status: zod_1.z.enum(payments_1.PAYMENT_INTENT_STATUSES),
|
|
105
|
+
rail: zod_1.z
|
|
106
|
+
.enum(payments_1.PAYMENT_INTENT_RAILS)
|
|
107
|
+
.describe('Which rail moves this payment. Decides which fields below are populated.'),
|
|
108
|
+
payment_method_types: zod_1.z
|
|
109
|
+
.array(zod_1.z.enum(payments_1.PAYMENT_METHOD_TYPES))
|
|
110
|
+
.describe('What the payer may pay with: `["faircoin"]` on the chain; on the card rail the types named at creation, or those the configuration offers in this currency.'),
|
|
111
|
+
payment_method_configuration_details: zod_1.z
|
|
112
|
+
.object({ id: zod_1.z.string() })
|
|
113
|
+
.strict()
|
|
114
|
+
.nullable()
|
|
115
|
+
.describe('The `pmc_…` whose methods this card payment offers; `null` on the chain and when types were named.'),
|
|
116
|
+
amount: primitives_1.amount.describe('Base units of `currency` as a canonical integer string: m⊜ (10⁻⁸ FAIR) on the faircoin rail, cents on a fiat one.'),
|
|
117
|
+
amount_capturable: primitives_1.amount.describe('What can still be captured: the authorized amount while `requires_capture`, else `"0"`.'),
|
|
118
|
+
amount_received: primitives_1.amount.describe('What was received: the captured amount once `succeeded`, else `"0"`.'),
|
|
119
|
+
amount_refunded: primitives_1.amount.describe('The sum of SUCCEEDED refunds on this payment. Refund state lives on the refunds.'),
|
|
120
|
+
currency: primitives_1.currency,
|
|
121
|
+
capture_method: zod_1.z.enum(payments_1.PAYMENT_INTENT_CAPTURE_METHODS),
|
|
122
|
+
setup_future_usage: zod_1.z.enum(payments_1.PAYMENT_INTENT_SETUP_FUTURE_USAGES).nullable(),
|
|
123
|
+
customer: (0, objects_1.expandable)('customer', '`cus_…`, or the Customer with `expand[]=customer`.').nullable(),
|
|
124
|
+
payment_method: (0, objects_1.expandable)('payment_method', '`pm_…`, or the PaymentMethod with `expand[]=payment_method`. Card only.').nullable(),
|
|
125
|
+
latest_charge: (0, objects_1.expandable)('charge', '`ch_…`, or the Charge with `expand[]=latest_charge`. Card only.').nullable(),
|
|
126
|
+
next_action: exports.paymentIntentNextActionSchema.nullable(),
|
|
127
|
+
last_payment_error: exports.paymentErrorSchema.nullable(),
|
|
128
|
+
cancellation_reason: zod_1.z.enum(payments_1.PAYMENT_INTENT_CANCELLATION_REASONS).nullable(),
|
|
129
|
+
canceled_at: primitives_1.unixSeconds.nullable(),
|
|
130
|
+
description: primitives_1.nullableString,
|
|
131
|
+
receipt_email: primitives_1.nullableString,
|
|
132
|
+
statement_descriptor_suffix: primitives_1.nullableString.describe('Card only.'),
|
|
133
|
+
shipping: address_1.shippingSchema.nullable(),
|
|
134
|
+
faircoin: exports.paymentIntentFaircoinSchema
|
|
135
|
+
.nullable()
|
|
136
|
+
.describe('The chain side. FairCoin rail only; `null` on a card payment.'),
|
|
137
|
+
merchant_id: zod_1.z.string().describe("The merchant's public `merch_…`."),
|
|
138
|
+
connected_account: (0, objects_1.expandable)('connected_account', 'The seller this payment is made ON BEHALF OF (`ca_…`, ADR 0012 D5), or the ConnectedAccount with `expand[]=connected_account`; `null` for a payment to the merchant itself.').nullable(),
|
|
139
|
+
application_fee_amount: primitives_1.amount
|
|
140
|
+
.nullable()
|
|
141
|
+
.describe("Orbit's fee on this card payment, taken from the destination account when the charge succeeds (ADR 0015 §3); `null` on a platform charge."),
|
|
142
|
+
transfer_data: exports.paymentIntentTransferDataSchema.nullable(),
|
|
143
|
+
on_behalf_of: primitives_1.nullableString.describe('The account (`ca_…`) that is the merchant of record, or `null` (the platform).'),
|
|
144
|
+
client_secret: zod_1.z
|
|
145
|
+
.string()
|
|
146
|
+
.describe("The payer's capability over this intent (`submit_tx`, the payer's retrieve)."),
|
|
147
|
+
client_action: exports.paymentIntentClientActionSchema
|
|
148
|
+
.optional()
|
|
149
|
+
.describe("The card payer's next step — ONLY on the create's answer and a single merchant retrieve of a card payment that can still be paid; never on a list or an event."),
|
|
150
|
+
metadata: primitives_1.metadata,
|
|
151
|
+
expires_at: primitives_1.unixSeconds.describe('When an UNPAID intent expires. Meaningful only while `can_expire`.'),
|
|
152
|
+
can_expire: zod_1.z.boolean().describe('Whether this intent can still expire (ADR 0012 D9).'),
|
|
153
|
+
created: primitives_1.unixSeconds,
|
|
154
|
+
updated_at: primitives_1.unixSeconds,
|
|
155
|
+
})
|
|
156
|
+
.strict(), {
|
|
157
|
+
examples: [
|
|
158
|
+
{
|
|
159
|
+
id: 'pi_0193b8f2c1a87d3e9f4a',
|
|
160
|
+
object: 'payment_intent',
|
|
161
|
+
livemode: false,
|
|
162
|
+
status: 'requires_action',
|
|
163
|
+
rail: 'faircoin',
|
|
164
|
+
payment_method_types: ['faircoin'],
|
|
165
|
+
payment_method_configuration_details: null,
|
|
166
|
+
amount: '150000000',
|
|
167
|
+
amount_capturable: '0',
|
|
168
|
+
amount_received: '0',
|
|
169
|
+
amount_refunded: '0',
|
|
170
|
+
currency: 'FAIR',
|
|
171
|
+
capture_method: 'automatic',
|
|
172
|
+
setup_future_usage: null,
|
|
173
|
+
customer: null,
|
|
174
|
+
payment_method: null,
|
|
175
|
+
latest_charge: null,
|
|
176
|
+
next_action: {
|
|
177
|
+
type: 'faircoin_payment',
|
|
178
|
+
faircoin_payment: {
|
|
179
|
+
address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG',
|
|
180
|
+
network: 'testnet',
|
|
181
|
+
amount: '150000000',
|
|
182
|
+
currency: 'FAIR',
|
|
183
|
+
uri: 'faircoin:fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG?amount=1.5',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
last_payment_error: null,
|
|
187
|
+
cancellation_reason: null,
|
|
188
|
+
canceled_at: null,
|
|
189
|
+
description: null,
|
|
190
|
+
receipt_email: null,
|
|
191
|
+
statement_descriptor_suffix: null,
|
|
192
|
+
shipping: null,
|
|
193
|
+
faircoin: {
|
|
194
|
+
network: 'testnet',
|
|
195
|
+
address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG',
|
|
196
|
+
txid: null,
|
|
197
|
+
confirmations: 0,
|
|
198
|
+
required_confirmations: 6,
|
|
199
|
+
},
|
|
200
|
+
merchant_id: 'merch_0193b8f2c1a87d3e9f4a',
|
|
201
|
+
connected_account: null,
|
|
202
|
+
application_fee_amount: null,
|
|
203
|
+
transfer_data: null,
|
|
204
|
+
on_behalf_of: null,
|
|
205
|
+
client_secret: 'pi_0193b8f2c1a87d3e9f4a_secret_3c9f2a',
|
|
206
|
+
metadata: { order_id: '6735' },
|
|
207
|
+
expires_at: 1793751300,
|
|
208
|
+
can_expire: true,
|
|
209
|
+
created: 1793750400,
|
|
210
|
+
updated_at: 1793750400,
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
});
|
|
214
|
+
// ---------------------------------------------------------------------------
|
|
215
|
+
// Requests
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
/** A base-unit amount in a request body. */
|
|
218
|
+
const amountParam = (name) => zod_1.z.string().refine(money_1.isBaseUnitString, `${name} must be a minor-unit integer string`);
|
|
219
|
+
/**
|
|
220
|
+
* The rail/amount/currency/network fragment a creating route takes. Coherence
|
|
221
|
+
* (rail + currency + network agreeing with each other and the merchant) is the
|
|
222
|
+
* service's rule, not a refinement here.
|
|
223
|
+
*/
|
|
224
|
+
exports.railParams = {
|
|
225
|
+
amount: amountParam('amount').describe('Base units of `currency`, as a canonical integer string (m⊜ for FAIR, cents for EUR).'),
|
|
226
|
+
rail: zod_1.z.enum(payments_1.PAYMENT_INTENT_RAILS).optional().describe('Defaults to `faircoin`.'),
|
|
227
|
+
currency: zod_1.z
|
|
228
|
+
.enum(money_1.CURRENCY_CODES)
|
|
229
|
+
.optional()
|
|
230
|
+
.describe('Defaults to `FAIR` on the faircoin rail; required on the card rail.'),
|
|
231
|
+
network: zod_1.z
|
|
232
|
+
.enum(money_1.NETWORK_TYPES)
|
|
233
|
+
.optional()
|
|
234
|
+
.describe('Required on the faircoin rail; refused on the card rail, which has none.'),
|
|
235
|
+
};
|
|
236
|
+
/** The seller an on-behalf create pays (`ca_…`, ADR 0012 D5). FairCoin only. */
|
|
237
|
+
exports.connectedAccountParam = {
|
|
238
|
+
connected_account: params_1.idParam.optional().describe('FairCoin only: pay this seller (`ca_…`).'),
|
|
239
|
+
};
|
|
240
|
+
const setupFutureUsage = zod_1.z.enum(payments_1.PAYMENT_INTENT_SETUP_FUTURE_USAGES);
|
|
241
|
+
const returnUrl = zod_1.z.string().url().max(2048);
|
|
242
|
+
exports.createPaymentIntentParams = zod_1.z
|
|
243
|
+
.object({
|
|
244
|
+
...exports.railParams,
|
|
245
|
+
...exports.connectedAccountParam,
|
|
246
|
+
metadata: params_1.metadataCreateParam.optional(),
|
|
247
|
+
expires_in_seconds: zod_1.z.number().int().positive().optional(),
|
|
248
|
+
payment_method_types: zod_1.z
|
|
249
|
+
.array(zod_1.z.enum(payments_1.PAYMENT_METHOD_TYPES))
|
|
250
|
+
.min(1)
|
|
251
|
+
.max(payments_1.CARD_RAIL_PAYMENT_METHOD_TYPES.length)
|
|
252
|
+
.optional()
|
|
253
|
+
.describe('`["faircoin"]` on the chain rail; on the card rail any of the card-rail types the provider offers in `currency`, instead of a configuration.'),
|
|
254
|
+
payment_method_configuration: params_1.idParam
|
|
255
|
+
.optional()
|
|
256
|
+
.describe("Card only: the `pmc_…` whose methods to offer. Defaults to the merchant's default."),
|
|
257
|
+
customer: params_1.idParam.optional().describe('`cus_…`.'),
|
|
258
|
+
payment_method: params_1.idParam
|
|
259
|
+
.optional()
|
|
260
|
+
.describe('Card only: a saved payment method (`pm_…`) of `customer`.'),
|
|
261
|
+
confirm: zod_1.z
|
|
262
|
+
.boolean()
|
|
263
|
+
.optional()
|
|
264
|
+
.describe('Card only: confirm in the same call (needs `payment_method`).'),
|
|
265
|
+
off_session: zod_1.z
|
|
266
|
+
.boolean()
|
|
267
|
+
.optional()
|
|
268
|
+
.describe('Card only, with `confirm`: the customer is not present (needs `customer`).'),
|
|
269
|
+
setup_future_usage: setupFutureUsage.optional().describe('Card only.'),
|
|
270
|
+
capture_method: zod_1.z
|
|
271
|
+
.enum(payments_1.PAYMENT_INTENT_CAPTURE_METHODS)
|
|
272
|
+
.optional()
|
|
273
|
+
.describe('Card only. Defaults to `automatic`.'),
|
|
274
|
+
receipt_email: address_1.emailParam.optional(),
|
|
275
|
+
description: zod_1.z.string().max(1000).optional(),
|
|
276
|
+
// Stripe's bound; the account prefix and this together must fit 22.
|
|
277
|
+
statement_descriptor_suffix: zod_1.z
|
|
278
|
+
.string()
|
|
279
|
+
.min(1)
|
|
280
|
+
.max(22)
|
|
281
|
+
.regex(/^[^<>\\'"*]*$/, 'statement_descriptor_suffix may not contain < > \\ \' " *')
|
|
282
|
+
.optional()
|
|
283
|
+
.describe('Card only.'),
|
|
284
|
+
shipping: address_1.shippingParams.optional(),
|
|
285
|
+
return_url: returnUrl
|
|
286
|
+
.optional()
|
|
287
|
+
.describe('Card only, with `confirm`: where a redirect-based challenge returns.'),
|
|
288
|
+
// A destination charge for one of the platform's connected accounts
|
|
289
|
+
// (ADR 0015 §2). Card only; the service decides the routing.
|
|
290
|
+
application_fee_amount: amountParam('application_fee_amount')
|
|
291
|
+
.optional()
|
|
292
|
+
.describe("Card only, a platform acting for a connected account: Orbit's fee for this payment. Needs `transfer_data` (or `on_behalf_of`); refused beside `transfer_data.amount`."),
|
|
293
|
+
transfer_data: zod_1.z
|
|
294
|
+
.object({
|
|
295
|
+
destination: params_1.idParam.describe('The connected account (`ca_…`) the funds go to.'),
|
|
296
|
+
amount: amountParam('transfer_data.amount').optional(),
|
|
297
|
+
})
|
|
298
|
+
.strict()
|
|
299
|
+
.optional()
|
|
300
|
+
.describe("Card only: a destination charge to one of the platform's connected accounts."),
|
|
301
|
+
on_behalf_of: params_1.idParam
|
|
302
|
+
.optional()
|
|
303
|
+
.describe('Card only: make this connected account (`ca_…`) the merchant of record.'),
|
|
304
|
+
})
|
|
305
|
+
.strict();
|
|
306
|
+
/**
|
|
307
|
+
* The merchant's own bookkeeping only — the amount, rail and status ARE the
|
|
308
|
+
* payment and move through their own operations. `""` clears a field;
|
|
309
|
+
* `metadata` is a patch.
|
|
310
|
+
*/
|
|
311
|
+
exports.updatePaymentIntentParams = zod_1.z
|
|
312
|
+
.object({
|
|
313
|
+
metadata: params_1.metadataUpdateParam.optional(),
|
|
314
|
+
description: (0, params_1.clearable)(zod_1.z.string().max(1000)).optional(),
|
|
315
|
+
receipt_email: (0, params_1.clearable)(address_1.emailParam).optional(),
|
|
316
|
+
shipping: (0, params_1.clearable)(address_1.shippingParams).optional(),
|
|
317
|
+
expand: params_1.expandParam.optional(),
|
|
318
|
+
})
|
|
319
|
+
.strict();
|
|
320
|
+
/** Card only. */
|
|
321
|
+
exports.confirmPaymentIntentParams = zod_1.z
|
|
322
|
+
.object({
|
|
323
|
+
payment_method: params_1.idParam.optional().describe("`pm_…`; defaults to the intent's own."),
|
|
324
|
+
off_session: zod_1.z.boolean().optional(),
|
|
325
|
+
setup_future_usage: setupFutureUsage.optional(),
|
|
326
|
+
return_url: returnUrl.optional(),
|
|
327
|
+
receipt_email: address_1.emailParam.optional(),
|
|
328
|
+
shipping: address_1.shippingParams.optional(),
|
|
329
|
+
expand: params_1.expandParam.optional(),
|
|
330
|
+
})
|
|
331
|
+
.strict();
|
|
332
|
+
/** Card only, `requires_capture`. */
|
|
333
|
+
exports.capturePaymentIntentParams = zod_1.z
|
|
334
|
+
.object({
|
|
335
|
+
amount_to_capture: amountParam('amount_to_capture')
|
|
336
|
+
.refine((value) => value !== '0', 'amount_to_capture must be positive')
|
|
337
|
+
.optional()
|
|
338
|
+
.describe('Base units, at most the authorized amount; defaults to all of it.'),
|
|
339
|
+
expand: params_1.expandParam.optional(),
|
|
340
|
+
})
|
|
341
|
+
.strict();
|
|
342
|
+
exports.cancelPaymentIntentParams = zod_1.z
|
|
343
|
+
.object({
|
|
344
|
+
cancellation_reason: zod_1.z.enum(payments_1.MERCHANT_CANCELLATION_REASONS).optional(),
|
|
345
|
+
expand: params_1.expandParam.optional(),
|
|
346
|
+
})
|
|
347
|
+
.strict();
|
|
348
|
+
/**
|
|
349
|
+
* The payer proves possession of the intent with its `client_secret`; the
|
|
350
|
+
* reported txid is what the settlement watcher then verifies on-chain.
|
|
351
|
+
*/
|
|
352
|
+
exports.submitPaymentIntentTxParams = zod_1.z
|
|
353
|
+
.object({
|
|
354
|
+
client_secret: zod_1.z.string().min(1),
|
|
355
|
+
txid: zod_1.z.string().min(1).describe('The broadcast transaction.'),
|
|
356
|
+
})
|
|
357
|
+
.strict();
|
|
358
|
+
/** The list's own filters, beside the shared list parameters. */
|
|
359
|
+
exports.listPaymentIntentsQuery = (0, params_1.listQuery)({
|
|
360
|
+
status: zod_1.z.enum(payments_1.PAYMENT_INTENT_STATUSES).optional(),
|
|
361
|
+
connected_account: params_1.idParam
|
|
362
|
+
.optional()
|
|
363
|
+
.describe('Only the payments made on behalf of this seller (`ca_…`, ADR 0012).'),
|
|
364
|
+
customer: params_1.idParam.optional().describe("Only this customer's payments (`cus_…`)."),
|
|
365
|
+
});
|
|
366
|
+
/**
|
|
367
|
+
* The payer's capability, on a route either party may call. The
|
|
368
|
+
* `X-Peable-Client-Secret` header is preferred: a query string lands in access
|
|
369
|
+
* logs.
|
|
370
|
+
*/
|
|
371
|
+
exports.clientSecretParam = zod_1.z
|
|
372
|
+
.string()
|
|
373
|
+
.min(1)
|
|
374
|
+
.optional()
|
|
375
|
+
.describe("Without a service credential: the object's `client_secret` (prefer the `X-Peable-Client-Secret` header).");
|
|
376
|
+
/** A merchant retrieve takes `expand[]`; the payer's takes `client_secret` and nothing to expand. */
|
|
377
|
+
exports.retrievePaymentIntentQuery = (0, params_1.retrieveQuery)({ client_secret: exports.clientSecretParam });
|
|
378
|
+
/** The query of a route either party may call that takes nothing else (`client_action`). */
|
|
379
|
+
exports.clientSecretQuery = zod_1.z.object({ client_secret: exports.clientSecretParam }).strict();
|
|
380
|
+
const intentId = { id: 'The payment intent (`pi_…`).' };
|
|
381
|
+
exports.paymentIntentRoutes = [
|
|
382
|
+
(0, route_1.defineRoute)({
|
|
383
|
+
operationId: 'createPaymentIntent',
|
|
384
|
+
method: 'post',
|
|
385
|
+
path: '/v1/payment_intents',
|
|
386
|
+
tag: 'Payment intents',
|
|
387
|
+
summary: 'Create a payment intent',
|
|
388
|
+
description: "`Idempotency-Key` also keys the intent itself: a key replayed after the 24-hour window answers 200 with the payment it created. On the card rail the answer carries `client_action`, the payer's next step.",
|
|
389
|
+
auth: 'service',
|
|
390
|
+
scope: 'payments:write',
|
|
391
|
+
idempotent: true,
|
|
392
|
+
body: exports.createPaymentIntentParams,
|
|
393
|
+
response: exports.paymentIntentSchema,
|
|
394
|
+
status: 201,
|
|
395
|
+
sdk: 'paymentIntents.create',
|
|
396
|
+
}),
|
|
397
|
+
(0, route_1.defineRoute)({
|
|
398
|
+
operationId: 'listPaymentIntents',
|
|
399
|
+
method: 'get',
|
|
400
|
+
path: '/v1/payment_intents',
|
|
401
|
+
tag: 'Payment intents',
|
|
402
|
+
summary: 'List payment intents',
|
|
403
|
+
auth: 'service',
|
|
404
|
+
scope: 'payments:read',
|
|
405
|
+
query: exports.listPaymentIntentsQuery,
|
|
406
|
+
response: (0, envelopes_1.listOf)(exports.paymentIntentSchema),
|
|
407
|
+
sdk: 'paymentIntents.list',
|
|
408
|
+
expandable: 'payment_intent',
|
|
409
|
+
}),
|
|
410
|
+
(0, route_1.defineRoute)({
|
|
411
|
+
operationId: 'retrievePaymentIntent',
|
|
412
|
+
method: 'get',
|
|
413
|
+
path: '/v1/payment_intents/{id}',
|
|
414
|
+
tag: 'Payment intents',
|
|
415
|
+
summary: 'Retrieve a payment intent',
|
|
416
|
+
description: "With the merchant credential: the intent, expandable, and — for a card payment that can still be paid — its `client_action` (`Cache-Control: no-store`). Without one, the PAYER reads it with the intent's `client_secret` (the `X-Peable-Client-Secret` header, or the query): no expansion and no client action.",
|
|
417
|
+
auth: 'service',
|
|
418
|
+
scope: 'payments:read',
|
|
419
|
+
params: intentId,
|
|
420
|
+
query: exports.retrievePaymentIntentQuery,
|
|
421
|
+
response: exports.paymentIntentSchema,
|
|
422
|
+
sdk: 'paymentIntents.retrieve',
|
|
423
|
+
expandable: 'payment_intent',
|
|
424
|
+
}),
|
|
425
|
+
(0, route_1.defineRoute)({
|
|
426
|
+
operationId: 'updatePaymentIntent',
|
|
427
|
+
method: 'post',
|
|
428
|
+
path: '/v1/payment_intents/{id}',
|
|
429
|
+
tag: 'Payment intents',
|
|
430
|
+
summary: 'Update a payment intent',
|
|
431
|
+
description: 'The merchant\'s own fields only: `metadata` (a patch), `description`, `receipt_email`, `shipping` (`""` clears). Sends no webhook.',
|
|
432
|
+
auth: 'service',
|
|
433
|
+
scope: 'payments:write',
|
|
434
|
+
idempotent: true,
|
|
435
|
+
params: intentId,
|
|
436
|
+
body: exports.updatePaymentIntentParams,
|
|
437
|
+
response: exports.paymentIntentSchema,
|
|
438
|
+
sdk: 'paymentIntents.update',
|
|
439
|
+
expandable: 'payment_intent',
|
|
440
|
+
}),
|
|
441
|
+
(0, route_1.defineRoute)({
|
|
442
|
+
operationId: 'retrievePaymentIntentClientAction',
|
|
443
|
+
method: 'post',
|
|
444
|
+
path: '/v1/payment_intents/{id}/client_action',
|
|
445
|
+
tag: 'Payment intents',
|
|
446
|
+
summary: "Retrieve a card payment's client action",
|
|
447
|
+
description: "What the payer's client must do next, to RESUME a card payment rather than create a second one. The merchant credential, or the payer's `client_secret` (`X-Peable-Client-Secret`). A POST so the credential never reaches a URL; answered `Cache-Control: no-store`. A FairCoin payment is a 400 (it is paid by sending coins to `next_action.faircoin_payment.address`); a payment that can no longer be paid is a 409.",
|
|
448
|
+
auth: 'service',
|
|
449
|
+
scope: 'payments:read',
|
|
450
|
+
params: intentId,
|
|
451
|
+
query: exports.clientSecretQuery,
|
|
452
|
+
response: exports.clientActionSchema,
|
|
453
|
+
sdk: 'paymentIntents.clientAction',
|
|
454
|
+
}),
|
|
455
|
+
(0, route_1.defineRoute)({
|
|
456
|
+
operationId: 'confirmPaymentIntent',
|
|
457
|
+
method: 'post',
|
|
458
|
+
path: '/v1/payment_intents/{id}/confirm',
|
|
459
|
+
tag: 'Payment intents',
|
|
460
|
+
summary: 'Confirm a payment intent',
|
|
461
|
+
description: "Card only: confirm server-side with a saved payment method attached to the intent's customer. A decline answers 402 `card_error` carrying the intent; a challenge answers `status: 'requires_action'` with `next_action: use_peable_sdk`.",
|
|
462
|
+
auth: 'service',
|
|
463
|
+
scope: 'payments:write',
|
|
464
|
+
idempotent: true,
|
|
465
|
+
params: intentId,
|
|
466
|
+
body: exports.confirmPaymentIntentParams,
|
|
467
|
+
response: exports.paymentIntentSchema,
|
|
468
|
+
sdk: 'paymentIntents.confirm',
|
|
469
|
+
expandable: 'payment_intent',
|
|
470
|
+
}),
|
|
471
|
+
(0, route_1.defineRoute)({
|
|
472
|
+
operationId: 'capturePaymentIntent',
|
|
473
|
+
method: 'post',
|
|
474
|
+
path: '/v1/payment_intents/{id}/capture',
|
|
475
|
+
tag: 'Payment intents',
|
|
476
|
+
summary: 'Capture a payment intent',
|
|
477
|
+
description: 'Card only, `requires_capture`: capture the held authorization in full, or `amount_to_capture` of it (the rest is released).',
|
|
478
|
+
auth: 'service',
|
|
479
|
+
scope: 'payments:write',
|
|
480
|
+
idempotent: true,
|
|
481
|
+
params: intentId,
|
|
482
|
+
body: exports.capturePaymentIntentParams,
|
|
483
|
+
response: exports.paymentIntentSchema,
|
|
484
|
+
sdk: 'paymentIntents.capture',
|
|
485
|
+
expandable: 'payment_intent',
|
|
486
|
+
}),
|
|
487
|
+
(0, route_1.defineRoute)({
|
|
488
|
+
operationId: 'cancelPaymentIntent',
|
|
489
|
+
method: 'post',
|
|
490
|
+
path: '/v1/payment_intents/{id}/cancel',
|
|
491
|
+
tag: 'Payment intents',
|
|
492
|
+
summary: 'Cancel a payment intent',
|
|
493
|
+
description: 'While nothing is moving money: `requires_payment_method`, `requires_confirmation`, `requires_action`, or a held authorization (`requires_capture`, released). The card payment is cancelled at the provider first. Cancelling a cancelled intent answers it again.',
|
|
494
|
+
auth: 'service',
|
|
495
|
+
scope: 'payments:write',
|
|
496
|
+
idempotent: true,
|
|
497
|
+
params: intentId,
|
|
498
|
+
body: exports.cancelPaymentIntentParams,
|
|
499
|
+
response: exports.paymentIntentSchema,
|
|
500
|
+
sdk: 'paymentIntents.cancel',
|
|
501
|
+
expandable: 'payment_intent',
|
|
502
|
+
}),
|
|
503
|
+
(0, route_1.defineRoute)({
|
|
504
|
+
operationId: 'submitPaymentIntentTx',
|
|
505
|
+
method: 'post',
|
|
506
|
+
path: '/v1/payment_intents/{id}/submit_tx',
|
|
507
|
+
tag: 'Payment intents',
|
|
508
|
+
summary: 'Report a FairCoin transaction',
|
|
509
|
+
description: "The PAYER's call, authorized by the intent's `client_secret`: report the txid their wallet broadcast. The intent moves to `processing`; the settlement watcher verifies the transaction on-chain. FairCoin only.",
|
|
510
|
+
auth: 'public',
|
|
511
|
+
params: intentId,
|
|
512
|
+
body: exports.submitPaymentIntentTxParams,
|
|
513
|
+
response: exports.paymentIntentSchema,
|
|
514
|
+
}),
|
|
515
|
+
(0, route_1.defineRoute)({
|
|
516
|
+
operationId: 'searchPaymentIntents',
|
|
517
|
+
method: 'get',
|
|
518
|
+
path: '/v1/payment_intents/search',
|
|
519
|
+
tag: 'Payment intents',
|
|
520
|
+
summary: 'Search payment intents',
|
|
521
|
+
description: "Stripe's query language over `amount`, `currency`, `customer`, `status`, `created`, `metadata['key']`, `description` and `receipt_email`.",
|
|
522
|
+
auth: 'service',
|
|
523
|
+
scope: 'payments:read',
|
|
524
|
+
query: params_1.searchQuery,
|
|
525
|
+
response: (0, envelopes_1.searchResultOf)(exports.paymentIntentSchema),
|
|
526
|
+
sdk: 'paymentIntents.search',
|
|
527
|
+
expandable: 'payment_intent',
|
|
528
|
+
}),
|
|
529
|
+
];
|