> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reporting Transaction Data to Vindicia

The Transaction and MigrationTransaction objects support methods to migrate Transaction information into Vindicia, and to receive a chargeback risk percentage. These classes require that you instantiate your merchant user name and password assigned by Vindicia.

To send transaction information to Vindicia:

1. Collect the information about the transactions.
2. Create either a `MigrationTransaction` object (for use with `Transaction.migrate`), or a `Transaction` object (for a`Transaction.score` request).
3.

To migrate historic data to Subscribe, see [Importing AutoBills from other Billing Systems to Subscribe](Importing_AutoBills_from#) or Transaction.migrate in the [Vindicia Subscribe SOAP API Reference Guide](https://docs.vindicia.com/bundle/b_SOAPAPIGuide).

To report data in real time (for `Transaction.score` requests), see the **Reporting Real-Time Transaction Information for Fraud Screening** section.

After you send data to Vindicia, Vindicia returns a `Return` object with `returnCode` and `returnString` to inform you if the communication with the Vindicia server completed successfully. (Codes for the `Return` object are modeled after the standard HTTP return codes.) If the call succeeds, you receive a code of `200` and the string `OK`. `returnCode` and `returnString` may be used to interpret errors. See The Return Object in the [Vindicia Subscribe SOAP API Reference Guide](https://docs.vindicia.com/bundle/b_SOAPAPIGuide), for more information.

Be certain to act upon the `Return` value.

## Reporting Real-Time Transactions for Fraud Screening

To report the transaction information in real time and receive a chargeback probability score, call the `score()` method on the `Transaction` object. (Be certain to pass only a single `Transaction` object to the `score()` call.) This call not only reports your transaction details to Vindicia but also returns to you a chargeback probability score (also called a risk score).

For the `score()` call to succeed, your transaction must contain at least the following attributes. If you do not specify any one of them, the call returns a score of `-1`, which means “no opinion.”

* IP address
* Payment method: Billing address: City
* Payment method: Billing address: State (“district”)

State is a required attribute: Do not leave it unspecified and do not specify a value of `null`. If the state is not known or does not exist, set this attribute to `Unknown`.

* Payment method: Billing address: Country
* Payment method: Billing address: Zip code

For countries with no zip or postal codes, set this attribute to `None`.

* Credit card BIN (the first six digits of the credit-card number)

Report real-time Transaction data to Vindicia:

```

$tx = new Transaction();
$tx->setAmount('29.90');
$tx->setCurrency('USD');
$tx->setMerchantTransactionId('txid-123456');
 
// IP is one of required attributes for scoring a transaction
$tx->setSourceIp('35.45.123.158');
 
$account = new Account();
$account->setMerchantAccountId('9876-5432');
$account->setEmailAddress('jdoe@mail.com');
$account->setName('J Doe');
$tx->setAccount($account);
 
$shippingAddress = new Address();
$shippingAddress->setName('Jane Doe');
$shippingAddress->setAddr1('44 Elm St.');
$shippingAddress->setCity('San Mateo');
$shippingAddress->setDistrict('CA');
$shippingAddress->setPostalCode('94403');
$shippingAddress->setCountry('US');
 
$tx->setShippingAddress($shippingAddress);
 
// The line items of the transaction
$tx_item = new TransactionItem();
$tx_item->setSku('sku-1234');
$tx_item->setName('Widget');
$tx_item->setPrice('3.30');
$tx_item->setQuantity('3');
$tx->setTransactionItems(array($tx_item));
 
$paymentMethod = new PaymentMethod();
$ccCard = new CreditCard();
$ccCard->setAccount('4111111111111111');
$ccCard->setExpirationDate('201109');
$paymentMethod->setType('CreditCard');
$paymentMethod->setCreditCard($ccCard);
 
// Billing address city, district, country are required for score 
// call to work
$paymentMethod->setBillingAddress($shippingAddress);
 
$tx->setSourcePaymentMethod($paymentMethod); 
 
$response = $tx->score();
 
if ($response[’returnCode’] == 200) {
if($response['score']->score <= 50) {
print "Acceptable score, processing transaction";
// process the transaction further here
}
else {
print "High risk of chargeback. Reasons are: \n";
$scoreCodes = $response['scoreCodes'];
foreach ($scoreCodes as $scoreCode) {
print("Score code ". $scoreCode['id'] . " : " . 
$scoreCode['description'] . "\n");
}
}
}
else {
// the score call did not succeed, check return code 
// and return string and try to re-submit
}
```

The `score()` call returns a `Return` object that describes the success or failure of the call, the chargeback probability (`score`), and an array of reason codes (`scoreCodes`) that explain the risk score.

Based on the transaction information provided, the chargeback probability ranges from 0 to 100. A probability of 100 indicates that Subscribe is 100 percent certain that this transaction is fraudulent and will result in a chargeback. The score can also be `-1`, indicating no opinion from Vindicia; or `-2`, indicating an error condition. Based on the score, you can decide to either proceed with the transaction (by capturing it) or cancel it.

For more information on and the `scoreCodes` call, see The Transaction Object in the [Vindicia Subscribe SOAP API Reference Guide](https://docs.vindicia.com/bundle/b_SOAPAPIGuide).

## Reporting Activity Information

To combat fraudulent chargebacks, Vindicia uses your records to build an evidentiary record of your customer’s activities, and challenge a chargeback case on your behalf.

Usage data, which usually resides in the commerce server on your site, is not mandatory, but can be key in helping win chargeback disputes. Examples of usage data are logins and logouts, visits to certain Web pages, email or phone communications, and shipping confirmations. This data can help counter customer claims that they did not make a specific purchase. Vindicia strongly suggests that you maintain a record of usage data. If you sell digital goods, most of this information data is required by the issuer in case of chargeback disputes. Be sure to report all the events that are significant or relevant, including email or phone communications, and access to or downloads of for-pay content.

The `Activity` object contains data structures through which you can report the following types of customer activities:

* Logins to a site
* Logouts from a site
* Views, visits, or downloads of a Web resource (URI views)
* Phone contacts with a customer
* Email contacts with a customer
* Fulfillment of an order for physical goods
* Use of quantifiable objects that are meaningful to your business
* Cancellation of a service
* An arbitrary note that contains a maximum of 1,024 characters

Report these activities to Vindicia in batch mode, when your transaction processing system is relatively quiet.

Record a phone contact with a customer as an Activity:

```

$soap_act = new Activity();
 
// Create an account object
$account = new Account();
 
// Specify account by the customer id
$account->setMerchantAccountId('9876-5432');
 
// Now create Activity to report a customer’s phone call
// and corresponding ActivityTypeArgs objects
 
$activity = new Activity();
$typeArgs = new ActivityTypeArgs();
 
// fill in the relevant info for this activity record
$activity->setAccount($account); //associate the activity and account
$activity->setActivityType('Phone');
$activity->setTimestamp(getdate()); 
 
$phoneArgs = new ActivityPhoneContact();
$phoneArgs->setCidPhoneNumber('1234567890');
$phoneArgs->setDurationSeconds(367)
$phoneArgs->setType('FromCustomerToMerchant');
$phoneArgs=>setNote('Customer agreed to be rebilled for services');
 
$typeArgs->setPhoneArgs($phoneArgs);
 
// associate typeArgs to the Activity object
$activity->setActivityArgs($typeArgs);
 
// now record the data
$response = $soap_act->record(array($activity));
 
if($response[’returnCode’] == 200) {
print "ok\n"; # 200 is HTTP status code for success
}
```

For more information, see The Activity Object in the [Vindicia Subscribe SOAP API Reference Guide](https://docs.vindicia.com/bundle/b_SOAPAPIGuide).

## Reporting Refund Information

If you process transactions and refunds through Subscribe, you need not report refunds separately to Vindicia. (Note that use of the forward slash character (/) in merchant identifiers is not allowed. See [Merchant Identifiers](Merchant_Identifiers#) for more information.)

Report refunds to Vindicia for transactions processed outside Subscribe:

```

$refundVid = 'MyVindiciaRefundVID';
 
// Create a refund object
$refund1 = new Refund();
$refund1->setMerchantRefundId('REF101');
 
$transaction1 = new Transaction();
// merchant ID of a previously reported transaction
$transaction1->setMerchantTransactionId('TX101');
 
$refund1->setTransaction($transaction1);
$refund1->setAmount(5.99);
$refund1->setNote('Refunded due to service outage');
// Payment Processor's refund id when you processed
// this refund with it directly – if available
$refund1->setReferenceString('2033992');
 
// Create another refund object
$refund2 = new Refund();
$refund2->setMerchantRefundId('REF102');
 
$transaction2 = new Transaction();
// merchant ID of a previously reported transaction
$transaction1->setMerchantTransactionId('TX102');
 
$refund2->setTransaction($transaction2);
$refund2->setAmount(10.99);
$refund2->setNote('Customer did not receive delivery);
 
$soap_refund = new Refund();
$response = $soap_refund->report(array($refund1, $refund2));
if($response[’returnCode’] == 200) {
print ("All refunds submitted successfully");
}
```

If you refund customers outside of your Subscribe system, you must report the refunds to Vindicia so that ChargeGuard can use them when disputing chargebacks. To report refunds in batch mode, first construct a batch of `Refund` objects, as shown above. For more information, see The Refund Object in the [Vindicia Subscribe SOAP API Reference Guide](https://docs.vindicia.com/bundle/b_SOAPAPIGuide).

**Parent topic:**[Data Reporting to Vindicia](../topics/Data_Reporting_to_Vindic)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.