Account.grantCredit
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.grantCredit
The grantCredit method adds credit to an Account object. With credit available to an Account, you can conduct a one-time transaction for the Account. If the Account is associated with an AutoBill, and if the AutoBill has no associated credit, Vindicia Subscribe can draw credit down from the Account to sustain the AutoBill.
Specify credit you wish to grant to the Account as a Credit object. Time-based credit cannot be granted to an Account.
See the Credit Subobject, and the TimeInterval Subobject, for more information.
See Credit Grants and Gift Cards in the Vindicia Subscribe Programming Guide for more information on working with credit.
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 to which you wish to grant credit. Use the merchantAccountId or VID to identify the object.
credit: a Credit object specifying the amount and type of credit you wish to grant to the Account.
note: an optional memo regarding the credit grant.
Output
return: an object Account type Return that indicates the success or failure of the call.
account: the Account object to which you granted 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 grant credit to an account
$acct = new Account();
// account id for an existing customer
$acct->setMerchantAccountId('jdoe101');
$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('ANYTIME_PHONE_MINUTES_2010');
$tokAmt = new TokenAmount();
$tokAmt->setToken($tok);
$tokAmt->setAmount(100);
$cr = new Credit();
$cr->setTokenAmounts(array($tokAmt));
// Now make the SOAP API call to grant credit to the acct
$response = $acct->grantCredit($cr);
if ($response['returnCode'] == 200) {
// Credit successfully granted to 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 granting credit to the account
print $response['returnString'] . "\n";
}
For Users
Learn More