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'); $pm->setCurrency('MYR'); // This guarantees that validation transactions use MYR currency $hostedPageInfo = new HostedPage(); $hostedPageInfo->setCountryCode('MY'); $hostedPageInfo->setLanguage('en'); $hostedPageInfo->setReturnUrl('http://www.vindicia.com/'); // specify a page on your site customer will be redirected to after completing the MOLPay payment $hostedPageInfo->setProcessorPaymentMethodId('credit'); // If the billing plan is recurring, customer can pay with credit card only $provider = new PaymentProvider(); $provider->setName('MOLPay'); $hostedPageInfo->setPaymentProvider($provider); $pm->setHostedPage($hostedPageInfo); $abill = new AutoBill(); $abill->setCurrency('MYR'); // AutoBill will be billed in this currency. Make sure the Product and BillingPlan has prices in MYR $abill->setMerchantAutoBillId('VINTEST-AB-' . rand(10000, 99999)); // Unique subscription ID $abill->setAccount($account); $abill->setPaymentMethod($pm);