Skip to main content

swichpay_flutter 2.0.0 copy "swichpay_flutter: ^2.0.0" to clipboard
swichpay_flutter: ^2.0.0 copied to clipboard

Flutter SDK for integrating Swich payment services.

Changelog #

2.0.0 #

Changed #

  • Breaking: SwichPay.initialize() no longer takes getAccessToken or getPaymentSessionDetails callbacks - merchants now only provide clientId, clientSecret, referrer, merchantId, appId, and environment. Given clientSecret, the SDK exchanges it for an OAuth2 bearer token itself (client_credentials grant, refreshed automatically) instead of requiring a merchant backend to do it; the SDK also creates payment sessions and fetches their details internally. clientSecret is technically optional - without one, every call falls back to sending clientId as a plain x-public-key header, which only a subset of endpoints accept, so pass it whenever you have it.
  • Breaking: Renamed SwichPayConfig/SwichPay.initialize()'s publicKey to clientId. secretHashKey keeps its name - it's a separate, different secret than the new clientSecret (native's PaymentConfig has always had both: secretKey for OAuth, secretHashKey for the card-payment checksum). Passing the same value for both gets an invalid_client 401 from the token endpoint.
  • Breaking: Removed SwichPayAuthException - no longer thrown, since there's no host-app callback left to fail.
  • Breaking: Removed package:swichpay_flutter/sandbox.dart - SwichPaySandbox existed only to fake what the SDK now does internally by default.
  • Added direct (session-less) card payment (SwichPay.presentCardCheckout), mirroring native's CardBottomSheet: 3-D Secure device-data-collection, optional OTP step-up, and status polling. Requires secretHashKey on SwichPay.initialize().
  • Added a "Scan card" shortcut to both the built-in payment sheet's and presentCardCheckout's card forms - camera-based, via package:card_scanner, fills in the card number and expiry automatically. Android/iOS only; not shown on other platforms. Needs a camera permission - see the README's Platform notes for the one-line iOS setup step.

1.0.0 #

Initial public release.

Added #

  • Built-in payment sheet (SwichPay.presentPaymentSheet) supporting:
    • Card payments (Visa/Mastercard), including saved cards and 3-D Secure (device-data-collection and OTP step-up).
    • E-Wallet payments (EasyPaisa/JazzCash), including saved wallets.
    • Bank Account payments, including an OTP confirmation step.
    • Biller (1Bill) payments.
    • QR (RAAST dynamic) payments.
    • RTP Now payments (Raast mobile/IBAN or bank account).
    • RTP E-Wallet payments.
    • Automatic discount lookup and display for E-Wallet and Card payments.
  • Standalone, session-less "direct" checkouts for E-Wallet, Bank Transfer, 1Bill, QR, RTP Now, and RTP E-Wallet (SwichPay.present*Checkout), for integrations that don't need the full payment-method picker.
  • Hosted checkout (SwichPay.presentHostedCheckout / presentHostedCheckoutSheet) for a WebView-based flow.
  • Direct card payment (SwichPay.pay) for fully custom card UI.
  • Payment session inquiry (SwichPay.inquirePaymentSession) and cancellation.
  • App-wide payment result stream (SwichPay.onResult).
  • Sandbox and production environment configuration (Environment.sandbox / Environment.production), with base URL overrides for local backend testing.
  • Typed exception hierarchy (SwichPayNotInitializedException, SwichPayValidationException, SwichPayNetworkException, SwichPayApiException, SwichPayAuthException) so callers can handle SDK errors without parsing raw HTTP responses.

Security #

  • Card number, CVC, CNIC, MSISDN, account number/alias, IBAN, OTP, and discount-lookup reference values are redacted from debug logs.
  • Debug logging (swichpayLog) is a no-op outside debug builds.
0
likes
0
points
293
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter SDK for integrating Swich payment services.

Homepage

License

unknown (license)

Dependencies

card_scanner, crypto, dio, flutter, gal, path_provider, qr_flutter, share_plus, webview_flutter

More

Packages that depend on swichpay_flutter