swichpay_flutter 2.0.0
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 takesgetAccessTokenorgetPaymentSessionDetailscallbacks - merchants now only provideclientId,clientSecret,referrer,merchantId,appId, andenvironment. GivenclientSecret, the SDK exchanges it for an OAuth2 bearer token itself (client_credentialsgrant, refreshed automatically) instead of requiring a merchant backend to do it; the SDK also creates payment sessions and fetches their details internally.clientSecretis technically optional - without one, every call falls back to sendingclientIdas a plainx-public-keyheader, which only a subset of endpoints accept, so pass it whenever you have it. - Breaking: Renamed
SwichPayConfig/SwichPay.initialize()'spublicKeytoclientId.secretHashKeykeeps its name - it's a separate, different secret than the newclientSecret(native'sPaymentConfighas always had both:secretKeyfor OAuth,secretHashKeyfor the card-payment checksum). Passing the same value for both gets aninvalid_client401 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-SwichPaySandboxexisted only to fake what the SDK now does internally by default. - Added direct (session-less) card payment (
SwichPay.presentCardCheckout), mirroring native'sCardBottomSheet: 3-D Secure device-data-collection, optional OTP step-up, and status polling. RequiressecretHashKeyonSwichPay.initialize(). - Added a "Scan card" shortcut to both the built-in payment sheet's and
presentCardCheckout's card forms - camera-based, viapackage: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.