-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8229255
Showing
50 changed files
with
2,548 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dist | ||
/vendor | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 4, | ||
"semi": false, | ||
"singleQuote": false, | ||
"endOfLine": "auto", | ||
"bracketSameLine": true, | ||
"html.format.wrapAttributes": "auto", | ||
"html.format.wrapLineLength": 0, | ||
"printWidth": 1000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 MOHAMMED BOUBAZINE | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Introduction | ||
|
||
Package supports multi payments gateways (All in one Package) for PHP | ||
|
||
# Instalation | ||
|
||
- you can install the package via composer | ||
|
||
```bash | ||
composer require medboubazine/pay | ||
``` | ||
|
||
# Documentation | ||
|
||
[Documentation](./docs/index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "medboubazine/pay", | ||
"type": "library", | ||
"description": "All In One . PHP Library for Payment Gateways", | ||
"keywords": [ | ||
"php", | ||
"payment-gateway", | ||
"paypal-checkout", | ||
"paysera-checkout", | ||
"chargily-pay", | ||
"binance-pay" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Medboubazine", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"paypal/rest-api-sdk-php": "^1.14", | ||
"illuminate/support": "^10.3", | ||
"rakit/validation": "^1.4", | ||
"webtopay/libwebtopay": "^1.8", | ||
"medboubazine/chargily-checkout": "^1.1", | ||
"medboubazine/binance-pay": "^1.0", | ||
"nesbot/carbon": "^2.66" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Medboubazine\\Pay\\": "src/" | ||
} | ||
}, | ||
"require-dev": { | ||
"symfony/var-dumper": "^6.2", | ||
"symfony/error-handler": "^6.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Supported Payment methods | ||
|
||
The package supports the following gateways | ||
|
||
- Paypal | ||
- Paysera | ||
- Chargily Pay (EDAHABIA , CIB) | ||
- Binance Pay (Crypto Currencies) | ||
|
||
# Documentation | ||
|
||
- [Paypal](./payment_methods/paypal.md) | ||
- [Paysera](./payment_methods/paysera.md) | ||
- [Chargily Pay](./payment_methods/chargily_pay.md) | ||
- [Binance Pay](./payment_methods/binance_pay.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Payment Method: Binance Pay | ||
|
||
## Create payment | ||
|
||
```php | ||
$pay = new Pay(); | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setEnv("");//'sandbox' for testing OR 'live' for production | ||
$credentials->setApiKey("");// Api Key | ||
$credentials->setSecretKey("");//Secret Key | ||
$credentials->setPaymentExpirationTime(60 * 30); //Paymen Expiration in seconds | ||
|
||
$attributes = new Attributes(); | ||
|
||
$attributes->setOrderId("");//Order ID Must Be UNIQUE | ||
$attributes->setAmount("");//Amount | ||
$attributes->setCurrency("");//BUSD or USDT | ||
$attributes->setDescription("");//Order Description | ||
$attributes->setBackUrl("");//Back Url (Must be Active Url) | ||
$attributes->setProcessUrl("");//Payment Processing Url (Must be Active Url) | ||
|
||
|
||
$payment = Pay::createPayment(Pay::PM_BINANCE_PAY, $credentials, $attributes); | ||
|
||
|
||
if ($payment) { | ||
$payment_id = $payment->getId(); | ||
$url = $payment->getId(); | ||
//redirect to url | ||
} else { | ||
// "Payment creation failed | ||
} | ||
|
||
``` | ||
|
||
## Process payment | ||
|
||
```php | ||
|
||
$pay = new Pay(); | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setApiKey(""); | ||
$credentials->setSecretKey(""); | ||
|
||
$attributes = new Attributes(); | ||
|
||
|
||
$payment = Pay::processPayment(Pay::PM_BINANCE_PAY, $credentials, $attributes); | ||
|
||
if($payment){ | ||
if($payment->getStatus() === "approved"){ | ||
//payment is confirmed | ||
}elseif($payment->getStatus() === "canceled"){ | ||
//payment is canceled | ||
}else($payment->getStatus() === "failed"){ | ||
//payment is failed | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Payment Method: Chargily Pay | ||
|
||
## Create payment | ||
|
||
```php | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setApiKey("");// Api Key | ||
$credentials->setSecretKey("");// Secret Key | ||
|
||
$attributes = new Attributes(); | ||
|
||
$attributes->setOrderId("");//Order/Invoice ID | ||
$attributes->setClientFullName("");//Client Fullname/username | ||
$attributes->setClientEmail("");//client email | ||
$attributes->setAmount("");//Amount | ||
$attributes->setDiscount("");//Discount | ||
$attributes->setMethod("");//DAHABIA or CIB | ||
$attributes->setDescription("");//Order Description | ||
$attributes->setBackUrl("");//Back Url (Must be Active Url) | ||
$attributes->setProcessUrl("");//Payment Processing Url (Must be Active Url) | ||
|
||
|
||
$payment = Pay::createPayment(Pay::PM_CHARGILY_PAY, $credentials, $attributes); | ||
|
||
|
||
|
||
if ($payment) { | ||
$payment_id = $payment->getId(); | ||
$url = $payment->getId(); | ||
//redirect to url | ||
} else { | ||
// "Payment creation failed | ||
} | ||
|
||
``` | ||
|
||
## Process payment | ||
|
||
```php | ||
|
||
$pay = new Pay(); | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setApiKey(""); | ||
$credentials->setSecretKey(""); | ||
|
||
$attributes = new Attributes(); | ||
|
||
$payment = Pay::processPayment(Pay::PM_CHARGILY_PAY, $credentials, $attributes); | ||
|
||
if($payment){ | ||
if($payment->getStatus() === "approved"){ | ||
//payment is confirmed | ||
}elseif($payment->getStatus() === "canceled"){ | ||
//payment is canceled | ||
}else($payment->getStatus() === "failed"){ | ||
//payment is failed | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Payment Method: Paypal | ||
|
||
## Create payment | ||
|
||
```php | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setEnv("sandbox"); //sandbox OR live | ||
$credentials->setApiKey(""); //Your paypal Api Key | ||
$credentials->setSecretKey(""); //Your paypal Api Key | ||
$credentials->setLogEnabled(false); | ||
//if logEnabled set is true uncoment next line | ||
//$credentials->setLogPath(__DIR__ . "/log/paypal_log.log"); | ||
|
||
$attributes = new Attributes(); | ||
|
||
$attributes->setAmount("10"); | ||
$attributes->setCurrency("USD"); | ||
$attributes->setDescription("Order Amount"); | ||
$attributes->setProcessUrl("/dist/process.php"); // Payment process page | ||
$attributes->setBackUrl("/back.php"); | ||
|
||
$payment = Pay::createPayment(Pay::PM_PAYPAL, $credentials, $attributes); | ||
|
||
if ($payment) { | ||
$payment_id = $payment->getId(); | ||
$url = $payment->getId(); | ||
//redirect to url | ||
} else { | ||
// "Payment creation failed | ||
} | ||
|
||
``` | ||
|
||
## Process payment | ||
|
||
```php | ||
$pay = new Pay(); | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setEnv(""); | ||
$credentials->setApiKey(""); | ||
$credentials->setSecretKey(""); | ||
$credentials->setLogEnabled(false); | ||
$credentials->setLogPath(__DIR__ . "/log/paypal_log.log"); | ||
|
||
$attributes = new Attributes(); | ||
$attributes->setAcceptOnlyVerifiedAccounts(false); | ||
|
||
$payment = Pay::processPayment(Pay::PM_PAYPAL, $credentials, $attributes); | ||
|
||
if($payment){ | ||
if($payment->getStatus() === "approved"){ | ||
//payment is confirmed | ||
}elseif($payment->getStatus() === "canceled"){ | ||
//payment is canceled | ||
}else($payment->getStatus() === "failed"){ | ||
//payment is failed | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Payment Method: Paysera | ||
|
||
## Create payment | ||
|
||
```php | ||
$pay = new Pay(); | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setEnv("");//'sandbox' for testing Or 'live' for production | ||
$credentials->setProjectId("");//Project Id | ||
$credentials->setSignPassword("");//Sign password | ||
|
||
$attributes = new Attributes(); | ||
|
||
$attributes->setOrderId("");//Order/Invoice Number | ||
$attributes->setAmount("");//Amount | ||
$attributes->setCurrency("");//Currency | ||
$attributes->setCountry("");//Country | ||
$attributes->setBackUrl("");//Back Url | ||
$attributes->setProcessUrl("");//Payment Processing url | ||
|
||
|
||
$payment = Pay::createPayment(Pay::PM_PAYSERA, $credentials, $attributes); | ||
|
||
if ($payment) { | ||
$payment_id = $payment->getId(); | ||
$url = $payment->getId(); | ||
//redirect to url | ||
} else { | ||
// "Payment creation failed | ||
} | ||
|
||
``` | ||
|
||
## Process payment | ||
|
||
```php | ||
$pay = new Pay(); | ||
|
||
$credentials = new Credentials(); | ||
|
||
$credentials->setProjectId(""); | ||
$credentials->setSignPassword(""); | ||
|
||
$attributes = new Attributes(); | ||
|
||
$attributes->setAllowTestPayments(false); | ||
$attributes->setAcceptOnlyMacroPayments(true); | ||
|
||
$payment = Pay::processPayment(Pay::PM_PAYSERA, $credentials, $attributes); | ||
|
||
|
||
if($payment){ | ||
if($payment->getStatus() === "approved"){ | ||
//payment is confirmed | ||
}elseif($payment->getStatus() === "canceled"){ | ||
//payment is canceled | ||
}else($payment->getStatus() === "failed"){ | ||
//payment is failed | ||
} | ||
} | ||
|
||
``` |
Oops, something went wrong.