shetabit / multipay Goto Github PK
View Code? Open in Web Editor NEWsimple PHP payment package , supports multiple drivers
License: MIT License
simple PHP payment package , supports multiple drivers
License: MIT License
سلام بنده طبق کدهای زیر تراکنش رو انجام میدم و کامل هم انجام میشه و پول به حساب زرین پال میره اما هنگام کال بک خطا میده که اطلاعات ارسالی ناقص است.
public function SubmitTransaction(Request $request){
$price = (int)$request->price;
$email = $request->email;
$invoice = (new Invoice)->amount($price);
$invoice->detail(['email' => $email]);
return Payment::purchase($invoice, function($driver, $transactionId) use ($invoice) {
// Store transactionId in database as we need it to verify payment in the future.
$transaction = new Transaction();
$transaction->transactionId = $transactionId;
$transaction->email = $invoice->getDetails()['email'];
$transaction->amount = $invoice->getAmount();
$transaction->uuid = $invoice->getUuid();
$transaction->save();
})->pay()->render();
}
برای قسمت وریفای هم از متد زیر استفاده میکنم
public function ResponseTransaction(Request $request){
$transaction_id = (int)$request->Authority;
$transaction = Transaction::where('transactionId', $transaction_id)->first();
if ($transaction) {
try {
$receipt = Payment::transactionId($transaction_id)->verify();
$transaction->reference_id=$receipt->getReferenceId();
$transaction->status = 200;
$transaction->message = "پرداخت با موفقیت انجام شد.";
$transaction->save();
Log::info($transaction);
return view('site.transactionResponse', ['data'=> $transaction]);
} catch (InvalidPaymentException $exception) {
$transaction->status = 500;
$transaction->message = $exception->getMessage();
$transaction->save();
Log::error($transaction);
return view('site.transactionResponse', ["data" => $transaction]);
}
} else {
Log::error("Transaction Error : " . $transaction_id . " Submitted But Not Found In Database");
abort(500);
}
}
اطلاعات مرچنت کد و لینک کال بک هم به درستی داده شده است
'mode' => 'normal', // can be normal, sandbox, zaringate
'merchantId' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxx', //
'callbackUrl' => env('APP_URL').'/ResponseTransaction',
'description' => 'payment using Zarinpal',
به نظر من قسمت **description** به درستی به زرین پال ارسال نمی شود.
پکیج ۳.۱ روی لاراول ۶ نصب کردم واز درگاه ایران کیش استفاده می کنم
هنگام اتصال به درگاه با خطای 909 مواجه می شوم
"Shetabit\Multipay\Exceptions\PurchaseFailedException 909"
"Shetabit\Multipay\Drivers\Irankish\Irankish::purchase
vendor/shetabit/multipay/src/Drivers/Irankish/Irankish.php:79"
پکیج را حذف و مجدد نصب کردم ولی همچنان همان خطا را دارم
public function verify() : ReceiptInterface
{
$data = array(
'merchantId' => $this->settings->merchantId,
'sha1Key' => $this->settings->sha1Key,
'token' => $this->invoice->getTransactionId(),
'amount' => $this->invoice->getAmount() * 10, // convert to rial
- 'referenceNumber' => Request::get('referenceId'), <--- invalid line
+ 'referenceNumber' => Request::post('referenceId'), <--- correct line
);
$soap = new \SoapClient($this->settings->apiVerificationUrl);
$response = $soap->KicccPaymentsVerification($data);
$status = (int) ($response->KicccPaymentsVerificationResult);
if ($status != $data['amount']) {
$this->notVerified($status);
}
return $this->createReceipt($data['referenceNumber']);
}
سلام شما توی وریفای درگاه ایرانکیش کال بک این درگاه رو گت در نظر گرفتی در صورتی که توی داکیومنتای ایران کیش که چندینننن ساله تکون نخورده گفته کالبکشون پست میشه.
بعد چطور شما میگی این درگاه ها تست شده من نمیدونم؟
لطفا این موضوع رو بررسی کنید و درصورت امکان این مشکل رو فیکس کنید.
ممنونم
Originally posted by @jalallinux in shetabit/payment#126 (comment)
با سلام و احترام
در لومن از این کتابخانه میخواهم استفاده کنم ولی ارور زیر رو میگیرم
require(../../payment.php): failed to open stream: No such file or directory
درصورتی که آدرس دهی فایل payment.php به درستی انجام شده
چاره چیست؟
Zarinpal unverified method is not implemented
reference to this method in zarinpal website: https://docs.zarinpal.com/paymentGateway/other/#unverified
من از لاراول 8 استفاده میکنم
پکیجهای مولتی پی و پیمنت رو به اخرین ورژن آپدیت کردم
موقع استفاده از درگاه زرین پال این ارور رو میده:
Shetabit\Multipay\Exceptions\PurchaseFailedException
Terminal is not active, please contact our support team.
ممنون میشم راهنمایی کنین
all AsanPardakht URLs are changed and the rest version of this service is better for use.
old URLs: https://services.asanpardakht.net/ (get 404 error)
new URLs: https://ipgsoap.asanpardakht.ir/
for example:
https://ipgsoap.asanpardakht.ir/paygate/merchantservices.asmx?wsdl
this is the rest API version endpoints:
https://ipgrest.asanpardakht.ir/index.html
What's the problem with the Scrutinizer test?
@khanzadimahdii think its test configs must be double checked.
Hi, @khanzadimahdi you should use php: 7.4 in scrutinizer config as below:
as I test it here with my fork branch and everything works fine.
.
Originally posted by @ahbanavi in #40 (comment)
سلام
بعضی وقت ها وقتی فانکشن رو کال میکنم داخلش نمیره و ازش رد میشه و دیتایی داخل دیتابیس ثبت نمیشه که وقتی از درگاه برمیگرده بتونیم پیگیری کنیم.
Payment::callbackUrl(route('payment.verify'))->purchase(
(new Invoice)->amount(10000)
->via($payment_gateway),
function ($driver, $transaction_id){
//داخل این بخش نمیشه بعضی وقت ها
// و چون داخل این قسمت نمیشه نمیتونم تو دیتابیس ذخیره کنم
$invoice = $driver->getInvoice();
$description = [
'transaction_id' => $transaction_id,
'uuid' => $invoice->getUuid(),
];
}
)->pay()->render();
نمیدونم مشکلش چیه! داره کار میکنه مثلا 119هزارتا تراکنش داریم الان 100 تاش اینجوری شده
when use saman or behpardakht gateway get this error:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://sep.shaparak.ir/Payments/InitPayment.asmx?WSDL' : failed to load external entity "https://sep.shaparak.ir/Payments/InitPayment.asmx?WSDL"
i tried any way but not fixed.
php version 7.4
با سلام.
کد من هنگام اتصال به درگاه بانکی وقتی روی حالت سندباکس هستش بدون مشکل وصل میشه
ولی وقتی روی حالت نرمال میذارمش خطای بالا رو نشون میده
از این فایل vendor/shetabit/multipay/src/Drivers/Zarinpal/Strategies/Normal.php:104
و خط throw new PurchaseFailedException($result['errors']['message'], $result['errors']['code'])
$result = json_decode($response->getBody()->getContents(), true);
// some error has happened
if (!empty($result['errors']) || empty($result['data']) || $result['data']['code'] != 100) {
throw new PurchaseFailedException($result['errors']['message'], $result['errors']['code']);
}
ما با استفاده از داکر پروژه رو میسازیم
php version: 7.4
RUN apt-get update &&
apt-get install -y libxml2-dev &&
docker-php-ext-install soap
RUN docker-php-ext-install soap
RUN composer install --no-scripts --no-autoloader --prefer-dist --no-dev
--working-dir=/var/www/html
RUN composer du
RUN mkdir -p ./bootstrap/cache/
RUN chmod -R 777 ./bootstrap/cache/
RUN composer dump-autoload
RUN php artisan cache:clear
RUN php artisan config:clear
RUN php artisan view:clear
RUN php artisan route:clear
اینا رو داخل داکر گذاشتیم
Hello, i am getting error API Key یافت نشد.
How do i set API key for IDPay,
I have tried to set parameter API-KEY but it is obviously wrong name.
سلام من تراکنش رو ثبت میکنم تراکنش ساخته میشه و درخواست ثبت میشه ولی به صفحه پرداخت انتقال داده نمیشه و هیچ خطایی هم نشون نمیده
*php 8.0.0
*Ubuntu 18.04
SOAP-ERROR: Encoding: Cannot find encoding
show this error when using Behpardakht gateway
when updating to this version v1.6.2
سلام و خسته نباشید
بعد از قطع اتصال سراسری
pay.ir
و ارتقاء سیستمش ظاهرا کد های شما با آپدیت جدید درگاه دچار مشکل شده
سایتی که قبلا با همین پکیج پیاده سازی شده بود، خود به خود با خطا مواجه میشه
متن خطا :
cURL error 7: Failed to connect to pay.ir port 80: No route to host (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
در ضمن از لاراول نسخه 7 استفاده میکنم
متشکرم
سلام امکانش هست فرم ریدایرکت کاستومایز بشه؟ اگر آره چطور.
توی پروژه لاراول لومن دارم از همین پکیج استفاده میکنم
recently sadad gateway changed its API for verify transactions,
these changes break the verify process and causes issue
currently I have been working on it and soon will make a PR for it
سلام وقت بخیر ممنون بابت پکیج خیلی خوبتون،
یه مشکلی که هست توی بعضی از درایورها مثل درایور درگاه idpay قیمت نهایی ضربدر 10 نشده و همون عدد رو به درگاه میفرسته، درحالی که توی برخی درایورها مثل به پرداخت و payir و زرین پال عدد نهایی که به درگاه پرداخت ارسال میشه ضربدر 10 میشه
لطفا بررسی کنید، تشکر
من از چند درگاه دارم استفاده میکنم و موقع ارتباط با بانک هم طبق داکیومنت ازمتد
via
نام درگاه رو پاس میدم.
با درگاه پیش فرض که سامان هست مشکلی نیست اما با درگاه دیگه مثلا ملت
خطاهای بازگشتی رو دیگه تبدیل نمیکنه و همون عدد رو میفرسته
مثلا
17
سلام
$transactionId
رو داخل دیتابیس نگه میدارم اما با
clientrefid
برگشت داده شده یکی نیست
حتی کلاس
PAYPING
رو هم که نگاه کردم
"clientRefId" => $this->invoice->getUuid(),
به این صورت پیاده سازی شده و در واقع
$this->invoice->getUuid()
رو به عنوان
clientrefid
برمیگردونه
!!!
پکیج زیر مشابهه این پکیج است و اقتصاد نوین هم دارد ممنون میشم اقتصاد نوین را به درگاه ها اضافه کنید
سلام وقت بخییر
من می خواستم در درایور زرین پال به آخر لینک پرداخت رشته ای اضافه کنم تا در هنگام وصل شدن به درگاه به صورت راندم بانک انتخاب نکنه(مثلا در لینک زیر مستقیم به به پرداخت وصل میشه)
https://normal.zarinpal.com/pg/StartPay/0000000000000000000000000000000001/bpm
این قابلیت در پکیج هست؟
تشکر
بعضی جاها روی orderId از crc32 استفاده شده و این باعث میشه uuid ای که خودمون بهش دادیم رو موقع برگشت نتونیم پیدا کنیم . ازونجایی هم که crc32 احتمال تکراری شدن هش رو داره امکان duplicate شدن orderId ها پیش میاد توی دیتابیس که زیاد جالب نیس.
اگر نقش crc32 فقط کوتاه تر کردن uuid و عددی کردنش هس به نظرم بهتره که قبلش چک بشه تا اگه orderId نبود این اتفاق بیفته
سلام
به هنگام استفاده از ساده ترین نمونه هایی که قراردادید ارور زیر دریافت میشه:
```
$result = $client->PaymentRequest($data);
if ($result->Status != 100 || empty($result->Authority)) {
// some error has happened
$message = $this->translateStatus($result->Status);
throw new PurchaseFailedException($message, $result->Status);
}
$this->invoice->transactionId($result->Authority); // return the transaction's id
وعنوان هم نوشته خطای ناشناخته رخ داده است
محیط استفاده لومن هست
مشتري گرامی با عنایت به اینکه تأییـدیه تراکنش شـما نیاز به سپري شـدن 60 دقیقه دارد،چنانچه مبلغ تراکنش ازحساب شـما کسـرشده و خدماتی دریافت نکردید لطفا پس از سپري شدن 60 دقیقه از زمان تراکنش، گردش حساب خود را بررسـی و درصورتی که مبلغ عودت نگردیده بود، با پشتیبانی مرکز تماس 2318تماس حاصل فرمائید
کد های انتقال به درگاه بانک من :
$invoice = (new Invoice)->amount(1000);
return Payment1::callbackUrl('https://xyz.com/parsianResult')->via('parsian')->purchase($invoice, function ($driver, $transactionId) {
//My Order Create
})->pay()->render();
برای پشتیبانی از اکتان ایده ای هست؟
فکر میکنم اون قسمت که از متغیر های گلوبال داریم استفاده میکنیم برای گرفتن اینپوت ها اگر چک کنیم که محیطمون لاراول و بجای اونها از فانکشن کمکی
request
استفاده کنیم مشکل حل بشه
مثلا
function_exists('request') && request() instanceof /Illuminate/...
Using Enviourment Variable
Laravel Recommends to use .env file to store sensitive information like username / password etc ...
so i think its better to make them into the env file so a default user dosent need to publish any configuration and can run this via enviourment variable
i want to change it and make a PR to solve this issue
##its a request for pull request.
its important in two way:
is there a working example? e.g with Laravel?
Zarinpal sandbox has SOAP-ERROR
SoapFault
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://sandbox.zarinpal.com/pg/services/WebGate/wsdl' : failed to load external entity "https://sandbox.zarinpal.com/pg/services/WebGate/wsdl"
I've created a local driver for testing purposes. All the purchase flow can be tested and requires no real bank gateway.
Should I create a pull request for this repo or it should be as a separate package?
سلام چه فرقی بین دو تا پکیج است
shetabit/multipay
shetabit/payment
سلام و ممنون از زحماتتون- درگاه پارسیان یه ترمینال آی دی هم داره که شما تو پکیج اختصاص ندادید. چرا؟
سلام . دوست گرامی با توجه به اینکه ساختار پروژه بر اساس تومان است زرین پال به صورت ریال دریافت میکند
ضمن اینکه اگر این راهکار را اضافه کنید که خیلی عالی میشود
اگر ورودی کاربر ریال بود متد داشته باشیم که ورودی را در درگاه مورد نظر تبدیل کنیم مثلا اگر زرین پال تومان کار میکند و فروشگاه من ریال است ریال را بدهم و متد را هم ریال قرار بدهم اما در فرایندهای پرداخت ریال ورودی به تومان تبدیل شود
و برای درگاه هایی که ورودی ریال دارند اگر وردی کاربر تومان بود متد را تومان قرار بدهد و تبدیل خودکار به ریال انجام شود
Return type of toJson()
method of RedirectionForm
class is \Illuminate\Http\JsonResponse
which is a defined class in Laravel
framework. But this package is designed to use with plain PHP
and is not dependent in any frameworks.
Using toJson()
method in plain PHP
environment will result in a fatal error
Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Response" not found
in ..../multipay/src/RedirectionForm.php on line 187
to reproduce the error run this script:
require_once 'vendor/autoload.php';
use Shetabit\Multipay\Invoice;
use Shetabit\Multipay\Payment;
$paymentConfig = require(dirname(__FILE__).'/vendor/shetabit/multipay/config/payment.php');
$payment = new Payment($paymentConfig);
$invoice = new Invoice();
$invoice->amount(10000);
echo $payment->purchase($invoice)->pay()->toJson();
I saw in comments history, response type has been changed to \Illuminate\Http\JsonResponse
about 4 months ago in this commit bf83415. This commit should be reverted and response type should be simple json_encode
response, as this package is independent of any frameworks.
I think adding json type to header would be a good addition. Corrected method should be something like this
/**
* Retrieve JSON format of redirection form.
*
* @param $options
*
* @return string|bool
*/
public function toJson($options = JSON_UNESCAPED_UNICODE) : mixed
{
header('Content-Type: application/json');
return json_encode($this, $options);
}
من قصد استفاده از درگاه پرداخت فن آوا کارت رو داشتم اما توی پکیج شما این درگاه پرداخت موجود نبود
توی بیشتر درایورها تا اونجایی که من دیدم البته به جز زرینپال ارسال شماره موبایل به سمت درگاه انجام نمیشه! درگاهها پشتیبانی نمیکنن یا کدش زده نشده؟
چون تا اونجایی که اطلاع دارم درگاه از شماره موبایل استفاده میکنه برای نشون دادن کارتهای استفاده شده قبلی توسط این شماره
This error happens on php 7.4
داخل کانفیگ سداد ارایه مربوط بهش از key های اشتباهی استفاده شده
چیزی که الان هست:
'apiPurchaseUrl' => 'https://sadad.shaparak.ir/vpg/api/v0/Request/PaymentRequest', 'apiPaymentUrl' => 'https://sadad.shaparak.ir/VPG/Purchase',
چیزی که باید باشه:
'apiPaymentUrl' => 'https://sadad.shaparak.ir/vpg/api/v0/Request/PaymentRequest', 'apiPurchaseUrl' => 'https://sadad.shaparak.ir/VPG/Purchase',
Shetabit\Multipay\Exceptions\PurchaseFailedException
Shetabit\Multipay\Drivers\Zarinpal\Zarinpal::purchase
root\vendor\shetabit\multipay\src\Drivers\Zarinpal\Zarinpal.php:83
من از لاراول 8 استفاده میکنم. وقتی از درگاه زرین پال استفاده میکنم اسن ارور رو میده
ممنون میشم راهنمایی کنین
سلام
من مشکلش رو تونستم پیدا کنم از رو سیستم خودم و سرور بود برای حل مشکلش هم لینک زیر رو میزارم که حل کردم این مشکل رو:
Originally posted by @aminmohammadmazreali in #10 (comment)
https://github.com/shetabit/multipay/blob/652492cec95b70e0968b5c6ffd196d07dbed049c/src/Invoice.php
Currently the amount can only be Integer but many other currencies have precisions. In the case we need a driver having a currency with precisions, how should we fix this problem?
توی فایل کانفیگ درگاه توی بخش سامان باید دو تا ورودی دریافت کنه:
1- مرچند ایدی merchantId
2- پسورد password
در صورتی که الان فقط داره مرچند ایدی رو ورودی میگیره . ورودی پسورد نیست
سلام در حین ریدایرکت کردن پس از پرداخت موفق اررور
Page Expired
لاراول را برمیگرداند.
bug
سلام
برای Jibit درایوری نوشته شده؟اگه آره کیrelease میشه؟
تو داکیومنت باک سامان اومده که باید بعد وریفای شدن تراکنش مبلغی که در ریسپانس برمیگرده رو با مبلغی که کاربر پرداخت کرده مقایسه کرد و اگه این دوتا باهم برابر نبود باید تراکنش ریورس بشه من کد مربوط به درایور بانک سامان رو بررسی کرد این شرط چک نمیشه.
دلیل خاصی داره اینکه چک نمیشه؟
سلام
بنده مستندات + درگاه تایید شده از فن آوا کارت رو دارم ممنون میشم یه راه ارتباطی توی تلگرام معرفی کنید تا به دستتون برسونم
اگه تونستید شما پیام بدید که خیلی خوبه و سریعتر کار انجام میشه
آیدی تلگرام بنده : Stoyt
سلام. در مد آزمایشی پرداخت زرین پال، در تنظیمات مد کاری رو سندباکس گذاشتم، سولم این بود که مقدار کد رهگیری پرداخت رو چجوری بدست بیارم؟ داکیومنت رو خوندم ولی برام جواب نداد
مرسی
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.