0

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: "user@example.com",
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",

},

  • Can you please elaborate what exactly is not working for you? also what have you tried so far? – Nik Oct 24 '22 at 14:38
  • @Nik ok so i have a json data an in each of the data i have different prices so the issue i'm having now is that i want the price to be coming from the json data (when the user clicks on the pay button of a particular product the price of the product should appear on the paystack form ) – timothy okoduwa Oct 24 '22 at 14:41

0 Answers0