Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No 'Access-Control-Allow-Origin' header is present #2

Open
haider288 opened this issue Feb 16, 2017 · 19 comments
Open

No 'Access-Control-Allow-Origin' header is present #2

haider288 opened this issue Feb 16, 2017 · 19 comments
Assignees

Comments

@haider288
Copy link

just followed the code sample provided, yet i'm getting the below error when testing my app:

Fetch API cannot load https://sbcheckout.payfort.com/FortAPI/paymentPage. Redirect from 'https://sbcheckout.payfort.com/FortAPI/paymentPage' to 'https://sbcheckout.payfort.com/FortAPI/paymentPageC?S=1&token=BJAWM6LI842ABBN1UCSRTOP80BS4JA&' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://***.com' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

TIA

@Rohithzr
Copy link
Member

are you trying from locahost or server?

@Rohithzr Rohithzr self-assigned this Feb 16, 2017
@haider288
Copy link
Author

my app is hosted on heroku server, HTTPS
if it helps you here is a reply from payfort support team, i opened a ticket with them:

If the request is coming like redirection https post , then you will not get the CORS policy warning .
we have lot of merchants integrating without this error since the request is coming as https post .
The Ajax for example is not allowed due to security reasons and you will get the same error .

@Rohithzr
Copy link
Member

have you added your authorised url in ur payfort admin panel? i think that is important too

@haider288
Copy link
Author

i just tried it, same result

@Rohithzr
Copy link
Member

show the code that you are trying to execute. the whole flow that you are following.

@haider288
Copy link
Author

one page:

`import React , {Component} from 'react';
import {Card, CardSection, Input, Button, Spinner} from './common';

var payfort = require("payfort-node");

class Payfort extends Component{

    // create client


    onButtonPress(){

      var client = payfort.create_client("development", {
        access_code : "xxxxxxxxxxxxxxxx",
        merchant_identifier : "xxxxxxxxxxxxxxx",
        passphrase : "xxxxxxxxxxxxxx"
        //purchase_url : "send this only to override default urls"
      });

      var purchaseData = {
        "amount": "22",
        "command" : "PURCHASE", // PURCHASE OR AUTHORIZATION
        "currency": "AED",
        "customer_email": "[email protected]",
        "customer_name": "Haider",
        "language": "en",
        "return_url": "http://localhost:3000/lib",
        "merchant_reference": "21221"
      };

      console.log("going to send");
      //call payfort API
      payfort.send_request(client, purchaseData, function(err, response){
        console.log("response");
        console.log(response);
        if(err){
            console.log("got an error");
            console.log(err);
          }
          console.log("outside errors");
      });
    }

    render(){
      return (
          <Card>
            <CardSection>
                <Button onPress={this.onButtonPress.bind(this)}>
                  Payfort
                </Button>
            </CardSection>
          </Card>
      );
    }

}

export default Payfort;
`

@Rohithzr
Copy link
Member

give me a little time to test it? can you provide me (mail me) a test key that i can use, that will be helpful

@haider288
Copy link
Author

haider288 commented Feb 16, 2017

take ur time, i've sent you an email to ur live.com account

@Rohithzr
Copy link
Member

Rohithzr commented Feb 16, 2017

@haider288 i did not recieve an email, can you please verify? send one to [email protected]

@haider288
Copy link
Author

email sent

@haider288
Copy link
Author

hi, did you have time to look at the above issue?

@Rohithzr
Copy link
Member

@haider288 i am testing it now.

@Rohithzr
Copy link
Member

@haider288 are you able to get the checkout url from the the code? i am able to get that

@haider288
Copy link
Author

haider288 commented Feb 20, 2017 via email

@Rohithzr
Copy link
Member

@haider288 the process is
you run payfort.send_request and get a url in response and manually redirect client to there

@haider288
Copy link
Author

haider288 commented Feb 20, 2017 via email

@Rohithzr
Copy link
Member

@haider288 payfort has changed the way their API works now. you need to create a form and call the url from client side.

I am looking into this issue and will update or remove repo accordingly.

@hicham-alsayed-ahmad
Copy link

hello, any updates ?
is there anyway to use direct ionic http function?

@Rohithzr
Copy link
Member

Not maintained anymore, feel free to contribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants