https://github.com/webdna/commerce-opayo
Opayo payment gateway for Craft Commerce
https://github.com/webdna/commerce-opayo
Last synced: 4 months ago
JSON representation
Opayo payment gateway for Craft Commerce
- Host: GitHub
- URL: https://github.com/webdna/commerce-opayo
- Owner: webdna
- License: other
- Created: 2021-05-26T13:02:46.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-06-05T07:49:23.000Z (about 1 year ago)
- Last Synced: 2025-09-07T03:52:21.031Z (9 months ago)
- Language: PHP
- Size: 53.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README

Opayo for Craft Commerce
This plugin provides a [Opyao](https://www.opayo.co.uk/) integration for [Craft Commerce](https://craftcms.com/commerce).
## Requirements
This plugin requires Craft 3.6 and Craft Commerce 3.3 or later.
## Installation
You can install this plugin from the Plugin Store or with Composer.
#### From the Plugin Store
Go to the Plugin Store in your project’s Control Panel and search for Opayo for Craft Commerce”. Then click on the “Install” button in its modal window.
#### With Composer
Open your terminal and run the following commands:
```bash
# go to the project directory
cd /path/to/my-project.test
# tell Composer to load the plugin
composer require craftcms/commerce-opayo
# tell Craft to install the plugin
./craft install/plugin commerce-opayo
```
## Setup
To add an Opayo payment gateway, go to Commerce → Settings → Gateways, create a new gateway.
> **Tip:** The Vendor, Integration Key and Integration Password gateway settings can be set to environment variables. See [Environmental Configuration](https://docs.craftcms.com/v3/config/environments.html) in the Craft docs to learn more about that.
### Using the legacy basket format
Example implementation
```twig
{{ csrfInput() }}
{% set gateway = craft.commerce.gateways.getGatewayByHandle('opayo') %}
Submit
```
```js
function paymentFormSubmit(e) {
e.preventDefault();
// disable submit button
e.target.querySelector('button[type="submit"]').disabled = true;
sagepayOwnForm({
merchantSessionKey: e.target.querySelector('input[name="sessionKey"]').value
}).tokeniseCardDetails({
cardDetails: {
cardholderName: e.target.querySelector('[id="name"]').value,
cardNumber: e.target.querySelector('[id="cardnumber"]').value,
expiryDate: e.target.querySelector('[id="expiry"]').value,
securityCode: e.target.querySelector('[id="cvv"]').value,
},
onTokenised: function(result) {
if (result.success) {
e.target.querySelector('[name="nonce"]').value = result.cardIdentifier;
e.target.removeEventListener('submit', paymentFormSubmit);
e.target.submit();
} else {
alert(result.errors.join(', '));
}
}
});
}
document.getElementById('opayo-form').addEventListener('submit', paymentFormSubmit);
```