Closed ahkmunna closed 4 years ago
Can you send an excerpt of your code? So as to figure where the problem might be from.
pls wat d solution to this $amount = 50000;
The hidden field of quantity is required.
<input
type="hidden" name="quantity" value="3">
Enjoy!
the field below is required... with the value of 1.
`<`input type="text" name="quantity" value="1" hidden`>`
cause it need its to multiple the amount passed to it.
you must send form data in a req body if you are using axios then you must attach your form data to data : form_data
Stringify the data to be sent as body. It should work.
also write "body" not "Body" const data = {amount: 1000000, email: "someone@someone.com", currency: "NGN",
body: JSON.stringify(data)
Hi having some issues at my end here
this is not working for me, any clarification here? $data = array( "amount" => 700 * 100, "reference" => '4g4g5485g8545jg8gj', "email" => 'user@mail.com', "currency" => "NGN", "orderID" => 23456, ); return Paystack::getAuthorizationUrl($data)->redirectNow();
I'm getting a: {"status":false,"message":"Invalid Amount Sent"}
resulted in a
400 Bad Request``
I believe you'll need to turn your data array back into a string for it to work hence the stringify.json and instead of 700*100 as amount, just put in 70000.
On Sun, 26 Jun 2022, 15:42 Godsend Joseph, @.***> wrote:
Hi having some issues at my end here
this is not working for me, any clarification here? $data = array( "amount" => 700 * 100, "reference" => '4g4g5485g8545jg8gj', "email" => @.***', "currency" => "NGN", "orderID" => 23456, ); return Paystack::getAuthorizationUrl($data)->redirectNow();
I'm getting a: {"status":false,"message":"Invalid Amount Sent"} resulted in a 400 Bad Request``
— Reply to this email directly, view it on GitHub https://github.com/unicodeveloper/laravel-paystack/issues/63#issuecomment-1166553068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5YLDMEVK5NRCVMFSTX6LTVRBT45ANCNFSM4GL5P4SQ . You are receiving this because you commented.Message ID: @.***>
I believe you'll need to turn your data array back into a string for it to work hence the stringify.json and instead of 700*100 as amount, just put in 70000. … On Sun, 26 Jun 2022, 15:42 Godsend Joseph, @.> wrote: Hi having some issues at my end here this is not working for me, any clarification here? $data = array( "amount" => 700 100, "reference" => '4g4g5485g8545jg8gj', "email" => **@.', "currency" => "NGN", "orderID" => 23456, ); return Paystack::getAuthorizationUrl($data)->redirectNow(); I'm getting a: {"status":false,"message":"Invalid Amount Sent"} resulted in a 400 Bad Request`` — Reply to this email directly, view it on GitHub <#63 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5YLDMEVK5NRCVMFSTX6LTVRBT45ANCNFSM4GL5P4SQ . You are receiving this because you commented.Message ID: @.>
can you please explain well on turning the data array back into a string?
I doubt @orangesnowtech knows what he's saying
Why is this closed
The code provided in the example is not working
/**
/ $data = array( "amount" => 700 100, "reference" => '4g4g5485g8545jg8gj', "email" => 'user@mail.com', "currency" => "NGN", "orderID" => 23456, );
return Paystack::getAuthorizationUrl($data)->redirectNow();
The method I suggested is what worked for me...
I put the data I wanted to pass in a JSON object and passed it after turning it back into a string with stringify. Because doing it plainly just didn't work the way it should.
If you've got a solution let's hear it..
On Mon, 4 Jul 2022, 06:46 kodunmi, @.***> wrote:
Why is this closed
The code provided in the example is not working
/**
- In the case where you need to pass the data from your
- controller instead of a form
- Make sure to send:
- required: email, amount, reference, orderID(probably)
- optionally: currency, description, metadata
- e.g:
/ $data = array( "amount" => 700 100, "reference" => '4g4g5485g8545jg8gj', "email" => @.***', "currency" => "NGN", "orderID" => 23456, );
return Paystack::getAuthorizationUrl($data)->redirectNow();
— Reply to this email directly, view it on GitHub https://github.com/unicodeveloper/laravel-paystack/issues/63#issuecomment-1173375939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5YLDO2IJJCFCWXUZWYDTTVSJ3CRANCNFSM4GL5P4SQ . You are receiving this because you were mentioned.Message ID: @.***>
Okay @quiet-programmer
Here is the solution to your problem
I had to go under the hood to discover this
Make use of laravel request (Illuminate\Http\Request)
$request->merge([ 'amount' => 700 * 100, 'email' => "test@gmail.com", "reference" => Paystack::genTranxRef(), "currency" => "NGN", ]);
try { $url = Paystack::getAuthorizationUrl()->url; return redirect()->away($url); } catch (\Exception $e) { return Redirect::back()->withMessage(['msg' => 'The paystack token has expired. Please refresh the page and try again.', 'type' => 'error']); }
@kodunmi Thanks a lot let me test this
I send the request from backend after verifying the form inputes and got 400 Bad Request every time even when I set the amount in raw int format. I got "400 Bad Request: Invalid Amount Sent"every time
https://api.paystack.co/transaction/initialize
resulted in a
400 Bad Request` response: { "status": false, "message": "Invalid Amount Sent" }