I want to integrate payumoney with laravel 5.1. I have kept the form in blade . Upon submitting the form I get this error:
method not found
then I tried to put the whole form for payment gateway (payu) in controller. It is still not working. Actually laravel unable to submit form to this url - test.payu.in.
I also used this:
$request = \Illuminate\Http\Request::create('http://localhost/mypro/payu/', 'POST', ['param1' => 'value1', 'param2' => 'value2']);
not working
Please help me solving this.
You might like to use a package for PayU Money. Here is a link it is pretty easy to use.
PayU Package.
Here you don't have to do anything.
Just register 2 route one for request and one for response.
Then you have to do the following.
// Frirst:
return Payment::make($data, function($then) {
$then->redirectTo('your/response/url');
});
// Second:
$payment = Payment::capture();
// And you have the payment here.
It is that simple.
Hope it helps.
Related
I am making APIs in Laravel version 8.x for a third party system. For this, I have created few APIs and all routes are mentioned in routes/api.php
In our system, there are few APIs that can be accessible via GET request, that returns data without any authentication and parameters. Look at the routes below in api.php:
//routes/api.php
Route::group(['namespace' => 'App\Http\Controllers\WebServices'], function() {
Route::get('event_types', 'EventWs#getEventTypes');
Route::get('event_type/{event_type_id}', 'EventWs#getEventTypeById');
});
Look at the both routes above. The route having segment is working fine with GET request, but the route without any segment is not calling. This is just a simple GET request without any segment or query string.
I am working on Laravel from past few months, but this issue is strange to me. May be there could be some kind of middleware that prevent GET (without segment or query string) route execution. But I am not able to find reason or that unknown barrier.
Have anyone idea about why this happening or I am missing something?
Please Note that I am using Laravel 8.x
Cashier Paddle Version: 1.0#beta
Laravel Version: 7.0
PHP Version: 7.2.5
I am using cashier-paddle for one of my laravel 7 projects. I'm trying to apply a "one off" charge (Simple Charge) against a customer. I've followed the official documentation to integrate the package in my project but I am getting this issue "Simple Charge The checkout id must be a valid checkout id". Here are the steps that I have already completed.
Installed the official laravel cashier-paddle package using composer
require laravel/cashier-paddle
Published necessary migrations and added the necessary API Keys on my
env file
Added the #paddlejs in may master layout blade file and updated the
VerifyCsrfToken middleware so it except routes paddle/*
Added the Billable trait to the User model Configured the webhook
route and controller
// Route example
Route::post('paddle/webhook','WebhookController#handleWebhook')->name('cashier.webhook')
// WebhookController
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Laravel\Paddle\Http\Controllers\WebhookController as CashierController;
class WebhookController extends CashierController
{
public function handleWebhook(Request $request)
{
logger('I can reach here!');
}
public function handlePaymentSucceeded($payload)
{
}
}
Generated the paylink variable using my controller.
// paylink variable from controller
$payLink = auth()->user()->charge(12.99, 'Test Product Title');
Finally used the variable on the paddle-button Blade component
// Blade file
<x-paddle-button :url="$payLink" class="px-8 py-4">
Buy
</x-paddle-button>
Note: The simple charge is not working but the charge for a specific product is working fine. For example this one auth()->user()->chargeProduct(619859) is working fine.
These are the steps that I have already followed to integrate the paddle simple chare on my laravel application. Hope that information may help you. Let me know if I am doing anything wrong or missed any steps. I will be really very thankful if anyone can help me to solve the issue. Thanks in advance.
Thanks for visiting the question. After doing some research I've fixed the issue. Everything was fine. Just need to specify the webhook URL in the charge method. I think it was not mentioned in laravel documentation. I'm posting the answer so anyone can get a solution in the future.
// paylink variable from controller
$payLink = auth()->user()->charge($total, 'Product Title', [
'webhook_url' => 'webhook URL here',
]);
Hi I am using Vuejs in the frontend and Laravel in the backend. The role of Laravel is handling the API only. The frontend and backend are separated, i.e. I am not using Vuejs in Laravel's resource/js folder.
Now I am sending Axios POST request from Vuejs to Laravel. All the form input values are prevalidated using HTML5 required attribute. And when I console.log the request data, it shows all the fields filled.
In Vue file:
const data = {
name: this.name,
gender: this.gender,
mobile_no: this.mobile_no,
image: this.userImage
};
console.log("Request data . . . .", data);
const response = await this.axios
.post(`${this.AppURL}/admin/user/create`, data, {
headers: {
"Content-Type": "multipart/form-data"
}
})
.then(() => {
console.log("Success. . . . ")
alert("Successfully Driver Added");
})
.catch(error => console.log(error));
And in Laravel, the request is passed through some validation. It's a simple validation to check if all the fields are filled.
I am also using JWTAuth package for the authentication, and the token is generated by it.
It's too much code to write them all the way down here. But I am sure you can understand what I mean.
What I am getting as a response is this
POST http://localhost:8000/api/admin/user/create 422 (Unprocessable Entity)
The actual result I am expected to get is either success or some errors that is according to some if conditions in validation or token check.
I tried to figure out where this error might come from. What I think at the moment is this could be due to the absence of csrf_token in the POST request. As I'm sending the request outside Laravel, csrf_token is missing in the form. I am not 100% sure though about this.
So my question is:
How can I include csrf_token in Axios POST request, when I send it from outside Laravel.
If this 422 error is not related with csrf_token, what could be causing this? Any previos experiences like min? and any solutions for this?
Thanks in advance for your help.
Please, modified catch block as #Jack suggested:
.catch(error => {
console.log("ERRRR:: ",error.response.data);
});
Now you can get errors and handle errors in the catch block.
.catch(function (error) {
console.log(error.response.data.errors);
});
please use this code I hope it work's.
I was also facing the same issue, i think it is due to some Headers missing in your Api request from vue.js. here some tips which may helps you to solve this issues.
Make sure that you are protecting your Api Routes or not(by sanctum or something else). If you are protecting , then make make sure that you are sending authentications token in headers.
Second make sure that your request(axios or jwt) should contained valid data, if your are sending images or files etc make sure how can we send them.
First, get request and check in laravel by dd($erquest->all()); if you are geeting data then validate, it is possible that laravel request doesnt contained your sending data..
These errors may be caused due to follow reasons, ensure the following steps are followed.
To connect the local host with the local virtual machine(host).
Here, I'am connecting http://localhost:3001/ to the http://abc.test
Steps to be followed:
We have to allow CORS, placing Access-Control-Allow-Origin:* in header of request may not work. Install a google extension which enables a CORS request.
Make sure the credentials you provide in the request are valid.
Make sure the vagrant has been provisioned. Try vagrant up --provision
this make the localhost connect to db of the homestead.
Just click on the preview tab within network section in the dev tool, you are going to see the actual error message.
I'm about to go mental with this problem, I'm implementing an IPN system in my app and started doing tests now using Paypal's IPN Simulator.
When I try to send an IPN simulation, it just gives the following error:
We're sorry, but there's an HTTP error. Please try again.
First thought - Paypal's service was down - Tested wrong since if I create a blank page and send an IPN message to http://myDNS.com/blankpage.php it is able to send it.
Second thought - Problem with routes - which I think it's not the problem either:
Here's my IPN Listener at the PurchaseController.php:
public function completed()
{
//FAHIM's Paypal IPN Listener
$ipn = new PaypalIPNListener();
$ipn->use_sandbox = true;
$verified = $ipn->processIpn();
$report = $ipn->getTextReport();
Log::info("-----new payment-----");
Log::info($report);
if ($verified) {
if($_POST['address_status'] == 'confirmed'){
//sucess
}
}
}
In routes.php :
Route::post('purchase/completed/', array('as' => 'purchase.completed', 'uses' => 'PurchaseController#completed'));
Is there any known problems associated with IPN Simulator and Laravel?
Thank you in advance.
Looks like I found the answer!
The problem was that a tokenMismatchException was being thrown whenever Paypal tried to send the POST information.
For people with the same problem, here's the solution:
Add an exception into the VerifyCsrfToken.php Middleware, so that the exception URI won't need the CsrfToken verification:
In my case, it looks something like this:
protected $except = [
'purchase/completed'
];
I'm working with Laravel 5, so please keep in mind that it might be slightly different in lower versions.
This is my first Laravel project I'm on, and it has been a ton of fun so far.
I'm setting up an OAuth2 server. I have copied the code posted here in to my routes file.
Via this block of code...
Route::post('oauth/access_token', function()
{
return AuthorizationServer::performAccessTokenFlow();
});
I have tried doing http://local.server.com/oauth/access_token and a "MethodNotAllowedHttpException" error.
If there is any other information I could provide that would help you help me, please tell me!
Cheers
If you are typing http://local.server.com/oauth/access_token into the browser URL bar, then you are sending the request:
GET oauth/access_token
However, your route handles a POST request, and since there is no GET route defined, Laravel is responding with MethodNotAllowedHttpException
In order to properly test your route, you will need to send a POST request.