How to work with the confirmation
After you're already familiar with the requests to mPAY24 (see
hier) it's time to show you
how to interact with the mPAY24 confirmation interface. For details please read the "Specification of the mPAY24 interfaces".
In general there are 3 important things you should do:
STEP 1
Create a new file - for example confirm.php - you should include the initial index.php, where the class MyShop was defined.
The mPAY24 confirmation interface send (via GET) a list of parameters every time when a transaction has changed it's status - by initiating
(RESERVED/BILLED/ERROR), by clearing (BILLED), by crediting (CREDITED), by canceling (CANCELED). The only thing you should do is to "save" these
attributes into array and pass the array to the method
confirm together with the transaction ID for the transaction you want to update.
STEP 2
The
confirm method requires the implementation of the
two abstract mehtods in our MyShop class -
updateTransaction and
getTransaction.
With the
updateTransaction we create a regular
text file and save the information from the mPAY24 confirmation in it. The
getTransaction method just gives us back a transaction with the specific transaction ID.
STEP 3
The last thing we need to to do is to specify the needed URLs in our MDXI XML (see chapter 4.2.9 of the specification for details). Modify
the
createMDXI method by adding a success and a confirmation URLs:
Now we only need to create the success.php (which will be called from mPAY24 in case the transaction was successful, after the mPAY24 pay page
was closed).
The success.php does nothing but only open the file created from the confirmation and prints out its content in your browser. You can also
analogical define an error and cancel URLs.