getting price from json and integrating to pay stack in react js

51 Views Asked by At

I am trying to get my item price from my json data and then pass it to the pay stack payment form so the customer can pay the amount that is in the json data

this is my pay stack code

```
const config = {
reference: (new Date()).getTime().toString(),
email: "[email protected]",
amount: 33333,
publicKey: 'pk_test_89aaa3531bf6c9xxxxxxxxx',   
};
const onSuccess = (reference) => {
console.log(reference);  
};
const onClose = () => {
console.log('closed')
}
const PaystackHookExample = () => {
const initializePayment = usePaystackPayment(config);
return (
  <div>
 <button onClick={() => {
          initializePayment(onSuccess, onClose)
      }} className="btn mt-3 me-2 d-flex justify-content- 
  center">Start Purchase</button>
  </div>
  );
 };

**i want the price on my json data to appear on the form**

**my json data for a particular product**

{ "id1":1, "id":"fjuei567dhdjdggSw", "name":"Gemu", "price":1000, "thumbnail":"/images/gemu/g1.png", "longname":"Gemu - Game Store App UI Kit", "banner1":"/images/gemu/g1.png", "banner2":"/images/gemu/g2.png", "banner3":"/images/gemu/g3.png", "banner4":"/images/gemu/g4.png", "banner5":"/images/gemu/g5.png", "banner6":"/images/gemu/g6.png", "banner7":"/images/gemu/g7.png", "banner8":"/images/gemu/g8.png",

},

0

There are 0 best solutions below