Installation
Require the Composer package
Configure the service
Add the Opayo credentials toconfig/services.php.
Publish the configuration
This will publish the configuration underconfig/lunar/opayo.php.
Publish the views (optional)
The Opayo addon includes Blade and Livewire components for checkout. To customize these views, publish them.Enable the driver
Set the driver inconfig/lunar/payments.php.
Configuration
The following options are available inconfig/lunar/opayo.php.
The Opayo API endpoint is determined by the
services.opayo.env value.
Backend Usage
Get a merchant session key
A merchant session key is required before tokenizing card details on the client side.Authorize a payment
Capture a deferred payment
When using thedeferred policy, payments must be captured separately after authorization.
Refund a payment
Retrieve a transaction
Fetch transaction details from the Opayo API. This method includes retry logic with up to 4 attempts.3D Secure Authentication
When authorizing a payment, Opayo may require 3D Secure (3DS) authentication. The authorization response indicates whether a challenge is needed.Handling the 3DS response
ThreeDSecureResponse contains the following properties:
Completing the 3DS challenge
After the customer completes the 3DS challenge on the storefront, authorize the payment again with the challenge response data. For 3DS 2.x:Saved Cards
Authenticated users can save their card details for future purchases. The addon stores card tokens (not actual card details) in theopayo_tokens table.
Saved payments must be enabled on the Opayo account before this feature can be used.
Saving a card
Pass thesaveCard data key when authorizing a payment.
opayo_tokens table associated with the authenticated user. If a token already exists with the same last four digits for that user, it is replaced.
Using a saved card
To pay with a previously saved card, pass the token as thecard_identifier and set reusable to true.
HasOpayoTokens trait
Add theHasOpayoTokens trait to the User model to access saved card tokens.
opayoTokens relationship.