Welcome Guest, Not a member yet? Register   Sign In
URI Issues
#1

[eluser]Reevosoft[/eluser]
Good day developers

I would like to have some assistance in an issue that I'm having.

URL_1 = http://example.com[not real domain]/index.php/welcome/update_request/declined
URL_2 = http://example.com[not real domain]/index.php/welcome/update_request/?req=declined

URL_1 is the good version of URL_2. The third party application that I'm using sends the data in the form of URL_2. Are there any ways for me to still use Code Igniter to parse URL_2 so that I can extract the data from it without being redirected anywhere?

Segment 1 and 2 are provided by the system that I am writing but when the third party application sends data back, it appends the values to the URL that I have provided in the form of URL_2.

Thank you in advanced.
#2

[eluser]Brad K Morse[/eluser]
Does the third-party app have documentation on their API? I'd check there first.
#3

[eluser]Reevosoft[/eluser]
Here are the links to the on-line payment system.

Link_1: http://www.payfast.co.za/c/std/integration-guide
Link_2: http://www.payfast.co.za/c/std/website-p...-variables
Link_3: http://www.payfast.co.za/c/std/pdt-itn-variables

@link_2 you will notice 3 variables that returns values once payments have been made or cancelled.

When a payment have been made successfully, the page gets redirected to the return_url and it appends ?pt=... to the return_url which conflicts with the way the URI are being interpreted.
When a payment have been cancelled, the page gets redirected to the cancel_url and it appends ?pt=... to the cancel_url which also conflicts with the way the URI are being interpreted.
Once a payment have been made successfully, data gets posted in the background to the notify_url with witch I have no problem with.

Here's a URL to a sample that I have uploaded: http://kobusbeets.co.za/interquote.biz/d...yfast_form

You will notice that when the payment have been made successfully or cancelled, it will redirect you to a file that is not included in the CI framework. It redirect from there then into the CI framework. I would like to get that data interpreted within the CI controller that I have written.

Any help would be very much appreciated.
#4

[eluser]Brad K Morse[/eluser]
You are looking to capture the users data (via a form) in your codeigniter application, then push that data to the payfast gateway?
#5

[eluser]Reevosoft[/eluser]
Yes; once the payment have been accepted or cancelled, the payfast system uses the return_url or cancel_url to redirect a buyer back to the site they came from, or to a different location. In my case, the following happens.

I have a controller named payments with a method called returnedFromPayFast. return_url = http://kobusbeets.co.za/index.php/paymen...romPayFast. This is the url that I submit to them.

After the payment have been accepted, the return_url get altered and looks like the following. return_url = http://kobusbeets.co.za/index.php/paymen...UniqueCode. The "?pt=UniqueCode" gets appended to the return_url which conflicts with the way that CI interprets URI's. Are there ways to bypass this?

URL: http://kobusbeets.co.za/interquote.biz/d...yfast_form
When submitting the form, you can use "clientpass" as the password to log into the payfast system.
#6

[eluser]Brad K Morse[/eluser]
Try using htaccess

mod_rewrite

in your htaccess file, you can do:

Code:
RewriteEngine On
Redirect 301      /index.php/payments/returnedFromPayFast?pt=UniqueCode       http://kobusbeets.co.za/index.php/payments/returnedFromPayFast

first part turns on the rewriteengine, then the first URL is what will be redirected, which is the second URL.

check out http://codeigniter.com/wiki/mod_rewrite/ and http://farinspace.com/codeigniter-htaccess-file/
#7

[eluser]Reevosoft[/eluser]
I'm not sure if it would work, but I'll give it a try.

The UniqueCode is randomly being generated, it's not a standard code that are being used. I will search in the CI system files to see if I can get that URI parsed somehow.

Many Thanks.
#8

[eluser]Brad K Morse[/eluser]
You can try editing your routes file.
#9

[eluser]Unknown[/eluser]
Hi Reevosoft,

This is Jonathan here from PayFast.

That "pt" GET variable is actually a "Payment Token" variable which is only valid for PDT which is deprecated and not used much anymore. It is enabled by default on the sandbox (test system) for those customers who still need to test with it, but it will NOT be present when you change to the LIVE site (unless PDT is enabled on your account which is not recommended).

I'm not sure if that helps you at all, but you can safely ignore that value with no adverse affect on your system.




Theme © iAndrew 2016 - Forum software by © MyBB