hi all,

I have been coding a payment gateway using a company called SwipeHQ. Using their APIs I have programatically created products from my website and make sure they stay updated. However, I'm now completely stuck about how to have my checkout navigate to their payment form and then return back.

The flow diagramme would look something like this:

My Website Checkout -> update product details on SwipeHQ -> redirect to SwipeHQ payment form -> (success) navigate back to cart -> update stock / tidy things up -> redirect to thank you page.

I have tried using something like header("Location: https://payment.swipehq.com/?identifier_id=" . $transactionId); but this just gives me an error message.

Could someone let me know vaguley what the correct protocol is for doing something like this?


what is the error message? Have you tried by contacting their support service? From what I've seen you have to perform a curl request and get a response in JSON format:

But from the documentation I cannot see what would happen in case of error and what to expect. I would ask them to point you to full documentation about their API and see if there's already an official or recommended PHP SDK.

Besides, if you feel unconfortable with curl, you can use guzzle, which is an easy PHP HTTP client:

commented: +1 for guzzle +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.