flutter_paypal_payment_checkout_v2 2.0.1
flutter_paypal_payment_checkout_v2: ^2.0.1 copied to clipboard
This package simplifies integrating PayPal payments into your mobile app. Key features include seamless in-app PayPal integration
2.0.1 #
๐งฉ Unified V1 + V2 API with shared models and services
This release builds on top of the V2 Orders support and introduces a unified, version-aware API that can handle both PayPal Payments API V1 and Orders API V2 from a single, clean interface.
โจ New Features #
- Added shared abstract base types:
PaypalServicesBasePayPalOrderRequestBase
- New unified checkout widget:
PaypalCheckoutView- Explicit
version: PayPalApiVersion.v1 | PayPalApiVersion.v2
- Shared payment result model:
PaypalPaymentModel(used for both V1 & V2 flows)
- Version-aware order models:
PayPalOrderRequestV1(Payments API v1)PayPalOrderRequestV2(Orders API v2)
- Clear client-side handling of:
- V1 โ
executepayment usingPayerID - V2 โ
captureorder usingorderId
- V1 โ
- Added
PayPalAllowedPaymentMethodV1enum andPayPalPaymentOptionsV1model for:UNRESTRICTEDINSTANT_FUNDING_SOURCEIMMEDIATE_PAY
๐งช New Example Screen #
- Demo screen with two buttons:
- โPay with PayPal (V2 โ Orders API)โ
- Uses
PayPalOrderRequestV2, purchase units, amount, items, and shipping address.
- Uses
- โPay with PayPal (V1 โ Payments API)โ
- Uses
PayPalOrderRequestV1andPaypalTransactionV1.
- Uses
- โPay with PayPal (V2 โ Orders API)โ
- Includes inline help explaining:
- When to use V1 vs V2
- Why backend-created orders are recommended in production
- Why putting
clientId/secretKeyin the app is sandbox-only
๐ Safety & Validation #
- Runtime check to prevent:
- Passing a
PayPalOrderRequestV1into a V2 service - Passing a
PayPalOrderRequestV2into a V1 service
โ returns a clearORDER_VERSION_MISMATCHerror.
- Passing a
- Centralized checks for:
- Empty transactions (V1)
- Empty purchase units (V2)
- Null
payPalOrderwhen required
โ ๏ธ Breaking / Deprecation Notes #
PaypalCheckoutViewV1andPaypalCheckoutViewV2are now superseded by the newPaypalCheckoutView.- They can still work internally, but the recommended usage is the unified widget with
version+PayPalOrderRequestBase.
- They can still work internally, but the recommended usage is the unified widget with
- Developers should migrate:
- From direct V1/V2 widgets โ to
PaypalCheckoutView(version: PayPalApiVersion.v1 | v2, ...). - From old loosely-typed maps โ to strongly-typed
PayPalOrderRequestV1/PayPalOrderRequestV2.
- From direct V1/V2 widgets โ to
2.0.0 #
๐ Major rewrite with full PayPal Orders API v2 support
This release introduces a complete overhaul of the payment flow, API models, and service structure. โ ๏ธ Breaking changes included.
โจ New Features #
- Added PayPal Orders API V2 support (create order + capture).
- Strongly-typed request/response models:
PayPalOrderRequestV2PaypalPaymentModelV2PayPalCaptureOrderResponse
- Added full enums for:
shipping_preferencepayment_method_preferencelanding_pageuser_actionitem.category
- Added safer custom URL scheme defaults (
paypal-sdk://success,paypal-sdk://cancel) for return/cancel handling. - Support both secure and insecure flows:
- Secure (recommended): Backend creates order & handles capture.
- Client-side (testing only): App creates order and captures it.
- Improved WebView behavior & progress UI.
๐ Security Improvements #
- Added strict protection against exposing PayPal
clientIdandsecretKeyin production. - New flag:
overrideInsecureClientCredentialsto bypass security (sandbox/testing only). - Added checks preventing live-mode token generation without backend.
๐ง Enhancements #
- More reliable approval link extraction (
approveandpayer-action). - Better error models and error surface handling.
- Cleaner separation between backend-driven and client-driven flows.
- More descriptive callback models for success, error, and cancel events.
โ ๏ธ Breaking Changes #
- Old V1 models and flows removed or renamed.
PaypalPaymentModelreplaced withPaypalPaymentModelV2.executePaymentreplaced with order capture.- Removed reliance on
PayerID(not used in PayPal V2). - Package API simplified and reorganized.
1.0.8 #
This package simplifies integrating PayPal payments into your mobile app. Key features include:
- Seamless in-app PayPal WebView checkout
- User-friendly payment flow
- Secure transaction handling
- Customizable UI components
- Real-time payment status updates
Future enhancements include more payment options, fraud protection, subscription support, and analytics improvements.