karen6630/omnipay-ameria

Ameria gateway for Omnipay payment processing library

v1.0.0 2024-11-23 09:51 UTC

This package is auto-updated.

Last update: 2024-11-23 10:22:52 UTC


README

Ameria driver for the Omnipay Laravel payment processing library Added the ability to cancel payment CancelRequest

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.5+. This package implements Ameria support for Omnipay.

Installation

Omnipay is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "karen6630/omnipay-ameria": "dev-master"
    }
}

And run composer to update your dependencies:

composer update

Or you can simply run

composer require karen6630/omnipay-ameria

Basic Usage

  1. Use Omnipay gateway class:
    use Omnipay\Omnipay;
  1. Initialize Ameria gateway:
    $gateway = Omnipay::create('Ameria');
    $gateway->setClientId(env('AMERIA_CLIENT_ID'));
    $gateway->setUsername(env('AMERIA_USERNAME'));
    $gateway->setPassword(env('AMERIA_PASSWORD'));
    $gateway->setReturnUrl(env('AMERIA_RETURN_URL')); // Return url, that should be point to your ameria webhook route
    $gateway->setLanguage(\App::getLocale()); // Language
    $gateway->setAmount(10); // Amount to charge
    $gateway->setTransactionId(XXXX); // Transaction ID from your system
  1. Call purchase, it will automatically redirect to Ameria's hosted page
    $purchase = $gateway->purchase()->send();
    $purchase->redirect();
  1. Create a webhook controller to handle the callback request at your AMERIA_RESULT_URL and catch the webhook as follows
    $gateway = Omnipay::create('Ameria');
    $gateway->setUsername(env('AMERIA_USERNAME'));
    $gateway->setPassword(env('AMERIA_PASSWORD'));
    
    $purchase = $gateway->getOrderStatus()->send();
    
    // Do the rest with $purchase and response with 'OK'
    if ($purchase->isSuccessful()) {
        
        // Your logic
        
    }
    
    return new Response('OK');
  1. Added the ability to cancel payment CancelRequest
    public function cancel(array $parameters = array()): \Omnipay\Common\Message\AbstractRequest
    {
        return $this->createRequest('\Omnipay\Ameria\Message\CancelRequest', $parameters);
    }
	

For general usage instructions, please see the main Omnipay repository.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.