Service: AccountRevokeCredits

Revoke credits from a Flexmail sub-account.

Service Details

SOAP Action: AccountRevokeCredits
SOAP Return Object: AccountAddCreditsResp

Input

The following table describes the parameters used for calling the AccountRevokeCredits service.

Table: instance of AccountRevokeCreditsReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
accountType Y AccountType The account to add credits to (only the userId parameter is required)
amount Y Integer The number of credits to be added
type Y CreditsType The type of credits to be added: email or preview

Output

The following table describes the parameters returned from the AccountRevokeCredits service.

Table: instance of AccountRevokeCreditsResp

Parameter Mandatory Type Description
header / APIResponseHeader Header containing authentication information
errorCode / Integer Numerical value of the error
errorMessage / String Short literal description of the error

Table: response codes of AccountRevokeCreditsResp.

0 No error
220 Authentication error, see header object for detailed information
221 Invalid accoutType
223 Invalid amount
224 Insufficient credits
225 Internal error

Example

Revoke 1000 email credits to sub-account 1

<?php

// create header object
$header = new stdClass();
$header->userId = USER_ID;
$header->userToken = USER_TOKEN;

// create account object
$account = new stdClass;
$account->userId = 1;

// create the header
$request->header = $header;
$request->accountType = $account;
$request->type = "email";
$request->amount = 1000;

$response = $SoapClient->__soapCall("AccountRevokeCredits", array($request));

if ($response->errorCode == 0) {
	echo "Revoked 1000 email credits from account with userID 1";
} else {
	echo "Could not revoke 1000 email credits from	 account 1: " . $response->errorMessage;
}?>