Repository navigation
feat(ecommerce): add stripe and paypal online payments to the web shop - #1578
Merged
Merged
Conversation
- Stripe Connect (Standard accounts, OAuth) and PayPal (store's own REST app) connected under Settings → Integrations; money goes to each store's account - hosted checkout, order created first and auto-cancelled after 30 minutes unpaid; cancelling a paid order refunds it - settlement re-asks the provider under the order lock and compares the exact minor-unit amount; webhooks, return page and a per-minute sweep converge - white label: Connect redirect URI and webhook on the credential's origin, PayPal webhook, shop links and return pages on the workspace's domain - public API: payment-providers list/connect-link/disconnect and orders.getPaymentLink; payment status on the orders list and detail - new @chatbotx.io/payments package, OrderPayment and EcommercePaymentProvider tables, confirmOrderPayment job and expireUnpaidOrders schedule Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…eardown - the expiry cancel keeps an order whose page turns out paid as it is closed (LatePaymentArrivedError) instead of cancelling and refunding it - the stale-attempt sweep postpones by touching updatedAt, so expiresAt stays the page's real end: no dead checkout link is offered again and the public API reports the right page end - a purged workspace deauthorizes its Stripe account and deletes its PayPal webhook before the cascade - the expiry cancel reason is translated in the builder - paymentProviders.getConnectLink uses the workspace's own domain Co-Authored-By: Claude Opus 5.5 <[email protected]>
hello-jackytruong
referenced
this pull request
in hello-jackytruong/ChatWorkAI
Nov 22, 2026
…p (#1578) * feat(ecommerce): add stripe and paypal online payments to the web shop - Stripe Connect (Standard accounts, OAuth) and PayPal (store's own REST app) connected under Settings → Integrations; money goes to each store's account - hosted checkout, order created first and auto-cancelled after 30 minutes unpaid; cancelling a paid order refunds it - settlement re-asks the provider under the order lock and compares the exact minor-unit amount; webhooks, return page and a per-minute sweep converge - white label: Connect redirect URI and webhook on the credential's origin, PayPal webhook, shop links and return pages on the workspace's domain - public API: payment-providers list/connect-link/disconnect and orders.getPaymentLink; payment status on the orders list and detail - new @chatbotx.io/payments package, OrderPayment and EcommercePaymentProvider tables, confirmOrderPayment job and expireUnpaidOrders schedule Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(ecommerce): keep payments made at the deadline and tidy payment teardown - the expiry cancel keeps an order whose page turns out paid as it is closed (LatePaymentArrivedError) instead of cancelling and refunding it - the stale-attempt sweep postpones by touching updatedAt, so expiresAt stays the page's real end: no dead checkout link is offered again and the public API reports the right page end - a purged workspace deauthorizes its Stripe account and deletes its PayPal webhook before the cascade - the expiry cancel reason is translated in the builder - paymentProviders.getConnectLink uses the workspace's own domain Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Deathgiver <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The web shop could only take cash on delivery. Stores can now take Stripe and PayPal payments. The money goes straight to each store's own account, and the customer pays on the provider's hosted page.
ca_…client id is set in Platform credentials → Stripe and is now required.pending/unpaidwith a 30-minute deadline (PAYMENT_EXPIRY_MINUTES). Nothing is announced (confirmation, push, events, checkout flow) until the money comes in.expireUnpaidOrdersschedule runs every minute. It cancels orders that stay unpaid, gives the stock and the discount code back, closes the provider page, and tells the customer why.confirmOrderPayment) and the scan all go throughsyncAttempt.getConnectLinkuse the workspace's domain (resolveWorkspaceAppUrl).paymentProviders.list,paymentProviders.getConnectLink,paymentProviders.disconnect,orders.getPaymentLink.payments,paymentExpiresAtandpaidAt.purgeDueScheduled.Invariant 23 exemption
startStripeConnectActionandconnectPaypalActionstay UI-only, for a workspace super admin. Connecting decides which account receives the store's money, which a workspace token must never do. Agents callpaymentProviders.getConnectLinkto get the page for the store owner, then check the result withpaymentProviders.list.Database
New migration
20261028134050_ecommerce_online_payments:EcommercePaymentProviderandOrderPaymenttables.Order.paymentExpiresAtandOrder.paidAt, with partial indexes.paymentMethodgainsstripeandpaypal(ADD VALUE IF NOT EXISTS).db:check-driftis clean.New package
@chatbotx.io/paymentsholds the Stripe and PayPal gateways: Stripe through the official SDK, PayPal through REST overfetch. It has no zod and is Edge-safe for the builder graph.Test plan
pnpm lint;check-typespasses on all 64 packagesKnown limits are in
docs/ecommerce.md→ Online payments:PENDINGkeeps the order waiting.refund.failedis not tracked.🤖 Generated with Claude Code