Account.revokeCredit
Web Session Object
Transaction Object
Token Object
Season Set Object
Refund Object
RatePlan Object
Product Object
Payment Provider Object
Payment Method Object
NameValuePair Object
GiftCard Object
Entitlement Object
Chargeback Object
Campaign Object
BillingPlan Object
AutoBill Object
Address Object
Activity Object
Account Object
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, Vindicia Subscribe 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, Vindicia Subscribe 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 Vindicia Subscribe 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:
|
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