shetabit / payment Goto Github PK
View Code? Open in Web Editor NEWsimple laravel payment package , supports multiple drivers
License: MIT License
simple laravel payment package , supports multiple drivers
License: MIT License
به درگاه سداد وصل نمیشه و با اینکه کد 0 رو بر میگردونه اما ظاهرا body خالیه!
production.ERROR: دسترسی به صفحه مورد نظر امکان پذیر نمی باشد. (Shetabit\Payment\Exceptions\PurchaseFailedException(code: 0): دسترسی به صفحه مورد نظر امکان پذیر نمی باشد. at /xxxxx/vendor/shetabit/payment/src/Drivers/Sadad/Sadad.php:94
با سلام
پیرو بحث #76 مبلغ رو باید به ریال بفرستم درگاه و با تقسیم کردن مبلغ به ده مشکل حل نمیشه
اگر Amount رو از integer به float تغییر بدید مشکل حل میشه
یا اگر راه حل دیگه ای هستش بفرمایید
باتشکر
Payment's amount unit isn't equal in all of the drivers. for example in Zarinpal API amount unis is Toman, but in Payir it's Rial. I use these drivers both, and I have to check the selected gate for payment, then correct the amount based on the selected gate. It's better to fix it in the package.
Thanks a lot
سلام
برای درگاه پاسارگاد درایوری تنظیم نشده؟
use the below package clients
for gateway communications in order to Command-query seperation.
سلام مهدی جان
درگاه پی پال کی اضاف میشه ؟ به شدت منتظریم .
ممنون از این پکیج عالی و کاربردی حرف نداره
There is any error handling when using Purchase method to create transaction and get transactionId?
The Payment Gateway may return error code on create create transaction/payment method.
For example IDPay may return 403 / 405 / 406 HTTP status for errors.
ref: https://idpay.ir/web-service/v1.1/index.html#2c82b7acb2
سلام
من برای تست در داخل روت کد های شمارو وارد کردم و در کانفیگ هم تنظیمات اوکی کردم. .
اما متاسفانه این قسمت را پیدا نمیکند
Payment::purchase
و خطای زیر را می دهد
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class 'Shetabit\Payment\Facade\Payment' not found
ممنون میشم کمک کنید یا نمونه پروژه ای که قبلا از این درگاه استفاده کرده را قرار دهید.
use Shetabit\Payment\Exceptions\InvalidPaymentException;
use Shetabit\Payment\Facade\Payment;
use Shetabit\Payment\Invoice;
Route::get('/pay', function () {
return Payment::purchase(
(new Invoice)->amount(1000),
function ($driver, $transactionId) {
// store transactionId in database.
// we need the transactionId to verify payment in future
}
)->pay();
});
Route::any('/verify', function ($transaction_id = 1) {
try {
Payment::amount(1000)->transactionId($transaction_id)->verify();
} catch (InvalidPaymentException $exception) {
/**
* when payment is not verified , it throw an exception.
* we can catch the excetion to handle invalid payments.
* getMessage method, returns a suitable message that can be used in user interface.
**/
echo $exception->getMessage();
}
});
hi, what's wrong when installing payment ?
[InvalidArgumentException] Package shetabit/payment at version has a PHP requirement incompatible with your PHP version (7.1.29)
Hi
I have problem with this in first step using Zarinpal
driver. every thing is ok until I want to get refid
from zarinpal after verify transaction.
I got this error
"message": "Call to undefined method Shetabit\\Payment\\PaymentManager::getReferenceId()",
"exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
I implement similar code in example verify section.
code is here ...
public function callbackZarinpal(Request $request)
{
$request->validate([
'Authority' => 'required',
'Status' => 'required'
]);
try {
if ($request->get('Status') !== 'OK'){
return $this->customError('تراکنش ناموفق', 405);
}
$payment = \App\Models\Payment::where('au', $request->get('Authority'))->first();
if (!$payment){
return $this->customError('فاکتور یافت نشد. هزینه پرداختی طی 72 ساعت به حساب شما بزارگردادنده خواهد شد.', 403);
}
$receipt = Payment::amount($payment->amount)->transactionId($payment->au)->verify();
// you can show payment's referenceId to user
echo $receipt->getReferenceId(); // <--- Error is here
} catch (InvalidPaymentException $exception) {
return $this->customError($exception->getMessage(), 403);
} catch (\Exception $e) {
return $this->customError($e->getMessage(), 403);
}
}
Hi! I'm trying to run your package on laravel 5.8 using docker (laradock).
There seems to be a problem in Payment class:
protected function loadDefaultConfig() : array
{
dd(static::getDefaultConfigPath());
return require(static::getDefaultConfigPath());
}
When I dd static::getDefaultConfigPath() here, I get the path to the config file of the package instead of my published vendor file which I have configured.
I tried removing my own config file and republishing vendor. I also tried clearing cache and config with artisan commands. But my own config file is not applied at all!
Hello
Thanks for your helpful package!
Can you give an example of a database structure for this package?
عدم نصب روی لاراول 5.6
متاسفانه با اینکه لاراول 5.6 بسیار پرکاربرده ولی این پکیج روی لاراول 5.6 نصب نمیشه
حداقل لاراول 5.8 باید باشه
Hi,
I use this package to handle my payments using behpardakht gateway. I got this error :
Symfony\Component\Debug\Exception\FatalThrowableError
Wrong parameters for Shetabit\Payment\Exceptions\PurchaseFailedException([string $message [, long $code [, Throwable $previous = NULL]]])
please help me.Thanks.
سلام وقت بخیر
من کوئری های ریدایرکت شده از زرین پال به روت ویو جِی اس رو دریافت و درقالب متد
POST
به روت لاراول ارسال میکنم.
ولی با متد زیر:
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Shetabit\Multipay\Invoice;
use Shetabit\Payment\Facade\Payment;
use Shetabit\Multipay\Exceptions\InvalidPaymentException;
/**
* Verify Payment
*
* @param Illuminate\Http\Request authority
*/
public function verify_payment(Request $request) {
try {
$receipt = Payment::transactionId($request->authority)->verify();
// Add a Membership For user
// ...
// You can show payment referenceId to the user.
return response()->json(['success' => true, 'refs' => $receipt->getReferenceId()]);
} catch (InvalidPaymentException $exception) {
/**
when payment is not verified, it will throw an exception.
We can catch the exception to handle invalid payments.
getMessage method, returns a suitable message that can be used in user interface.
**/
return response()->json(['success' => false, 'catch' => $exception->getMessage()], 500);
}
}
هیچوقت وریفای نمیشه و متن
عملیات پرداخت توسط کاربر لغو شد
رو برام ارسال میکنه.
این متد در حالت سندباکس و نرمال چک شده!
پرداخت انجام میشه یا عملیات موفقیت آمیزه اما وریفای به مشکل میخوره
ورژن shetabit/multipay:
"name": "shetabit/multipay", "version": "v1.0.6",
ورژن shetabit/payment:
"name": "shetabit/payment", "version": "v4.0.1",
ورژن لاراول:
7.4
مشکل از کجاست؟؟
Hi
Is there any method for setDescription for each payment Request?
thanks
سلام
درگاه رو همونطوری که نوشته بودید ست کردم . زمانی که ارسال میشه برای پرداخت خطا میده که
تراکنش توسط خریدار کنسل شده است.
درگاه sep رو استفاده میکنم
هرکاری میکنم
config/payment.php
ایجاد نمیشه . فایلشم هیچ جا نیست که بتونم حتی کپی هم بگیرم ازش
سلام من طبق مثال ها عمل کردم ولی متاسفانه انتقال نمیده به صفحه بانک
کد 301 میده ولی اتفاقی نمیفته
سلام
من پکیج شما رو نصب کردم. روی درگاه زرین پال وقتی متد پرداخت رو اجرا میکنم همه چیز درست کار میکنه. بعد زمانی که ویریفای رو اجرا میکنم با خطای
عملیات پرداخت توسط کاربر لغو شد
مواجه میشم.
درضمن دارم روی لوکال کارمیکنم و
sandbox
زرین پال رو تست کردم.
لطفا کمک کنید، ممنون
pay:
$paymentInvoice = new Invoice();
$paymentInvoice->amount($amount->totalPay);
$paymentInvoice->uuid($invoiceid->id);
$result = Payment::purchase($paymentInvoice, function($driver, $transactionId) use($invoiceid){ })->pay()->toJson();
return json_decode($result);
verify:
$receipt = Payment::transactionId($token)->verify();
result:
message: 'عملیات پرداخت توسط کاربر لغو شد.'
Package shetabit/payment at version has a PHP requirement incompatible with your PHP version (7.1.30)
چرا باید همچین مشکلی داشته باشه آخه؟
$invoice = (new Invoice)->amount( 1000);
$invoice->detail(['course' =>'yyy']);
Payment::callbackUrl('http:://verify')->purchase(
$invoice,
function($driver, $transactionId) {
global $input;
$input['transactionId']= $transactionId;
$result=Invoice::create($input);
}
)->pay();
این ارور رو میده
در صورتی که من از درگاه idpay استفاده میکنم و لاراول من ۶ هست.
Shetabit\Payment\Exceptions\PurchaseFailedException
وب سرویس تایید نشده است.
php artisan view:cache
not working
I have a issue on running php artisan view:cache
after install this package, It causes the following error:
The "/var/www/vendor/shetabit/payment/src/Provider/resources/views" directory does not exist.
i'm using vue and I don't need to publish blade file(s)
سلام، خسته نباشید
بعداز اینکه به درگاه بانک میرم، در بازگشت (هر حالتی) به صفحه کال بک ، متاسفانه با متن زیر روبه رو میشم:
Sorry, your session has expired. Please refresh and try again.
البته حتی در روت صفحه ارسال و دریافت رو مستقیم قرار دادم ولی باز این حالت پیش میاد
`Route::get('pay111',function(){
return \Shetabit\Payment\Facade\Payment::callbackUrl('http://localhost/shop/public/order_i')->purchase(
(new \Shetabit\Multipay\Invoice())->amount(1234),
function($driver, $transactionId) {
// store transactionId in database.
// we need the transactionId to verify payment in future
}
)->pay()->render();
});
Route::any('order_i', function (Request $request) {
dump($request);
});
`
لطفا راهنمایی بفرمایید
Hi
I gave this error
من این خطا رو میگیرم - ایشیو شماره 7 رو هم خوندم
همین مشکل رو داشتن ولی راه حلی داده نشده
الان خروجی که توی کالبک بهم برمیگردونه اینه
http://test.loc/zarinpal/annaul/callback/22086?Authority=100000000000000000000000000129647210&Status=NOK
همونطوری مشخصه authority فرستاده شده
ولی فانکشن نمیفهمه
دلیلش چی میتونه باشه
من خط به خط دنبال کردم
رسیدم به این خط
فایل
namespace Shetabit\Payment\Drivers;
فانکشن
verify(){
...
$response = $this->client->request(
'POST',
$this->settings->apiVerificationUrl,
['json' => $data]
);
}
اینجا به بعد دیگه جلو نمیره - ممنون میشم راهنمایی کنید
Hi
You implement getPaymentUrl as a protected method (Zarinpal Driver in my case).
In some implementation developers need to pass the full payment URL to client Side (maybe Vue) via API and redirect from client Browser.
is there any way to change getPaymentUrl as a public method ?
واقعیتش یه کم برای من گیج کننده است.
فرض کنید ما توی سایت قراره فایل بفروشیم
هر فایلی یه آیدی داره و بعد از پرداخت انتظار داریم برگردیم به صفحه مربوط به همون فایل
و بتونیم فایل رو دانلود کنیم
توی این حالت باید از این متد استفاده کنیم!
و قبلش باید تراکنش رو ذخیره کنیم و براساس آیدی تراکنش آدرس بازگشت رو بسازیم
حالا چطوری میتونیم توکنی که از سایت برمیگرده رو بذاریم توی دیتابیس با همون تراکنشی که ساختیم ؟
$transactionId
رو ذخیره کنیم توی تراکنشی که قبلا ساختیم و باهاش آدرس بازگشت ساختیم؟
return Payment::callbackUrl($url)->purchase(
$invoice,
function($driver, $transactionId ) {
// we can store $transactionId in database
}
)->pay();
سلام
وقت بخیر
آیا این سیستم
log
و
ثبت دیتا بیسی ندارد؟
با عرض تشکر و خسته نباشید از پکیج عالیتون، من میخوام مقدار تراکنش رو توی دیتابیس ذخیره کنم اما getAmount رو نمیتونم استفاده کنم. کلا متغیر invoice رو undefin میزنه:
کد من اینه:
return Payment::purchase($invoice, function($driver, $transactionId) {
echo "transID: $transactionId<br/>";
// We can store $transactionId in database.
$transaction = new Pay;
$transaction->trans_id = $transactionId;
$transaction->amount = $invoice->getAmount();
$transaction->user_id = Auth::user()->id;
$transaction->save();
})->pay();
ارور زیر نمایش داده میشه:
Undefined variable: invoice
توی کالبک هم میخوام از receipt بگیرم مقدار رو مینویسه متد getAmount تعریف نشده.
The package has problem with new laravel 6.0 . The error is :
$ composer require shetabit/payment
Using version ^1.2 for shetabit/payment
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for shetabit/payment ^1.2 -> satisfiable by shetabit/payment[v1.2].
- Conclusion: remove laravel/framework v6.0.0
- Conclusion: don't install laravel/framework v6.0.0
- shetabit/payment v1.2 requires illuminate/broadcasting ~5.1 -> satisfiable by illuminate/broadcasting[5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, 5.5.x-dev, 5.6.x-dev, 5.7.x-dev, 5.8.x-dev].
- don't install illuminate/broadcasting 5.1.x-dev|don't install laravel/framework v6.0.0
- don't install illuminate/broadcasting 5.2.x-dev|don't install laravel/framework v6.0.0
- don't install illuminate/broadcasting 5.3.x-dev|don't install laravel/framework v6.0.0
- don't install illuminate/broadcasting 5.4.x-dev|don't install laravel/framework v6.0.0
- don't install illuminate/broadcasting 5.5.x-dev|don't install laravel/framework v6.0.0
- don't install illuminate/broadcasting 5.6.x-dev|don't install laravel/framework v6.0.0
- don't install illuminate/broadcasting 5.7.x-dev|don't install laravel/framework v6.0.0
- don't install illuminate/broadcasting 5.8.x-dev|don't install laravel/framework v6.0.0
- Installation request for laravel/framework (locked at v6.0.0, required as ^6.0) -> satisfiable by laravel/framework[v6.0.0].
Installation failed, reverting ./composer.json to its original content.
as mentioned in https://www.sep.ir/Data/Sites/1/media/token98.pdf , saman RequestToken method can accept additional data.
in fact :
this :
$response = $soap->RequestToken($data['MID'], $data['ResNum'], $data['Amount']);
should be changed to something Like This :
$response = $soap->RequestToken($data['MID'], $data['ResNum'], $data['Amount'], 0, 0, 0, 0, 0, 0, $data['AdditionalData1'], $data['AdditionalData2'], $data['wage']);
سلام برای زرین گیت باید چیکار کرد؟
apiPaymentUrl' => 'https://www.zarinpal.com/pg/StartPay/' -->authority <--- '/Zaringate
به این شکل باید باشه
Hi,
I use this package to handle my payments using zaripal gateway. I got this error recently while I didn't make any changes in my codebase. please help me why this exception was happened?
Thanks.
امروز داشتم بررسی می کردم که دیدم اصلا InvalidPaymentException را بر نمی گردانه
همچنین اگر پرداخت هم با موفقیت انجام بشه اصلا استاتوسی برگردانده نمیشه
سلام ، هنگامی که از درگاه پی پینگ میخوام استفاده بکنم .
کد پرداختی که موقع پرداخت میده یک حروف 6 - 7 حرفی هستش ! ( transactionId )
حالا موقع برگشت مثل بقیه درگاه ها اون کد پرداخت که قبل از وارد شدن به درگاه رو ذخیره کردیم نمیده !
اگر بیرون از پکیج بود میومدم اون کد که اول میده رو مخصوص پی پینگ داخل کال بک برمیگردوندم . اما چون دارم با پکیج کار میکنم کمی گیج شدم !
بنظرتون باید این مورد رو چیکار کنم ؟ ( از 3 درگاه استفاده میکنم و کال بک ها داینامیک هستش )
خواستم از ایونت وریفای استفاده کنم اما توی try وریفای، وقتی این ایونت رو صدا میزنم خطا میده که باید ۳تا پارامتر بهش ارسال کنم، هرچی هم از صورتحساب بهش پاس میدم قبول نمیکنه.
درصورت امکان یک مثال برای بنده بفرستید.
پکیج عالیه و داره کار میکنه فقط با این قسمت ایونت مشکل دارم.
سلام و احترام
من از زرین پال استفاده میکنم چطور میتونم به جای تومان از ریال اسفاده کنم؟
Call to undefined method Shetabit\Payment\Drivers\Zibal\Zibal::getMode()
سلام
من متاسفانه چند روزه با این سر و کله میزنم و هی از این شاخه میپرم به اون شاخه
ولی الان مشکل اصلی رو پیدا کردم مشکل الان اینجاست که توی لوکال هاست انتقال داده میشه به صفحه ی پرداخت ولی روی هاست تو قسمت لوکیشن درخواستی که بر میگرده همون مسیری بر میگرده که خودم فرستاده بودم
اگه از کد ها مشکلی بود نباید تو لوکال هم اجرا میشد
ممکنه از تنظیمات هاست باشه؟
http://takinweb.com/client/Untitled.png
Hi
As you know, we can verify zarin
pal payments by Authority uuid in pure PHP codes and Zarinpal let us to get Authority uuid before redirecting to payment url and we can save it to database to help us verifying payments in future. when Zarinpal payment done, Zarinpal redirects to our callback url and pass some parameters like Authority uuid for payment verfying.
I have a problem with this payment package, when we store transactionId in database for every payment, how we can verify in callback page when we have no parameters passed by payment page?
I hope you understand my problem,
My payment function code:
use App\Models\File;
use App\Models\Payment;
use App\Models\TelegramUser;
use Shetabit\Payment\Exceptions\InvalidPaymentException;
use Shetabit\Payment\Invoice;
use Shetabit\Payment\Facade\Payment as PaymentFacade;
public function buyFile($tid, $fid)
{
$file = File::findOrFail($fid);
$telegramUser = TelegramUser::whereId($tid)->get();
$invoice = new Invoice();
$invoice->amount($file->price);
$invoice
->detail('description', "خرید فایل {$file->path}")
->detail('email', '[email protected]')
->detail('mobile', '09123456789');
return PaymentFacade::callbackUrl(route('bot.verify-pay-file'))->purchase(
$invoice,
function($driver, $transactionId) use($tid, $file) {
$payment = new Payment();
$payment->amount = $file->price;
$payment->transaction_id = $transactionId;
$payment->telegram_user_id = $tid;
$payment->save();
}
)->pay();
}
My callback function:
public function verifyPayFile()
{
try {
$receipt = PaymentFacade::amount(XXXXX)->transactionId(XXXXX)->verify();
echo $receipt->getReferenceId();
} catch (InvalidPaymentException $exception) {
echo $exception->getMessage();
}
}
What should be instead of XXXXX in my callback function?
Thanks a lot
سلام
موقع تست درگاه تو محیط لوکال با همچین پیغامی روبرو میشم:
Class 'SoapClient' not found
"shetabit/payment": "^2.4",
"laravel/framework": "^7.0",
ممنون میشم راهنمایم کنید @khanzadimahdi
متاسفانه بعد از ریدارکت به صفحه پرداخت درگاه بانک پارسیان با خطای زیر مواجه میشم :
کد انتقال به بانک :
$invoice = (new Invoice)->amount(1000);
return Payment::callbackUrl('https://xyz.com/parsianResult')->via('parsian')->purchase($invoice, function ($driver, $transactionId) {
`})->pay()->render();`
نسخه پکیج 4.0
نسخه PHP 7.2
با پشتیبانی بانک تماس گرفتم گفتن باید ریدایرکت به بانک با متد Post باشه
از دوستان کسی این مشکل رو داشته ؟
@khanzadimahdi
مشکل اتو لاگاوت بعد از برگشت از درگاه بانکی به روت از نوع پست مشاهده میگردد.
laravel v7
سلام من وقتی متد pay رو صدا میزنم این ارور رو میده
Target class [shetabit-payment] does not exist.
وقت بخیر.
در زرین پال
مشکل من تراکنش های موفقی هست که در سایت ثبت نشده ان چطوری تراکنش ها موفقی که در سایت ثبت نشده ان را پیدا کنم؟؟؟
یعنی تراکنش و پرداخت انجام شده ولی به هر دلیلی کاربر به سایت برنمی گردد. چطور این تراکنش ها را پیدا کنم.
در صورتی که فقط مقدار پرداختی و
$transactionId
را دارم .
GetUnverifiedTransactions متد
را پیدا کردم ولی نمیدونم چه جوری ازش استفاه کنم.
با تشکر
سلام . خسته نباشید ببخشید این کد منه
$invoice = (new Invoice)->amount($amount);
return Payment::callbackUrl(route('cart.verify'))->purchase(
$invoice,
function($driver, $transactionId) use($cart,$request) {
$cart->update(['transaction_id'=>$transactionId,'amount'=> $amount ]);
}
)->pay();
ولی ارور
Trying to access array offset on value of type null
میده در صورتی فایل کانفیگ هم مشکلی نداره
مشکلش چیه ؟
زمان استفاده از
// Do all things together in a single line.
return $payment->purchase(
(new Invoice)->amount(1000),
function($driver, $transactionId) {
// Store transactionId in database.
// We need the transactionId to verify payment in the future.
}
)->pay()->render();
با خطای زیر مواجه می شوم
Call to undefined method Illuminate\Http\RedirectResponse::render();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.