Add credits to a Flexmail sub-account.
SOAP Action: AccountAddCredits
SOAP Return Object: AccountAddCreditsResp
The following table describes the parameters used for calling the AccountAddCredits service.
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) |
type | Y | CreditsType | The type of credits to be added: email or preview |
amount | Y | Integer | The number of credits to be added |
The following table describes the parameters returned from the AccountAddCredits service.
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 |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
221 | Invalid accountType |
223 | Invalid amount |
224 | Invalid Type |
225 | Insufficient credits |
226 | Internal error |
Add 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("AccountAddCredits", array($request)); if ($response->errorCode == 0) { echo "Added 1000 email credits to account with userID 1"; } else { echo "Could not add 1000 email credits to account 1: " . $response->errorMessage; }?>