Skip to main content
Vindicia Knowledge Center

Account.revokeCredit

Account.revokeCredit

Account.revokeCredit

The revokeCredit method deducts credit from an Account object. If the deduction results in a negative amount for a certain type of credit, CashBox sets its balance to 0. This method returns the Account object with resultant credit balance.

Specify the amount and type of Credit you wish to revoke from the Account as a Credit object.

To revoke a specific credit grant, specify the VID of the Credit object you wish to revoke. If you do not specify a VID, CashBox will revoke credit in the order in which it would redeem Credits to fulfill an AutoBill Transaction, until the total amount specified is revoked. This process might revoke a partial Credit, a single Credit, or multiple Credits.

For more information on working with credit, see Credit Grants and Gift Cards in the CashBox Programming Guide.

Input

srd: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a method call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the srd. A null srd returns the complete response.

account: the Account object from which you wish to revoke credit. Use the merchantAccountId or VID to identify the object.

credit: a Credit object specifying the amount and type of credit you wish to deduct from the Account. For more information, see the Credit Subobject.

note: an optional memo regarding the credit revocation.

Output

return: an object of type Return that indicates the success or failure of the call.

account: the Account object from which you revoked credit. This object contains the updated array of Credit objects.

Returns

In addition to those listed in Standard Return Codes, this call returns:

Return Code

Return String

400

One of the following:

  • Account not found.
  • Failed to translate credit error-description.
  • Failed to revoke credit error-description.
  • Failed to save Account after revoking credit.
  • Failed to reload Account after revoking credit error-description.
  • Data validation error: Missing required parameter credit.

Example

// to revoke credit from an account

$acct = new Account();

// account id for an existing customer

$acct->setMerchantAccountId('ff_flier_101');

$tok = new Token();

// Specify id of an existing token type.
// Assumption here is that you have already created
// a Token object with this id.

$tok->setMerchantTokenId('UA_FF_MILES');

$tokAmt = new TokenAmount();
$tokAmt->setToken($tok);
$tokAmt->setAmount(25000);

$cr = new Credit();
$cr->setTokenAmounts(array($tokAmt));

// Now make the SOAP API call to deduct miles

$response = $acct->revokeCredit($cr);

if ($response['returnCode'] == 200) {

// Credit successfully revoked from the account

$updatedAcct = $response['data']->account;
$availableCredits = $updatedAcct->getCredit();
$availableTokens = $availableCredits->getTokenAmounts();

print "Available token credits: \n";
foreach($availableTokens as $tkAmt) {

print "Token type: " . $tkAmt->getMerchantTokenId() . " ";
print "Amount: " . $tkAmt->getAmount() . "\n";

}

}

else {

// Error while revoking credit from the account

print $response['returnString'] . "\n";

}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top