Comments (2)
اصولا Callback همواره برای یه جا صورت میگیره نه چند روت متفاوت
برای اینکار بهتر هست که یه تابع پرداخت داشته باشین که علاوه بر پارامتر مبلغ پارامتر calback_url رو هم بگیره و بعدش از طریق اون نسبت به ایجاد صورتحساب و پرداخت اقدام کنید.
برای مثال این تابع رو در نظر بگیرید
public function payment_request(Request $request)
{
$gateway ='nextpay';
$amount = 10000;
$callback = route('calback-api');
if( $request->has('gateway') && $request->gateway == null)
$gateway = $request->gateway;
if( $request->has('amount') && $request->amount == null)
$amount = $request->amount;
if( $request->has('callback') && $request->callback == null)
$callback = $request->callback;
return Payment::via($gateway)->callbackUrl($callback)->purchase(
(new Invoice)->amount($amount),
function($driver, $transactionId) use ($amount) {
$transaction = new Transaction();
$transaction->price = $amount;
$transaction->transaction_id = $transactionId;
$transaction->description = "افزایش اعتبار به مبلغ " . $amount . " تومان در سایت تست";
$transaction->save();
}
)->pay()->toJson();
}
from payment.
@salamzadeh
درود و سپاس از راهنمایی شما
بله به نتیجه مورد نظر رسیدم
پیروز باشید
from payment.
Related Issues (20)
- Method Illuminate\Support\Str::replace does not exist. HOT 5
- Check new pull request HOT 2
- درگاه به پرداخت HOT 1
- تغییر توضیحات ارسال به درگاه به پرداخت HOT 1
- نوع ستون transactionId رو در دیتابیس باید چی بزاریم؟ HOT 1
- Class "SoapClient" not found
- درگاه زرین پال - اشتباه ذخیره کردن بعضی از transaction_id ها یا همون authority زرین پال HOT 1
- خطا logout شدن کاربر HOT 1
- تنظیمات درایور دلخواه در کنترولر HOT 1
- خطای درگاه بانک ملی HOT 1
- خطای کال بک درگاه پارسیان HOT 12
- خطای cURL زرین پال
- Call to undefined method Illuminate\\View\\Compilers\\BladeCompiler::render() HOT 3
- مشکل کال بک درگاه پارسیان HOT 2
- مشکل در درگاه پی پینگ HOT 2
- مشکل در رندر کردن صورت حساب در هنگام استفاده از livewire HOT 1
- خطای 404 درگاه idpay HOT 2
- پیداکردن transaction در کال بک HOT 1
- از بین رفتن درگاه پرداخت دلخواه بعد از بروزرسانی شدن پکیج HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from payment.