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

Im getting an error thats says: Uncaught TypeError: n.split is not a function #54

Open
Tosinkoa opened this issue Jul 16, 2022 · 0 comments

Comments

@Tosinkoa
Copy link

I'm new to using react-paystack, while practicing what was shown in the example, I always get this error in my console: Uncaught TypeError: n.split is not a function, and the payment was not successful.

This happened when I tried the three examples.

import React from "react";
import { PaystackConsumer } from "react-paystack";

const config = {
  reference: new Date().getTime().toString(),
  email: "[email protected]",
  amount: 500 * 100,
  publicKey: "pk_live_cf929a519a7eba12b9a87da11d8a76d790a1b884",
};

const reference = "Success";
const handleSuccess = (reference) => {
reference and after success call.
  console.log(reference);
};

const handleClose = () => {
  console.log("closed");
};

function App() {
  const componentProps = {
    ...config,
    text: "Paystack Button Implementation",
    onSuccess: (reference) => handleSuccess(reference),
    onClose: handleClose,
  };

  return (
    <div className="App">
      <PaystackConsumer {...componentProps}>
        {({ initializePayment }) => (
          <button onClick={() => initializePayment(handleSuccess, handleClose)}>
            Paystack Consumer Implementation
          </button>
        )}
      </PaystackConsumer>
    </div>
  );
}

export default App;
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

1 participant