Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mahmoudsayed96/opay

Drupal custom module to integrate with opay payment gateway using http client
https://github.com/mahmoudsayed96/opay

cms drupal drupal-8 module php

Last synced: 13 days ago
JSON representation

Drupal custom module to integrate with opay payment gateway using http client

Awesome Lists containing this project

README

        

# Opay
Custom drupal module make an integration with OPay payment gateway.

## Configurations
After install module go to `admin/config/system/opay`
- Set `Token`
- Set `Merchant Id`
- Set `API Base Url`

## Usage/Examples

```php
opayClient = \Drupal::service('opay.client');
}

/**
* Create opay payment action.
*/
public function pay(array $query = [], array $data = []) {
$body = [
"amount" => [
"currency" => "EGP",
"total" => $data['amount'] * 100,
],
"country" => "EG",
"product" => [
"description" => "description",
"name" => "name"
],
"reference" => time(),
"payMethod" => "BankCard",
'returnUrl' => $data['returnUrl'],
'callbackUrl' => $data['callbackUrl'],
'cancelUrl' => $data['cancelUrl'],
];
return $this->opayClient->request('POST', 'create',$query, $body);
}

}
```

## Reference
- [OPay](https://doc.opaycheckout.com/reference-code)

- [End-to-End Test](https://doc.opaycheckout.com/end-to-end-testing)

## Author

- [@MahmoudSayed96](https://www.github.com/MahmoudSayed96)