> ## 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.

# Verifying AVS and CVN for Recurring Billing

Using AVS (Address Verification System) verification requires that the `PaymentMethod` object that represents the credit card contain a billing address. Using CVN (Card Verification Number) verification requires that the `PaymentMethod` object contain the security code from the back of the card. Pass the security code from the credit-card owner to Subscribe using a name–value pair on the `PaymentMethod` object. In this pair, set the name to `CVN` (the Subscribe generic name for all security codes) and the value to the *security code*.

**Note:** PCI regulations prohibit storing a credit card’s CVN security code beyond the limited time frame for verification. Do not store the CVN security code in your system. Vindicia retains it only for as long as it is needed for authorization, and then discards it.

Authorization data from your payment processor for the transaction is located in the `transactionStatus` field (see Section 18: The Transaction Object in the **Subscribe API Guide,** for more information) returned by the `AutoBill.update()` call. Ensure that your code examines this field.

* If the credit card is approved, the `TransactionStatus` object’s `status` attribute is set to `Authorized`; if not, it is set to `Cancelled`.

* Subscribe interprets the AVS response code from your payment processor, which can vary from processor to processor, and sets `vinAVS` to one of the values specified in the `AVSMatchType` enumeration (see the AVSMatchType Subobject in the **Subscribe API Guide**).

  The values of AVS response codes interpreted by Subscribe from your payment processor are in simple English: `Match`, `Partial Match`, `No Match`, `No Opinion`, `Not Supported`, and `Issuer Error`. To retrieve the actual response code, look up the `TransactionStatusCreditCard` object inside the `TransactionStatus` object (`creditCardStatus` attribute). The `CreditCardStatus` object contains an attribute called `avsCode`, which contains the return code received from your payment processor.

* The values of CVN response codes interpreted by Subscribe from your payment processor are in simple English:`Match`, `Not Processed`, `Not Supported`, `Not Present`, `Invalid`, and `No Response`. To examine the CVN response code, use the `cvnCode` attribute of the `TransactionStatusCreditCard` object inside the `TransactionStatus` object (`creditCardStatus` attribute). `cvnCode` contains the response from your payment processor for the security code you sent with the payment method.

Refer to the documentation from your payment processor for the translation of the return codes; they vary from processor to processor.

```

$paymentMethod1 = new PaymentMethod();
 
$paymentMethod1->setAccountHolderName("John Doe");
 
// To create billing address information, create an address object
$address = new Address();
$address->setAddr1('123 Main Street');
$address->setAddr2('Apt. 4');
$address->setCity('San Carlos');
 
// populate other address attributes here
 
// Billing address on payment method is required to
// implement address verification
$paymentMethod1->setBillingAddress($address);
 
$paymentMethod1->setType('CreditCard');
 
$card = new CreditCard();
$card->setAccount('4444222211113333');
$card->setExpirationDate(’xxxxxx’); // Use YYYYMM format for date
 
$paymentMethod1->setCreditCard($card);
 
$nv = new NameValuePair();
$nv->setName("CVN");
$nv->setValue("123"); 
   // this is the card security code provided by customer
 
// set the card security code inside the payment method 
$paymentMethod1->setNameValues(array($nv));
 
$account = new Account();
// populate other account attributes here
 
$account->setPaymentMethods(array($paymentMethod1));
 
$abill = new AutoBill();
$abill->setAccount($account);
 
$minChargebackProbability = 50;
$immediateAuthFailurePolicy = 'doNotSaveAutoBill';
$validateForFuturePayment = true;
//Choose one of the following immediateAuthFailurePolicy options:
//doNotSaveAutoBill: (Default) deletes the AutoBill without saving it.
//putAutoBillInRetryCycle: Creates AutoBill and retries the authorizaton.
//putAutoBillInRetryCycleIfPaymentMethodIsValid (recommended)
 
// Now call update to create the autobill on Subscribe servers
 
$response = $autobill->
      update($immediateAuthFailurePolicy,
      $validateForFuturePayment, 
      $minChargebackProbability);
 
if($response['returnCode'] == 200) {
   print "Credit card was approved and subscription created. \n";
}
else if ($response['returnCode'] == 402) {
   print "Payment method was not approved "
   $txStatus = $response['authStatus'];
   $authCode = $txStatus->getCreditCardStatus()->getAuthCode();
   print "Auth code received from processor " . $authCode . "\n";
}
```

**Note:** Use the results from the of credit-card security code verifications to determine whether to create an `AutoBill` object, or update one with a new payment method. Once you have created an `AutoBill` object and started generating transactions, these verification mechanisms may no longer be used. PCI regulations forbid the storage of credit-card security codes. Because Subscribe does not store these numbers, Subscribe is unable to perform verification for subsequent transactions using the payment method for the `AutoBill` object when it was first created.

**Parent topic:**[Creating AutoBills](../topics/Creating_AutoBills)


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