Just_James
Just_James

Reputation: 1

Payfast Onsite Integration Changing Redirect URLs

I'm struggling with a PayFast onsite integration.

PayFast is failing to redirect following a successful payment. It looks as though my urls are being changed.

$data = [
// Merchant details
'merchant_id' => 'xxx', //required
'merchant_key' => 'xxx', //required
'return_url' => 'https://www.example.co.za/signup/success_temp.php', // optional
'cancel_url' => 'https://www.example.co.za/signup/cancel.php', // optional
'notify_url'=> 'https://www.example.co.za/signup/notify.php', // optional];

$data_subscription = [
// Payment methods
'payment_method' => 'cc', // *optional - Must include for subscriptions

// Subscriptions
'subscription_type' => '1', // required
'billing_date' => $billing_date, // *optional
'recurring_amount' => $recurring_amount, // *optional
'frequency' => '3', // required
'cycles' => '0' // required];

// Add subscription data to $data
if (1 == 1) {
$data = array_merge($data, $data_subscription);
}

From here I run the standard PayFast code for their online integration but the return_url comes back: https:\/\/www.example.co.za\/signup\/success_temp.php

And the cancel_url: https:\/\/www.example.co.za\/signup\/cancel.php

I have tested the redirect to google.com and I get the same issue.

Any ideas where I have gone wrong?

Upvotes: -1

Views: 401

Answers (1)

Just_James
Just_James

Reputation: 1

The error doesn't have to do with the URLs. The default Payfast code echoes a JSON object with the forward slashes escaped.

I believe there must be an error with my notify_url. If the notify_url doesn't return a 200 then they don't redirect to your return_url.

Upvotes: 0

Related Questions