Skip to content

[CRITICAL][PAYMENT INTENTS] Bind Paystack references to expected user, amount, and currency before redirect #183

Description

@Obiajulu-gif

Summary

Wallet-funding initialization sends a provider reference but does not persist an immutable local payment intent. Verification later trusts provider metadata and fallback identity resolution, so the platform cannot prove that the reference, payer, amount, and currency match the request it initiated.

Repository evidence

  • app/api/payments/initialize/route.ts:63-88 generates and sends a reference without creating a local intent record.
  • app/api/payments/verify/route.ts:59-103 accepts only a reference before processing provider data.
  • lib/services/paystack-processing.service.ts:54-79 resolves users through metadata, request fallback, or email.

Scope

  • Persist a payment intent before calling Paystack, including owner, amount in kobo, currency, purpose, and expiry.
  • Require verification/webhook data to match the intent before any balance or loan mutation.

Acceptance criteria

  • Unknown, expired, wrong-user, wrong-amount, and wrong-currency references cannot credit funds.
  • Intent and settlement transitions are atomic and auditable.

Tests

  • Add tampered metadata, amount, currency, ownership, expiry, webhook-first, and verify-first cases.

Non-goals

  • Replacing Paystack or redesigning the ledger.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions