-
Notifications
You must be signed in to change notification settings - Fork 0
Get the list of your Swiks
JuniorFt edited this page Feb 8, 2017
·
1 revision
#Get the list of your Swiks
Before looking at this make sure you understood the Initialization
It will be required for the Step 1.
<?php
$result = $swkAPI->getListSwik();
You will have all the swiks that you create from the API.
The '$result' object will contain a status and if the status is 'ok' there will be the list of your swiks:
"status": "ok",
"list": [
{
"id": "SWIK_ID",
"createdAt": "DD/MM/YYYY",
"accepted": "0", // or 1 if accepted
"acceptedAt": null, // if accepted the date have this format: "DD/MM/YYYY"
"deleted": "0", // or 1 if deleted
"deletedAt": null, // if deleted the date have this format: "DD/MM/YYYY"
"currency": "EUR",
"amount": "3500" // in cent
},
...
]
If you asked swiks from the Swikly website , they won't appear in that list.
- If no error happened, a status 'ok' is returned.
- If there is an error with the Swikly API you can log it or do whatever you need.
<?php
if ($result['status'] == 'ok') {
echo "List of swik(s) = ";
print_r($result['list']);
} else {
echo "Failed getting the swik list";
echo "Error = " . $result['message'];
}
<?php
// 1. Load the composer file.
require 'vendor/autoload.php';
use Swikly\SwiklyAPI;
$swkAPI = new SwiklyAPI('Your_Api_Key', 'YOUR_API_SECRET', 'developement');
// Get the list of your swiks
$result = $swkAPI->getListSwik();
// Print result of the operation
if ($result['status'] == 'ok') {
echo "List of swik(s) = ";
print_r($result['list']);
} else {
echo "Failed getting the swik list";
echo "Error = " . $result['message'];
}