Skip to content

[FIK-77] feat(paystack): allow cart coupons (fork test PR) - #19

Merged
moset15 merged 3 commits into
mainfrom
feat/paystack-coupons
Nov 26, 2026
Merged

moset15 merged 3 commits into
mainfrom
feat/paystack-coupons

Conversation

@moset15

@moset15 moset15 commented Nov 25, 2026

Copy link
Copy Markdown

Fork test PR. Do not merge. It runs CI and is the test record for FIK-77. The same branch goes upstream once emdashCommerce#85 merges.

Stacked on the Paystack package (emdashCommerce#85), so this diff also shows emdashCommerce#85's two commits. This PR's own change is the last commit: feat(paystack): allow cart coupons.

  • The package declares capabilities.coupons. A Paystack cart with a coupon used to get a 409 at checkout.
  • New integration test through core's real cart/coupon and create-session routes: Paystack is charged the discounted total and the order keeps the discount.

Hand test: create a 10% coupon, check out in KES with Paystack, and confirm Paystack's page shows the discounted amount.

🤖 Generated with Claude Code

moset15 and others added 3 commits November 24, 2026 01:10
A PaymentProvider for Paystack on core's provider interface: card and
M-Pesa through Paystack's hosted page or its Popup over the store's own
checkout.

- Orders come only from a signed charge.success, confirmed with
  /transaction/verify. Both signature schemes are checked with the key
  each is signed with: Paystack-Signature with a whsec_ secret (final
  when present, so its 300-second replay window holds) and
  x-paystack-signature with the sk_ key. In a real test-mode run Paystack
  sent only x-paystack-signature on an account with a whsec_ secret, so
  both matter.
- Refunds by transaction reference, tagged with core's refundRequestId so
  a retry returns the existing refund instead of creating a second one;
  refund.* webhooks (which carry the refund id as a string) map to
  refund.updated.
- A payment refunded in full at Paystack before its order exists is not
  confirmed, so a late webhook retry creates no order. Paystack reports
  reversed after partial refunds too, so the refunded total decides.
- "Test Paystack connection" checks the saved key, test or live.
- The Popup client (./checkout-client) loads js.paystack.co only when the
  customer presses Pay.

Tested end to end in Paystack test mode: hosted and Popup, card and
M-Pesa, declined cards, duplicate and stale webhooks, refunds that
succeed and fail.
….4.0

- Set providerEventId on refund.* events (`<event>:<refund id>`), so two
  refund.failed deliveries reverse a refund once, and on charge.success
  (`charge.success:<reference>`), so overlapping deliveries run once.
  Core still releases the record when confirming with Paystack fails.
- Peer @dashcommerce/core ^0.4.0 instead of workspace:*, which made
  changesets version this package 1.0.0. It now releases as 0.1.0.
- README: needs core 0.4.0, install step, why ?provider=paystack,
  removed the pre-merge core requirements section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Paystack cart with a coupon got a 409 at checkout. Core already sends
Paystack the total after the discount, so the package declares coupons.
Tested through core's real cart/coupon and create-session routes: Paystack
is charged the discounted total and the order keeps the discount.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 25, 2026

Copy link
Copy Markdown

FIK-77

@moset15
moset15 merged commit 153461e into main Nov 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant