function Step2CreateCreditCard($merchantAccountId) { // $account = get_account_by_merchantAccountId($merchantAccountId); //To save a soap call, you can use sparse objects. $account = new Account(); $account->merchantAccountId = $merchantAccountId; $merchantPaymentMethodId = $merchantAccountId; $paymentMethod = new PaymentMethod(); $cc = new CreditCard(); $paymentMethod->setBillingAddress($account->shippingAddress); $paymentMethod->setMerchantPaymentMethodId($merchantPaymentMethodId); // Use Test cards only in ProdTest. Use Real cards only in Production. $cc->setAccount("4112344112344113"); $cc->setExpirationDate("201811"); $paymentMethod->setType('CreditCard'); $paymentMethod->setCreditCard($cc); // Do not check AVS, CVN. Do not validate. $replaceOnAutoBills = true; $updateBehavior = "Update"; $ignoreAvsPolicy = true; $ignoreCvnPolicy = true; $srd = ''; $response = $account->updatePaymentMethod($srd, $paymentMethod, $replaceOnAutoBills, $updateBehavior, $ignoreAvsPolicy, $ignoreCvnPolicy); // Log soap id for each API call. // $log->addDebug('Method = Account.updatePaymentMethod' . PHP_EOL); // $log->addDebug('Soap Id = ' . $response['data']->return->soapId . PHP_EOL); // $log->addDebug('Return Code = ' . $response['returnCode'] . PHP_EOL); // $log->addDebug('Return String = ' . $response['returnString'] . PHP_EOL); if ($response['returnCode'] == 200) { print "Call succeeded" . PHP_EOL; } else { print "Call failed" . PHP_EOL; } }
function create_ecp_PaymentMethod() { $uniqueValue = get_unique_value(); $merchantAccountId = 'account-' . $uniqueValue; $merchantPaymentMethodId = 'pm-' . $uniqueValue; $email = get_unique_value() . '@nomail.com'; $successUrl = 'http://good.com/'; //need a trailing slash $errorUrl = 'http://bad.com/'; //need a trailing slash $name = 'John Vindicia'; $addr1 = '303 Twin Dolphin Drive'; $city = 'Redwood City'; $district = 'CA'; $postalCode = '94065'; $country = 'US'; $address = new Address(); $address->setName($name); $address->setAddr1($addr1); $address->setCity($city); $address->setDistrict($district); $address->setPostalCode($postalCode); $address->setCountry($country); $paymentmethod = new PaymentMethod(); $paymentmethod->setType('ECP'); $paymentmethod->setAccountHolderName($name); $paymentmethod->setBillingAddress($address); $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId); $paymentmethod->setCurrency('USD'); $ecp = new ECP(); $ecp->setAccount('495958930'); $ecp->setRoutingNumber('611111111'); $ecp->setAllowedTransactionType('Inbound'); $ecp->setAccountType('ConsumerChecking'); $paymentmethod->setECP($ecp); $account = new Account(); $account->setMerchantAccountId($merchantAccountId); $account->setEmailAddress($email); $account->setShippingAddress($address); $account->setEmailTypePreference('html'); $account->setName($name); $account->setPaymentMethods(array($paymentmethod)); return $account; }
function create_paypal_PaymentMethod() { $uniqueValue = get_unique_value(); $merchantAccountId = 'account-' . $uniqueValue; $merchantPaymentMethodId = 'pm-' . $uniqueValue; $email = get_unique_value() . '@nomail.com'; $successUrl = 'http://good.com/'; //need a trailing slash $errorUrl = 'http://bad.com/'; //need a trailing slash $name = 'John Vindicia'; $addr1 = '303 Twin Dolphin Drive'; $city = 'Redwood City'; $district = 'CA'; $postalCode = '94065'; $country = 'US'; $address = new Address(); $address->setName($name); $address->setAddr1($addr1); $address->setCity($city); $address->setDistrict($district); $address->setPostalCode($postalCode); $address->setCountry($country); $paymentmethod = new PaymentMethod(); $paymentmethod->setType('PayPal'); $paymentmethod->setAccountHolderName($name); $paymentmethod->setBillingAddress($address); $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId); $paymentmethod->setCurrency('USD'); $paypal = new PayPal(); $paypal->setReturnUrl($successUrl); $paypal->setCancelUrl($errorUrl); $paymentmethod->setPaypal($paypal); $account = new Account(); $account->setMerchantAccountId($merchantAccountId); $account->setEmailAddress($email); $account->setShippingAddress($address); $account->setEmailTypePreference('html'); $account->setName($name); //$account->setPaymentMethods(array($paymentmethod)); //return $account; return array('account' => $account, 'paymentmethod' => $paymentmethod); }
<?php require_once "Vindicia/Soap/Vindicia.php"; require_once "Vindicia/Soap/Const.php"; $account = new Account(); // existing customer's Account ID. Tax will be added based on shippingAddress populated on this Account $account->setMerchantAccountId("jdoe101"); $pm = new PaymentMethod(); $pm->setMerchantPaymentMethodId('VINTESTPM-' . rand(10000, 99999)); // Unique payment method id $pm->setType('HostedPage'); $hostedPageInfo = new HostedPage(); $hostedPageInfo->setCountryCode('MY'); $hostedPageInfo->setLanguage('en'); $hostedPageInfo->setReturnUrl('http://www.mysite.co.my/PaymentReturn.php'); // specify a page on your site customer will be redirected to after completing the MOLPay payment $hostedPageInfo->setProcessorPaymentMethodId('all'); // Customer can choose any payment method type at MOLPay $provider = new PaymentProvider(); $provider->setName('MOLPay'); $hostedPageInfo->setPaymentProvider($provider); $pm->setHostedPage($hostedPageInfo); $transaction = new Transaction(); $transaction->setCurrency('MYR'); // Unique transaction ID, use prefix to tell transactions apart from the subscription transactions $transaction->setMerchantTransactionId('VINTEST-' . rand(10000, 99999)); $transaction->setAccount($account); $transaction->setSourcePaymentMethod($pm); //Create purchase line items. This can also be created by looking up a CashBox Product $transaction_lineItem0 = new TransactionItem(); $transaction_lineItem0->setSku('MYPRODUCT001');
<?php require_once 'Vindicia/Soap/Vindicia.php'; require_once 'Vindicia/Soap/Const.php'; $ab = $argv[1]; $pmId = $argv[2]; print "autobill is {$ab}\n"; $paypal = new PayPal(); $paypal->setReturnUrl('http://localhost:8888/success.php'); $paypal->setCancelUrl('http://localhost:8888/cancellation.php'); $paypal->setRequestReferenceId(1); $pm = new PaymentMethod(); $pm->setMerchantPaymentMethodId($pmId); $pm->setType('PayPal'); $pm->setPayPal($paypal); $autobill = new AutoBill(); $autobill->setMerchantAutoBillId($ab); $autobill->setPaymentMethod($pm); $immediateAuthFailurePolicy = 'doNotSaveAutoBill'; $validateForFuturePayment = 0; $fraudScore = 100; $ignoreAVS = 1; $ignoreCVN = 1; $dryrun = 1; $dryrun = $argv[3]; $coupon = NULL; $response = $autobill->update('', $immediateAuthFailurePolicy, $validateForFuturePayment, $fraudScore, $ignoreAVS, $ignoreCVN, $coupon, $dryrun, ''); print_r($response); $return_code = $response['returnCode']; $return_string = $response['returnString']; print "Return code is {$return_code} \n";
<?php ini_set('include_path', '/usr/local'); ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once 'Vindicia/Soap/Vindicia.php'; require_once 'Vindicia/Soap/Const.php'; $ccnum = $argv[1]; $pm = new PaymentMethod(); $pm->setType('CreditCard'); $cc = new CreditCard(); $cc->setAccount($ccnum); $pm->setCreditCard($cc); $acct = new Account(); $page = 0; $pageSize = 1000; // max 1000 records per page do { $count = 0; $response = $acct->fetchByPaymentMethod('', $pm, $page, $pageSize); $return_code = $response['returnCode']; print "Return Code is: {$return_code} \n"; print_r($response); if ($return_code == 200) { $accounts = $response['data']->accounts; //$count = sizeof($accounts); foreach ($accounts as $account) { // process each account found here print "Found account with id: " . $account->getMerchantAccountId() . "\n"; $acct_name = $account->getname(); $acct_zip = $account->paymentMethods[0]->billingAddress->postalCode;
<?php require_once 'Vindicia/Soap/Vindicia.php'; require_once 'Vindicia/Soap/Const.php'; $abID = $argv[1]; $amount = $argv[2]; $currency = 'USD'; $invoiceId = $argv[3]; $overageDisposition = NULL; $useForFutureRebills = 0; $note = 'Payment Made'; $pmID = "pm" . rand(1000, 9999) . "-" . rand(1000, 999999); $map = new MerchantAcceptedPayment(); $map->setPaymentType('Check'); $map->setAccount('123456789'); $pm = new PaymentMethod(); $pm->setType('MerchantAcceptedPayment'); $pm->setMerchantAcceptedPayment($map); $pm->setMerchantPaymentMethodId($pmID); $autobill = new AutoBill(); $autobill->setMerchantAutoBillId($abID); $response = $autobill->makePayment($pm, $amount, $currency, $invoiceId, $overageDisposition, $useForFutureRebills, $note); print_r($response);
public static function readTransaction($str_xml) { // Parser $parser = new xmlParser($str_xml); // <transaction> $data = $parser->getResult('transaction'); $transaction = new Transaction(); // <transaction> <lastEventDate> if (isset($data["lastEventDate"])) { $transaction->setLastEventDate($data["lastEventDate"]); } // <transaction> <date> if (isset($data["date"])) { $transaction->setDate($data["date"]); } // <transaction> <code> if (isset($data["code"])) { $transaction->setCode($data["code"]); } // <transaction> <reference> if (isset($data["reference"])) { $transaction->setReference($data["reference"]); } // <transaction> <type> if (isset($data["type"])) { $transaction->setType(new TransactionType($data["type"])); } // <transaction> <status> if (isset($data["status"])) { $transaction->setStatus(new TransactionStatus($data["status"])); } if (isset($data["paymentMethod"]) && is_array($data["paymentMethod"])) { // <transaction> <paymentMethod> $paymentMethod = new PaymentMethod(); // <transaction> <paymentMethod> <type> if (isset($data["paymentMethod"]['type'])) { $paymentMethod->setType(new PaymentMethodType($data["paymentMethod"]['type'])); } // <transaction> <paymentMethod> <code> if (isset($data["paymentMethod"]['code'])) { $paymentMethod->setCode(new PaymentMethodCode($data["paymentMethod"]['code'])); } $transaction->setPaymentMethod($paymentMethod); } // <transaction> <grossAmount> if (isset($data["grossAmount"])) { $transaction->setGrossAmount($data["grossAmount"]); } // <transaction> <discountAmount> if (isset($data["discountAmount"])) { $transaction->setDiscountAmount($data["discountAmount"]); } // <transaction> <feeAmount> if (isset($data["feeAmount"])) { $transaction->setFeeAmount($data["feeAmount"]); } // <transaction> <netAmount> if (isset($data["netAmount"])) { $transaction->setNetAmount($data["netAmount"]); } // <transaction> <extraAmount> if (isset($data["extraAmount"])) { $transaction->setExtraAmount($data["extraAmount"]); } // <transaction> <installmentCount> if (isset($data["installmentCount"])) { $transaction->setInstallmentCount($data["installmentCount"]); } if (isset($data["items"]['item']) && is_array($data["items"]['item'])) { $items = array(); $i = 0; if (isset($data["items"]['item'][0])) { foreach ($data["items"]['item'] as $key => $value) { $item = self::parseTransactionItem($value); $items[$i] = $item; $i++; } } else { $items[0] = self::parseTransactionItem($data["items"]['item']); } // <transaction> <items> $transaction->setItems($items); } if (isset($data["sender"])) { // <transaction> <sender> $sender = new Sender(); // <transaction> <sender> <name> if (isset($data["sender"]["name"])) { $sender->setName($data["sender"]["name"]); } // <transaction> <sender> <email> if (isset($data["sender"]["email"])) { $sender->setEmail($data["sender"]["email"]); } if (isset($data["sender"]["phone"])) { // <transaction> <sender> <phone> $phone = new Phone(); // <transaction> <sender> <phone> <areaCode> if (isset($data["sender"]["phone"]["areaCode"])) { $phone->setAreaCode($data["sender"]["phone"]["areaCode"]); } // <transaction> <sender> <phone> <number> if (isset($data["sender"]["phone"]["number"])) { $phone->setNumber($data["sender"]["phone"]["number"]); } $sender->setPhone($phone); } $transaction->setSender($sender); } if (isset($data["shipping"]) && is_array($data["shipping"])) { // <transaction> <shipping> $shipping = new Shipping(); // <transaction> <shipping> <type> if (isset($data["shipping"]["type"])) { $shipping->setType(new ShippingType($data["shipping"]["type"])); } // <transaction> <shipping> <cost> if (isset($data["shipping"]["cost"])) { $shipping->setCost($data["shipping"]["cost"]); } if (isset($data["shipping"]["address"]) && is_array($data["shipping"]["address"])) { // <transaction> <shipping> <address> $address = new Address(); // <transaction> <shipping> <address> <street> if (isset($data["shipping"]["address"]["street"])) { $address->setStreet($data["shipping"]["address"]["street"]); } // <transaction> <shipping> <address> <number> if (isset($data["shipping"]["address"]["number"])) { $address->setNumber($data["shipping"]["address"]["number"]); } // <transaction> <shipping> <address> <complement> if (isset($data["shipping"]["address"]["complement"])) { $address->setComplement($data["shipping"]["address"]["complement"]); } // <transaction> <shipping> <address> <city> if (isset($data["shipping"]["address"]["city"])) { $address->setCity($data["shipping"]["address"]["city"]); } // <transaction> <shipping> <address> <state> if (isset($data["shipping"]["address"]["state"])) { $address->setState($data["shipping"]["address"]["state"]); } // <transaction> <shipping> <address> <district> if (isset($data["shipping"]["address"]["district"])) { $address->setDistrict($data["shipping"]["address"]["district"]); } // <transaction> <shipping> <address> <postalCode> if (isset($data["shipping"]["address"]["postalCode"])) { $address->setPostalCode($data["shipping"]["address"]["postalCode"]); } // <transaction> <shipping> <address> <country> if (isset($data["shipping"]["address"]["country"])) { $address->setCountry($data["shipping"]["address"]["country"]); } $shipping->setAddress($address); } // <transaction> <shipping> $transaction->setShipping($shipping); } return $transaction; }