Use Paytic\Payments\Actions\Purchases\ChargePurchaseWithToken::for($purchase, $token)
to charge a purchase using a saved token. Select the token's payment method on the
purchase first. The action verifies the billing customer's ID and morph type,
payment method, expiration and cooldown, records the token-backed transaction,
and uses the same charging and notification workflow as subscriptions.
Gateways providing purchaseWithToken retain their existing behavior. Other
Omnipay gateways use purchase with cardReference (the stored token ID) instead
of card data. The gateway must support stored-card purchases; supportsPurchase
alone does not guarantee this. Redirect and pending responses must be completed
through the application's existing confirmation/notification flow.
Frontend purchase controllers can use
Paytic\Payments\Bundle\Frontend\Controllers\PaymentMethodsControllerTrait.
Implement getAvailablePaymentMethods($purchase): iterable with the methods
allowed for that purchase/customer. The paymentMethods() action exposes
item, payment_methods and customer-scoped payment_tokens in the payload.
Render /payments-methods/modules/selection inside your checkout form to show
saved tokens alongside other methods, using payment_source values of
token:<database ID> or method:<database ID>. No raw token IDs are submitted.
From your authenticated, CSRF-protected POST handler, resolve the authorized
purchase and call the trait's chargePurchaseWithToken($purchase, $tokenId) for
a token selection. It rechecks the available methods and customer ownership
before selecting the method and charging. Keep the existing checkout path for
ordinary payment methods. The trait deliberately does not add a charging GET
endpoint or replace application-specific authorization.
- https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Payment/Model/Payment.php
- https://github.com/DarvinStudio/DarvinPaymentBundle
- https://github.com/Payum/PayumBundle
- https://github.com/activecollab/payments
- https://github.com/MakingCG/saas-billing
- https://github.com/gvidas/subcription
- https://github.com/ptuchik/billing