This is an old revision of the document!
Table of Contents
Payment API
The payment API is used to record payments from external payment gateways like paypal and squareup.
Settings
check that the timezone in settings is correct, it should be one of the following
Australia/ACT
Australia/Melbourne
Australia/Perth
Australia/Brisbane
Pacific/Auckland
Cut and paste your key from settings into notepad for testing
Testing
Go to https://demo.mibase.com.au/home/api/test_form.php
IMPORTANT replace demo with your library code.
Enter values into the API test form and press submit, remembering to cut and paste your key into the form.
If the test is successful, the next page will return the following json object
{“error”:“”,“id”:5498,“status”:“Payment has been recorded in Mibase”}
indicating the payment was successful.
Install
In the page on your website that returns a successful payment insert the following php code. Assign the values that are returned from the payment process.
The PHP code to add
<?php
$inputData = array();
input data is a named array with keys { surname ⇒ , borid ⇒ , librarycode ⇒ , key ⇒ , amount ⇒ }
eg /* $inputData['surname'] = 'Smith'; $inputData['borid'] = '200'; $inputData['librarycode'] = 'demo'; $inputData['key'] = 'xxx'; $inputData['amount'] = '55.00'; */ $postdata = http_build_query($inputData); $context_options = array('http' ⇒ array( 'method' ⇒ 'POST', 'header' ⇒ “Content-type: ” . “application/x-www-form-urlencoded\r\n” . “Content-Length: ” . strlen($postdata) . “\r\n”, 'content' ⇒ $postdata ) ); $context = stream_context_create($context_options); $result = file_get_contents('https:' . $inputData['librarycode'] .'.mibase.com.au/home/api/RecPayment.php', false, $context); $outData = json_decode($result);
outdata is a name array { error ⇒ , id ⇒ , status ⇒ }
/* echo $result;