Git Product home page Git Product logo

Comments (18)

iamraphson avatar iamraphson commented on September 23, 2024

can i see your source code?

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

import React, { Component } from "react";
import { Switch, Route } from 'react-router-dom';
import { About } from './About/About';
import { Faqs } from './FAQs/Faqs';
import { Workload } from './Order/Workload/Workload';
import { Appointment } from './Order/Appointment/Appointment';
import { DataPage } from './Order/DataPage/DataPage';
import { Summary } from './Order/Summary/Summary';
import PaystackButton from 'react-paystack';

export class Main extends Component {
constructor(props) {
super(props);
this.state = {
fields: {
bedrooms: 1,
bathrooms: 1,
date: 0,
time: 0,
name: '',
phone: '',
email: '',
address: '',
price: 0
},
key: 'pk_test_f68915f70c7a77b65f416080230a9a3822035979'

    };

}

getReference = () => {
    //you can put any unique reference implementation code here
    let text = "";
    let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.=";

    for( let i=0; i < 15; i++ )
        text += possible.charAt(Math.floor(Math.random() * possible.length));

    return text;
}

callback = () => {
    
}

close = () => {

}

computePrice = () => {
    const fields = this.state.fields;


}


onInputChange = (evt) => {
    const fields = this.state.fields;
    fields[evt.target.name] = evt.target.value;
    this.setState({fields});
}

render() {
    return (
        <main role='main' className='container'>
            <div className='row'>      
                <p>
                <PaystackButton
                    text="Make Payment"
                    class="payButton"
                    callback={this.callback}
                    close={this.close}
                    disabled={false} 
                    embed={false} 
                    reference={this.getReference()}
                    email={'mayowadan17gmail.com'}
                    amount={10000}
                    paystackkey={this.state.key}
                />
                </p>
            </div>
            <div className='row'>
                <Switch>
                    <Route exact path='/' render={() => <Workload onInputChange={ this.onInputChange } bed={this.state.fields.bedrooms} bath={this.state.fields.bathrooms}/>}/>
                    <Route path='/appointment' render={() => <Appointment onInputChange={ this.onInputChange } values={this.state.fields}/>} />
                    <Route path='/address' render={() => <DataPage onInputChange={ this.onInputChange } values={this.state.fields}/>} />
                    <Route path='/summary' render={() => <Summary values={this.state.fields}/>} />
                    
                    <Route exact path='/about' component={About}/>
                    <Route exact path='/faqs' component={Faqs}/>
                    {/* <Route path='/order/workload' component={Workload}/> */}
                    {/* <Route path='/order/appointment' component={Appointment}/> */}
                </Switch>
               
            </div>
        </main>
    );
}

}

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

I just plopped the thing onto a page just to test things out

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

Here's the error:
Access to Script at 'https://js.paystack.co/v1/inline.js' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.

from react-paystack.

iamraphson avatar iamraphson commented on September 23, 2024

@danieloi let me see how you brought in paystack inline.js. see mine, <script src="//js.paystack.co/v1/inline.js"></script>

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024
<script crossorigin src="//js.paystack.co/v1/inline.js"></script>

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

It gives this error:
Access to Script at 'https://js.paystack.co/v1/inline.js' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

when I add https to is, it gives the former error

from react-paystack.

iamraphson avatar iamraphson commented on September 23, 2024

do this <script src="//js.paystack.co/v1/inline.js"></script>.Don't add any protocol.

from react-paystack.

iamraphson avatar iamraphson commented on September 23, 2024

which browser are you using?

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

the error there is worse. It says it cannot read the error object in that case. The React reference i gave explains it as a security measure regarding CORS issues that hides the error object in case sensitive details were involved in the request.

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

I'm using the latest Chrome

from react-paystack.

iamraphson avatar iamraphson commented on September 23, 2024

@danieloi can you send your project to my mail? [email protected]

from react-paystack.

iamraphson avatar iamraphson commented on September 23, 2024

or upload it to github

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

Here it is in a sampling of it's glory....
https://github.com/danieloi/project-cleanup

from react-paystack.

iamraphson avatar iamraphson commented on September 23, 2024

@danieloi sorry about the delay. i saw some issues with your code.

The crossorigin error was due to error from paystack.

Any other issue, let me know. I will be available to suppport you.

from react-paystack.

iamraphson avatar iamraphson commented on September 23, 2024

@danieloi can i close this issue?

from react-paystack.

danieloi avatar danieloi commented on September 23, 2024

Yes you can. Thank you!

from react-paystack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.