1

I just made an api with Laravel, and front with ReactJS, but I'm wondering how can I use payment getway in this project, I want to use this getway

What I tried:

$zarinpal = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
$zarinpal->isZarinGate(); // active zarinGate mode
$results = $zarinpal->request(
    "example.com/testVerify.php",
    1000,
    'testing',
    'me@example.com',
    '09000000000',
);

if (isset($results['Authority'])) {
    file_put_contents('Authority', $results['Authority']);
    $zarinpal->redirect();
}

It successfully get $results['Authority']) but it won't redirect to getway, clearly because I am using laravel as api, right? so how can I do this while I using api?

It give me this error:

Access to XMLHttpRequest at 'http://localhost:8000/api/deposit/agent' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

POST http://localhost:8000/api/deposit/agent net::ERR_FAILED

But I don't have CORS issue on api request, it just give me this error on this action

Fatemeh Qasemkhani
  • 1,942
  • 1
  • 15
  • 25
Jack The Baker
  • 1,781
  • 1
  • 20
  • 51
  • Does this answer your question? [How to solve 'Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header'?](https://stackoverflow.com/questions/46522749/how-to-solve-redirect-has-been-blocked-by-cors-policy-no-access-control-allow) – Fatemeh Qasemkhani Jun 01 '20 at 10:57

0 Answers0