Account.transferCredit
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.transferCredit
The transferCredit method transfers credits from a parent Account to a child Account, or from one child in a family to another.
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.
fromAccount: the Account from which credits will be transferred.
toAccount: the child Account to which credits will be transferred.
credit: the credits to be transferred.
Output
return: an object of type Return that indicates the success or failure of the call.
Returns
In addition to those listed in Standard Return Codes, this call returns:
Return Code |
Return String |
400 |
One of the following:
|
500 |
Unable to transfer account. |
Example
// to transfer credits from a parent to a child account
// Create a new Account object for parent
$parent = new Account();
// Provide basic account information
$parent->setName('Somebody Q. Customer'); // Customer name
$parent->setMerchantAccountId('IN9430-8421'); // Unique customer id
// Create a new Account object for child
$child = new Account();
$child->setName('Somebody Q. Customer Jr.'); // Customer name
$child->setMerchantAccountId('IN9430-8421JR'); // Unique customer id
// Establish a parent->child relationship between $parent and $child
$childrenAdded = $anyOldAccountYouveGot->addChildren
($parent, array($child))
//Grant credit to the parent
$curAmt = new CurrencyAmount ;
$curAmt->setCurrency('USD');
$curAmt->setAmount(100.00);
$cr = new Credit();
$cr->setCurrencyAmounts(array($curAmt));
// 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->['account'];
}
else {
// Error while granting credit to the account
print $response['returnString'] . "\n";
}
//Define credits to be transferred from parent to child
$curTranAmt = new CurrencyAmount ;
$curTranAmt->setCurrency('USD');
$curTranAmt->setAmount(12.34);
$crTran = new Credit();
$crTran->setCurrencyAmounts(array($curTranAmt));
//Transfer specified credits from parent to child account
$response = $parent->transferCredit($child, $crTran);
if ($response['returnCode'] == 200) {
// Credit successfully granted to the account
}
else {
// Error while transferring credit between accounts
print $response['returnString'] . "\n";
}
For Users
Learn More