Skip to content

Commit 37e9509

Browse files
committed
payment (zarinpal) - not complete
1 parent 38e94eb commit 37e9509

File tree

9 files changed

+891
-9
lines changed

9 files changed

+891
-9
lines changed

app/Http/Controllers/CartController.php

+42
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,48 @@
55
use Illuminate\Http\Request;
66
use Illuminate\Support\Facades\Auth;
77
use App\Models\Cart;
8+
use Shetabit\Multipay\Invoice;
9+
use Shetabit\Payment\Facade\Payment;
10+
11+
12+
// Create new invoice.
13+
$invoice = new Invoice;
14+
15+
// Set invoice amount.
16+
$invoice->amount(1000);
17+
18+
// Add invoice details: There are 4 syntax available for this.
19+
// 1
20+
$invoice->detail(['detailName' => 'your detail goes here']);
21+
// 2
22+
$invoice->detail('detailName','your detail goes here');
23+
// 3
24+
$invoice->detail(['name1' => 'detail1','name2' => 'detail2']);
25+
// 4
26+
$invoice->detail('detailName1','your detail1 goes here')
27+
->detail('detailName2','your detail2 goes here');
28+
29+
// Create new invoice.
30+
$invoice = (new Invoice)->amount(1000);
31+
32+
// Purchase the given invoice.
33+
Payment::purchase($invoice,function($driver, $transactionId) {
34+
// We can store $transactionId in database.
35+
});
36+
37+
// Purchase method accepts a callback function.
38+
Payment::purchase($invoice, function($driver, $transactionId) {
39+
// We can store $transactionId in database.
40+
});
41+
42+
// You can specify callbackUrl
43+
Payment::callbackUrl('http://yoursite.com/verify')->purchase(
44+
$invoice,
45+
function($driver, $transactionId) {
46+
// We can store $transactionId in database.
47+
}
48+
);
49+
850

951
class CartController extends Controller
1052
{

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"laravel/framework": "^8.75",
1212
"laravel/sanctum": "^2.11",
1313
"laravel/tinker": "^2.5",
14+
"shetabit/payment": "^4.3",
1415
"unisharp/laravel-filemanager": "^2.5"
1516
},
1617
"require-dev": {

composer.lock

+257-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)