UNKNOWN error while make transaction with php

Functionality discussions and feature requests

Moderators: hugo, alexandre, rmvanarkel

Post Reply
kamal
Posts: 1
Joined: Fri Aug 29, 2014 9:53 am

UNKNOWN error while make transaction with php

Post by kamal » Mon Sep 01, 2014 2:12 am

I had Installed Cyclos 3.7.3 Release on my Local and I need to make transaction via PHP. I am using this PHP Library => http://www.cyclos.org/dev/4.2/cyclos-php-library.zip

Now when ever I try to make transaction, I got Error with code UNKNOWN while performing the payment
Please guide me where I am doing it Wrong or provide me any working example of same.

Thanks!!
(PHP CODE BELOW)
require_once 'configureCyclos.php';

$transactionService = new Cyclos\TransactionService();
$paymentService = new Cyclos\PaymentService();

try {
$data = $transactionService->getPaymentData(array('username' => 'c1'), array('username' => 'c2'));

$parameters = new stdclass();
$parameters->from = $data->from;
$parameters->to = $data->to;
$parameters->type = $data->paymentTypes[0];
$parameters->amount = 5;
$parameters->description = "Test payment to user";

$paymentResult = $paymentService->perform($parameters);
if ($paymentResult->authorizationStatus == 'PENDING_AUTHORIZATION') {
echo("Not yet authorized\n");
} else {
echo("Payment done with id $paymentResult->id\n");
}
} catch (Cyclos\ServiceException $e) {
switch ($e->errorCode) {
case "VALIDATION":
echo("Some of the parameters is invalid\n");
var_dump($e->error);
break;
case "INSUFFICIENT_BALANCE":
echo("Insufficient balance to perform the payment\n");
break;
case "MAX_AMOUNT_PER_DAY_EXCEEDED":
echo("Maximum amount exeeded today\n");
break;
default:
echo("Error with code $e->errorCode while performing the payment\n");
break;
}
}

avf
Posts: 23
Joined: Fri Sep 26, 2014 2:51 pm

Re: UNKNOWN error while make transaction with php

Post by avf » Tue Nov 04, 2014 7:29 am

4.2 is not compatible with 3.7.

Post Reply