-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Description
The Square PHP SDK has undergone a full rewrite in its latest version 41.0.0.20250220, introducing simplified classes and method names for improved usability. While previous versions remain functional, migrating to the latest SDK ensures that this extension remains compatible with future Square API updates and can take advantage of new features.
The extension is currently using SDK version 35.1.0.20240320, so an update is required to align with the latest SDK structure.
Why This Is Needed
- Ensures long-term compatibility with Square API updates.
- Simplifies codebase by adopting the new streamlined class and method names.
- Unlocks new features available only in SDK v41+.
- Future-proofing – Square's documentation suggests that new API enhancements will be built on this updated SDK structure.
Migration Steps
1. Upgrade the Square SDK via Composer
- Update
composer.jsonto require the latest SDK version:"square/square-php-sdk": "^41.0.0"
- Run:
composer update square/square-php-sdk
2. Refactor Code to Align with New SDK Structure
- Class Name Changes:
- Update all instances where previous class names have changed.
- Example:
Square\Models\CreatePaymentRequest→Square\Payments\CreatePaymentRequest.
- Method Name Changes:
- Adjust method calls to reflect new naming conventions.
- Error Handling Updates:
- The new SDK introduces improved error-handling patterns—update exception handling accordingly.
3. Test Against WooCommerce Core & PHP Versions
- Ensure the extension functions correctly with:
- WooCommerce latest versions
- PHP 7.4, 8.0, 8.1, and 8.2
- Square sandbox & production environments
4. Review & Validate Migration Using Square's Official Docs
- Follow the Square PHP SDK Migration Guide.
- Ensure that all deprecated methods are replaced with their recommended alternatives.
Next Steps & Considerations
- Confirm all necessary class/method refactors from v35 → v41.
- Run full regression testing on payments, refunds, and order sync flows.
- Ensure compatibility with other WooCommerce extensions, such as Subscriptions and Pre-Orders.
- Update documentation to reflect SDK changes for future maintenance.
Metadata
Metadata
Assignees
Labels
No labels