@allecosystems/epay
v0.1.1
Published
Epay payment gateway for Vendure
Readme
ePay Payment Plugin for Vendure
A Vendure plugin that integrates ePay payment gateway for processing online payments.
Features
- Process payments through ePay gateway
- Store payment transaction details
- Handle payment webhooks
Installation
npm install @allecosystems/epayUsage
Add the plugin to your Vendure configuration:
import { EpayPlugin } from '@allecosystems/epay';
export const config: VendureConfig = {
// ... other config
plugins: [
EpayPlugin.init({
// Plugin options here
}),
],
};Configuration
The plugin accepts the following configuration options:
apiKey: Your ePay API keyPoint of sale ID: Your ePay Point of sale IDPAI URL: Keep it at the default https://payments.epay.eu/public/api/v1/citWebhook URL: Must be yourVENDURE_URL/epay/webhookSuccess URL: The order success page of your storefrontFailure URL: The order failure page of your storefront
Frontend Integration
When a payment is initiated with the ePay payment method, the plugin returns a redirect URL. Your frontend must redirect the customer to this URL to complete the payment.
After calling addPaymentToOrder, check the returned order's last payment for redirect information:
// Get the last payment from the order
const payments = order?.payments || [];
const lastPayment = payments[payments.length - 1];
// Check if payment requires redirect
if (lastPayment?.metadata?.public?.requiresRedirect) {
const redirectUrl = lastPayment.metadata.public.redirectUrl;
if (redirectUrl) {
// Redirect customer to ePay payment page
window.location.href = redirectUrl;
}
}Payment Object Structure
The payment metadata contains:
lastPayment.metadata.public.requiresRedirect- Boolean indicating if redirect is neededlastPayment.metadata.public.redirectUrl- The ePay payment URL to redirect to
Payment Flow
- Customer initiates payment with
addPaymentToOrderusing method'epay-payment' - Plugin creates ePay session and returns redirect URL in payment metadata
- Frontend redirects customer to ePay payment page
- Customer completes payment on ePay's secure page
- ePay redirects customer back to your configured success/failure URLs
- ePay sends webhook to confirm payment status
License
GPL-3.0-or-later
Support
For any support inquiries please contact Alleco Systems at [email protected]
