$customer = $return['data']->account;
// This example is assuming we already know it's the default PM and type is Credit Card
$pm = $customer->paymentMethods[0];
$nv = new NameValuePair();
$nv->setName('CVN');
$nv->setValue('123');
$pm->setNameValues(array($nv));
$transaction = new Transaction();
$transaction->setCurrency('USD');
$transaction->setMerchantTransactionId('testTrx-' . rand(10000, 99999));
$transaction->setAccount($customer);
$transaction_lineItem0 = new TransactionItem();
$transaction_lineItem0->setSku('RMMTEST002');
$transaction_lineItem0->setName('LineItem 1');
$transaction_lineItem0->setMerchantAutoBillItemId('foobar');
$transaction_lineItem0->setPrice('99.99');
$transaction_lineItem0->setQuantity('1');
// Campaign Code can be assigned to each individual line item:
$transaction_lineItem0->setCampaignCode('promo2');
$lineitems = array($transaction_lineItem0);
$transaction->setTransactionItems($lineitems);
$transaction->setSourcePaymentMethod($pm);
// we can choose to send email for one-time transactions, or not
$sendEmailNotification = 1;
// use the default CashBox AVS and CVN policy
$ignoreAvsPolicy = 0;
$ignoreCvnPolicy = 0;
// Campaign Code can also be passed in to the call as a param to apply to all eligible items
//$campaign = 'promo2';
$response = $transaction->authCapture($sendEmailNotification, $ignoreAvsPolicy, $ignoreCvnPolicy, $campaign, $dryrun);
print_r($response);
$testId = rand(1, 1000000);
// random number for some unique IDs
$tx = new Transaction();
$tx->setMerchantTransactionId('DRYRUN-' . $testId);
$acct = new Account();
$acct->setMerchantAccountId('jdoe101');
// existing customer account ID
$tx->setAccount($acct);
$tx->setCurrency('USD');
$txItem1 = new TransactionItem();
$txItem1->setSku('ppv-movie-us-prem');
$txItem1->setName('Premium Pay-per-view movie (English)');
$txItem1->setPrice(5.99);
$txItem1->setQuantity(1);
$txItem1->setTaxClassification('DM030000');
$txItem1->setCampaignCode('PPV2015US');
$txItem2 = new TransactionItem();
$txItem2->setSku('smAccess2015');
$txItem2->setName('Social Media Chat Access');
$txItem2->setPrice(2.0);
$txItem2->setQuantity(1);
$txItem2->setTaxClassification('D0000000');
$tx->setTransactionItems(array($txItem1, $txItem2));
$addr = new Address();
$addr->setAddr1('809 Cuesta Dr');
$addr->setCity('Mountain View');
$addr->setDistrict('CA');
$addr->setPostalCode('94040');
$addr->setCountry('US');
$tx->setShippingAddress($addr);
// for tax calculation purposes