Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/mahmoudsayed96/opay
- Owner: MahmoudSayed96
- Created: 2022-05-20T18:07:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-20T18:09:38.000Z (over 2 years ago)
- Last Synced: 2024-11-22T17:34:28.212Z (2 months ago)
- Topics: cms, drupal, drupal-8, module, php
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)