Payment Provider Development
Use this skill for any WelineFramework task that creates, migrates, reviews, or documents a payment method module connected to Weline_Payment.
Primary References
Load these files only as needed:
app/code/Weline/Payment/doc/provider-development.md: third-party module workflow and production checklist.
app/code/Weline/Payment/doc/extends.md: compact extension examples.
app/code/Weline/Payment/doc/需求.md: full payment architecture requirements and open gaps.
app/code/Weline/Payment/Interface/ProviderInterface.php: required Provider contract.
app/code/Weline/Payment/Interface/PayableResolverInterface.php: Payable object contract.
app/code/Weline/Payment/Helper/PaymentMethodAttributeHelper.php: helper for declaring and reading ordinary payment-method EAV attributes by method code.
app/code/Weline/Payment/extends/module/Weline_Payment/PaymentProvider/FakeProvider.php: local fake Provider example.
app/code/Weline/Payment/extends/module/Weline_SystemConfig/Config/backend/fake_card.phtml: SystemConfig template example.
Workflow
- Confirm the payment method code and keep it identical across Provider
getCode(), checkout template code, config template file, SystemConfig keys, and payment method EAV ownership.
- Implement exactly one Provider class under
extends/module/Weline_Payment/PaymentProvider/ and make it implement Weline\Payment\Interface\ProviderInterface. Do not introduce a Provider abstract base class for third parties.
- Implement every ProviderInterface method: availability, create/resume payment, authorize, capture, void, refund, query, callback verify/parse, connection test, and error normalization.
- Declare Provider capabilities as the hard upper bound: supported currencies, default currency, supported countries, refund types, authorization/capture, saved instruments, offline confirmation, language support, amount limits, and dynamic fields.
- Add the backend config phtml under
extends/module/Weline_SystemConfig/Config/backend/{method_code}.phtml. Ordinary fields must use payment/method/{method_code}/{field} keys and be managed by Weline_SystemConfig, not a payment-module save controller.
- Add or document the checkout phtml under
view/templates/Frontend/checkout/{method_code}.phtml. The template displays method-specific UI only; payment creation still goes through Weline_Payment.
- If the payable object is not a simple one-time payment, implement or route to a
PayableResolverInterface resolver. Payment must not directly mutate order, app-market, A2A, escrow, fulfillment, or entitlement state.
- Treat payment/refund operations as ledgered, locked, and idempotent. Require stable codes for intent, attempt, transaction, refund, allocation, and provider reference.
- For asset-like methods or payment discounts, enforce the configured role per payable. Credit, points, and W Coin are disabled by default and require exchange ratio plus explicit payment or discount enablement.
- For ordinary provider-specific method attributes, use
PaymentMethodAttributeHelper and existing EAV type codes such as input_string; keep secrets in encrypted SystemConfig fields.
- Verify with the nearest safe commands, then run route sync and Browser fake-mode smoke when the task affects visible checkout or payment flow.
Guardrails
- The payment route prefix is
payment, not weline_payment.
- No old payment interface compatibility is assumed.
- Provider configuration is scope-aware through
Weline_SystemConfig; Provider modules only provide phtml templates and special controllers when needed.
- A payment method unsupported for the payable currency or user country must not be selectable in checkout. It may appear only in the disabled "more methods" view with a reason.
- Payment method EAV attributes are for ordinary provider-specific metadata. Attribute code must be provider-prefixed and owned by the same method code used by Provider/config/checkout.
- Do not store secrets in docs, logs, EAV, screenshots, or visible templates. Use encrypted SystemConfig fields for secrets.
- Do not claim global payment readiness unless fake-mode Browser validation and the specific Provider payment/refund paths were actually executed.
Validation Commands
Use focused validation first:
php -l app/code/Vendor/Module/extends/module/Weline_Payment/PaymentProvider/{Provider}.php
php -l app/code/Vendor/Module/extends/module/Weline_SystemConfig/Config/backend/{method_code}.phtml
php bin/w setup:upgrade --route
php bin/w route:list
php bin/w http:request /payment/frontend/checkout/fake
For browser-visible checkout changes, start a non-9501 WLS instance and stop it after verification:
php bin/w server:start -p 9506 -n ai-test-payment-fake
php bin/w server:stop -n ai-test-payment-fake
1---2name: payment-provider-development3description: Use when developing or reviewing a third-party payment provider module for Weline_Payment, including ProviderInterface implementation, checkout phtml, SystemConfig config phtml, PayableResolver boundaries, payment/refund idempotency, scope-aware configuration, currency/country support, and fake-mode validation.4---56# Payment Provider Development78Use this skill for any WelineFramework task that creates, migrates, reviews, or documents a payment method module connected to `Weline_Payment`.910## Primary References1112Load these files only as needed:1314- `app/code/Weline/Payment/doc/provider-development.md`: third-party module workflow and production checklist.15- `app/code/Weline/Payment/doc/extends.md`: compact extension examples.16- `app/code/Weline/Payment/doc/需求.md`: full payment architecture requirements and open gaps.17- `app/code/Weline/Payment/Interface/ProviderInterface.php`: required Provider contract.18- `app/code/Weline/Payment/Interface/PayableResolverInterface.php`: Payable object contract.19- `app/code/Weline/Payment/Helper/PaymentMethodAttributeHelper.php`: helper for declaring and reading ordinary payment-method EAV attributes by method code.20- `app/code/Weline/Payment/extends/module/Weline_Payment/PaymentProvider/FakeProvider.php`: local fake Provider example.21- `app/code/Weline/Payment/extends/module/Weline_SystemConfig/Config/backend/fake_card.phtml`: SystemConfig template example.2223## Workflow24251. Confirm the payment method code and keep it identical across Provider `getCode()`, checkout template code, config template file, SystemConfig keys, and payment method EAV ownership.262. Implement exactly one Provider class under `extends/module/Weline_Payment/PaymentProvider/` and make it implement `Weline\Payment\Interface\ProviderInterface`. Do not introduce a Provider abstract base class for third parties.273. Implement every ProviderInterface method: availability, create/resume payment, authorize, capture, void, refund, query, callback verify/parse, connection test, and error normalization.284. Declare Provider capabilities as the hard upper bound: supported currencies, default currency, supported countries, refund types, authorization/capture, saved instruments, offline confirmation, language support, amount limits, and dynamic fields.295. Add the backend config phtml under `extends/module/Weline_SystemConfig/Config/backend/{method_code}.phtml`. Ordinary fields must use `payment/method/{method_code}/{field}` keys and be managed by `Weline_SystemConfig`, not a payment-module save controller.306. Add or document the checkout phtml under `view/templates/Frontend/checkout/{method_code}.phtml`. The template displays method-specific UI only; payment creation still goes through `Weline_Payment`.317. If the payable object is not a simple one-time payment, implement or route to a `PayableResolverInterface` resolver. Payment must not directly mutate order, app-market, A2A, escrow, fulfillment, or entitlement state.328. Treat payment/refund operations as ledgered, locked, and idempotent. Require stable codes for intent, attempt, transaction, refund, allocation, and provider reference.339. For asset-like methods or payment discounts, enforce the configured role per payable. Credit, points, and W Coin are disabled by default and require exchange ratio plus explicit payment or discount enablement.3410. For ordinary provider-specific method attributes, use `PaymentMethodAttributeHelper` and existing EAV type codes such as `input_string`; keep secrets in encrypted SystemConfig fields.3511. Verify with the nearest safe commands, then run route sync and Browser fake-mode smoke when the task affects visible checkout or payment flow.3637## Guardrails3839- The payment route prefix is `payment`, not `weline_payment`.40- No old payment interface compatibility is assumed.41- Provider configuration is scope-aware through `Weline_SystemConfig`; Provider modules only provide phtml templates and special controllers when needed.42- A payment method unsupported for the payable currency or user country must not be selectable in checkout. It may appear only in the disabled "more methods" view with a reason.43- Payment method EAV attributes are for ordinary provider-specific metadata. Attribute code must be provider-prefixed and owned by the same method code used by Provider/config/checkout.44- Do not store secrets in docs, logs, EAV, screenshots, or visible templates. Use encrypted SystemConfig fields for secrets.45- Do not claim global payment readiness unless fake-mode Browser validation and the specific Provider payment/refund paths were actually executed.4647## Validation Commands4849Use focused validation first:5051```powershell52php -l app/code/Vendor/Module/extends/module/Weline_Payment/PaymentProvider/{Provider}.php53php -l app/code/Vendor/Module/extends/module/Weline_SystemConfig/Config/backend/{method_code}.phtml54php bin/w setup:upgrade --route55php bin/w route:list56php bin/w http:request /payment/frontend/checkout/fake57```5859For browser-visible checkout changes, start a non-9501 WLS instance and stop it after verification:6061```powershell62php bin/w server:start -p 9506 -n ai-test-payment-fake63php bin/w server:stop -n ai-test-payment-fake64```