Skip to content
payticPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Payments

Latest Version on Packagist Latest Stable Version Latest Unstable Version Software License

Build Status Quality Score StyleCI Total Downloads

Stored-card and token billing

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.

Inspiration

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages