<?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";
$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);