Schedule payment webservice

Any issue about Cyclos 4 scripting and Webservices

Moderators: hugo, alexandre, rmvanarkel

Post Reply
edurogonsky
Posts: 3
Joined: Thu May 14, 2015 1:16 pm

Schedule payment webservice

Post by edurogonsky »

How can I set a schedule payment by webservice using php?

For a simple payment from system to user we have this:

<?php
require_once 'configureCyclos.php';

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

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

$parameters = new stdclass();
$parameters->from = $data->from;
$parameters->to = $data->to;
$parameters->type = $data->paymentTypes[0];
$parameters->amount = 5;
$parameters->description = "Test from system 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) {
echo("Error while calling $e->service.$e->operation: $e->errorCode");
}

Post Reply