-1

I m getting this Error:

Client error: POST https://api.paystack.co/transaction/initialize resulted in a 403 Forbidden response: Just a moment... <meta http-equiv="Content-Type" conte (truncated...)

this is my env file setting with image and code

PAYSTACK_PUBLIC_KEY pk_test_6148addb851a3d55237ac9a
PAYSTACK_SECRET_KEY=sk_test_6f5903359c651e2807e8b0d1a

enter image description here

web php Routes

Route::get('/getform',[PayController::class,'index']);

Route::post('/pay', [PayController::class, 'redirectToGateway'])->name('pay');

Route::post('/payment/callback', [PayController::class, 'handleGatewayCallback'])->name('payment');

enter image description here

Controller Files

 public function redirectToGateway()
 {

        $data = array(
            "amount" => 700 * 100,
            "reference" => '4g4g5485g8545jg8gj',
            "email" => 'user@mail.com',
            "currency" => "NGN",
            "orderID" => 23456,
        );
    return Paystack::getAuthorizationUrl($data)->redirectNow();
 }
 public function handleGatewayCallback()
 {
     $paymentDetails = Paystack::getPaymentData();

     dd($paymentDetails);
     // Now you have the payment details,
     // you can store the authorization_code in your db to allow for recurrent subscriptions
     // you can then redirect or do whatever you want
 }

enter image description here

ERROR

enter image description here

Some body Resolve the issues if they have solution

  • Please don't post [images of code](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question)! – brombeer Jun 13 '23 at 07:23
  • Client error: `POST https://api.paystack.co/transaction/initialize` resulted in a `403 Forbidden` response: Just a moment... – Mujtaba Fatih Jun 13 '23 at 07:26

1 Answers1

0

Check your secret key is correct, test it with cURL

curl https://api.paystack.co/transaction/initialize
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{ "email": "customer@email.com", "amount": "20000" }'
-X POST