yabacon / paystack-php

A PHP Wrapper for Paystack API - https://www.paystack.com
MIT License
109 stars 70 forks source link

Cannot understand 3. Handle charge.success Event #13

Open shirshak55 opened 6 years ago

shirshak55 commented 6 years ago

What is it and where should i use it?

shirshak55 commented 6 years ago

And what should we do lets say for 100naira things customer only paid 10naira. Can we check before having transaction?

ibrahimlawal commented 6 years ago

I hope this helps. https://developers.paystack.co/docs/adding-paystack-as-a-checkout-option

shirshak55 commented 6 years ago

@ibrahimlawal I read it. But i guess the documentation is actually not clear.

In stripe i used to have flow like this

Customer will fill the form. They will order the item and pay it in credit card. And they will get token in form element. But stripe will not charge it .

When they post in server. I verify if items are correct and fetching money from database i charge them using the token that stripe gave it to me which works like credit card on server side.

And the main problem is lets say user changed amount from 100naira to 10 naira using inspect element. I know i can check if they paid 100 naira or not using transaction key etc.. but i don't want them charge 10 also just because they change from 100 to 10 naira because they may claim refund etc.. which will be probelmatic right? How do i make such flow possible.

I guess documentation of api should have been clear :(

I hope you understand my problem thank you.

ibrahimlawal commented 6 years ago

To be clear, you only need to be sure they pay the amount you want, right?

Use Transaction/Initialize to start the transaction on your server. Then use same email, amount and reference to start inline and we will resume the already initialized transaction.

shirshak55 commented 6 years ago

@ibrahimlawal i want them not to pay the amount that i don't want like. I don't want to specifiy amount on input

Because if user change it to 10 by using console it will only creates problem. I want to charge them from server side once they have filled the form.

Regarding transaction initialize it has two problem.

  1. I need to redirect them to another page.
  2. After completion they come to my server with get request with token like . Website.com/?transaction_id=xx &&...............

Thanks . I hope you are understanding what i want to say.

And there are two webhook url in settings in paystack what is that for?

ibrahimlawal commented 6 years ago

https://developers.paystack.co/docs/events