2

I'm trying to get a payment link to work, but whatever I try to do either breaks the page (white screen) or lands me at an XML page.

Since I'm not fully understand the code, this is the explanation that I got with it:

Request code:

$ curl -X GET "https://www.mollie.com/xml/ideal?a=create-link&partnerid=[partnerid]&amount=[amount]&description=[omschrijving]&profile_key=[profiel key]"

Response code:

HTTP/1.1 200 OK

<?xml version="1.0" ?>
<response>
    <link>
        <URL>https://www.mollie.com/pay/ideal/000000/200_Testorder_15/43bd941819a5f5db83adf97d08da508805bce051</URL>
        <message>Your iDEAL-link has been successfully setup. Your customer should visit the given URL to make the payment.</message>
    </link>
</response>

My current code:

If I put the request code like below on top of the page, the page breaks instantly. The idea is that the code should return the content from the xml on line 16 and not link to the xml. Am i not adding iid right to the description or am I doing something else wrong?

<?php
    $iid = $_POST['infinid'];
    $email = $_POST['email'];
    $orderid = $date . '-' . $id;

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

        echo "<table><tr><td>Name</td><td>";
        echo $_POST['name'];
        echo "</td></tr><tr><td>InfinTV ID</td><td>";
        echo $_POST['infinid'];
        echo "</td></tr><tr><td>Email adres</td><td>";
        echo $_POST['email'];
        echo "</td></tr><tr><td colspan=\"2\">If the information above is correct, please proceed to payment</td></tr><tr><td colspan=\"2\">";
        echo "<a href=\"";
        echo "https://www.mollie.com/xml/ideal?a=create-link&partnerid=2006811&amount=1000&description="  . $iid .  "&profile_key=3721B6A4";
        echo "\">Pay Now</a>";
        echo "</td></tr></table>";
        }

    else{
        echo '<form method="post" action="">
        <table>
        <tr><td colspan="2">Please fill in the form below to renew your subscription</td></tr>
        <tr><td>Name</td><td><input type="text" name="name" /></td></tr>
        <tr><td>InfinTV ID</td><td><input type="text" name="infinid" /></td></tr>
        <tr><td>Email</td><td><input type="text" name="email" /></td></tr>
        <tr><td colspan="2"><input type="submit" value="Proceed to checkout" /></td></tr>
        </table>
        ';

    }   
?>
Dikesh Gandhi
  • 447
  • 13
  • 22

1 Answers1

0

It seems Mollie requires a few steps to create an order. You have most of the first step, which is to generate the request to Mollie. Instead of sending the browser directly to www.mollie.com/xml/ideal... you need to have the user submit the form to your server. Then you send a server-to-server GET request using cURL to www.mollie.com/xml/ideal... and you will receive an XML response. Parse that response using XML Parser to get the response/link/URL element. Send the user's browser to the URL found there using a 302 redirect by setting the Location header in your response to the browser.

Kelly Keller-Heikkila
  • 2,544
  • 6
  • 23
  • 35
  • Thanks a lot for your answer Brian. It looks like I will need to hire a programmer then. This is way above my skillset :) – Bart van Oort Oct 05 '15 at 18:39