DEV Community

Discussion on: How to Integrate Paystack payment system

Collapse
 
patabah profile image
PatAbah • Edited

You said $email is my customer's email. So I tried getting my user's email from $_POST but each time I refer to $_POST anywhere in initialize.php I get a redirection error from browser "Page isn't redirecting properly"

This also means I can't pass the amount user is willing to pay via post in initialize.php

This is super weird and annoying. I'll appreciate any help please. Thanks

Collapse
 
ijsucceed profile image
Jeremy Ikwuje

"Page isn't redirecting properly"? Uncommon. Try clearing your cache and cookie(important).

Each time you refer to $_POST, what do you mean?

Try isseting if the $_POST request was sent to see where the problem is coming from.

if( isset( $_POST['submit'] ) { 

You can engage with me live on twitter, that will be faster.

Collapse
 
ezuruikechinedu profile image
Chinedu • Edited

same here..but the values for $email and $amount in stored in sessions.
I get undefined _session variables..
Do i have to session_start()in both initialize.php and callback.php?

Thread Thread
 
ezuruikechinedu profile image
Chinedu

Don't worry...i've DONE IT

Thread Thread
 
elouisramsey profile image
elouisramsey

yo, please how did you solve this
using JS and I keep getting undefined

Collapse
 
patabah profile image
PatAbah • Edited

Your prompt response already makes me feel better :)

BTW, I was using Firefox on Android, I switched to Chrome... It worked. Back to Firefox and it worked too!

I don't know how, but I think the issue is resolved. Thanks.

One more thing...
For production, after replacing test_key with my real secret key, would PayStack override my callback_url? Or is it compulsory to set the callback_url in the field provided the Developer Dashboard?

I passed a $_GET parameter to the callback url containing specific subscription plans I offer so I could update the my DB with the parameter (plan) on success.

Is there a better way to do this?

Thanks once again

Thread Thread
 
ijsucceed profile image
Jeremy Ikwuje • Edited

No, Pat, as long as you set the callback_url in your code, then you're fine.

Thread Thread
 
patabah profile image
PatAbah

Thanks man. You're za best!

Thread Thread
 
ijsucceed profile image
Jeremy Ikwuje

Pleasure, thanks.