Subscription start date is required (recurring) - codeigniter

i am trying to do Recurring Payments on my site. but i gettin a problem here.
its is giving ack=Fail
[TIMESTAMP] => 2012-06-21T04:36:01Z
[CORRELATIONID] => fe0a920b9dee5
[ACK] => Failure
[VERSION] => 65.1
[BUILD] => 3067390
[L_ERRORCODE0] => 11549
[L_SHORTMESSAGE0] => Start Date is required
[L_LONGMESSAGE0] => Subscription start date is required
[L_SEVERITYCODE0] => Error
while my code for the reoccuring which i am passing is
function DoRecuringPayment($paymentInfo=array()){
/**
* Get required parameters from the web form for the request
*/
$paymentType =urlencode('Sale');
$firstName =urlencode($paymentInfo['Member']['first_name']);
$lastName =urlencode($paymentInfo['Member']['last_name']);
$creditCardType =urlencode($paymentInfo['CreditCard']['credit_type']);
$creditCardNumber = urlencode($paymentInfo['CreditCard']['card_number']);
$expDateMonth =urlencode($paymentInfo['CreditCard']['expiration_month']);
$padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT);
$expDateYear =urlencode($paymentInfo['CreditCard']['expiration_year']);
$cvv2Number = urlencode($paymentInfo['CreditCard']['cv_code']);
$address1 = urlencode($paymentInfo['Member']['billing_address']);
$address2 = urlencode($paymentInfo['Member']['billing_address2']);
$country = urlencode($paymentInfo['Member']['billing_country']);
$city = urlencode($paymentInfo['Member']['billing_city']);
$state =urlencode($paymentInfo['Member']['billing_state']);
$zip = urlencode($paymentInfo['Member']['billing_zip']);
$bperiod=urlencode( $paymentInfo['Bill']['month']); ;
$bfrequency=urlencode($paymentInfo['bill']['frequency']);
$amount = urlencode($paymentInfo['Order']['theTotal']);
$currencyCode="USD";
$time22= date('Y-m-d',time());
$startdate=urlencode(date('Y-m-d',time()));
$paymentType=urlencode('Sale');
$ip=$_SERVER['REMOTE_ADDR'];
/* Construct the request string that will be sent to PayPal.
The variable $nvpstr contains all the variables and is a
name value pair string with & as a delimiter */
$nvpstr="&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber&EXPDATE=".$padDateMonth.$expDateYear."&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName&STREET=$address1&CITY=$city&STATE=$state".
"&ZIP=$zip&COUNTRYCODE=US&CURRENCYCODE=$currencyCode&PROFILESTARTDATE=$startdate&BILLINGPERIOD=$bperiod&BILLINGFREQUENCY=$bfrequency";
/* Make the API call to PayPal, using API signature.
The API response is stored in an associative array called $resArray */
$resArray=$this->hash_call("CreateRecurringPaymentsProfile",$nvpstr);
/* Display the API response back to the browser.
If the response from PayPal was a success, display the response parameters'
If the response was an error, display the errors received using APIError.php.
*/
return $resArray;
//Contains 'TRANSACTIONID,AMT,AVSCODE,CVV2MATCH, Or Error Codes'
}
I geting the error Subscription start date is required.

Related

Laravel to zapier webhook: How to avoid resource exhaustion?

My project requires me to retrieve inbound & outbound mails, retrieve the recipient emails, cc emails, sender email, store the retrieved emails in the database, do some computation, and update or create a row in google sheets.
My steps to doing the task:
In zapier, I have create zaps that triggers when receiving, and sending mails.
In my laravel, I have a function that receives and stores the data in the database from zapier when the receive/sent zap triggers.
After storing all the data, the function will then return the email, email domains of the inserted data, which will then be passed to the computation function.
I also have a zap that updates the google sheet. (My api -> Webhooks by Zapier -> Google Sheet)
After the computation, the computed data, in a form of multidimensional array, loop through it, and call the Update sheet webhook endpoint in each iteration.
A sample code, let's do example for sending mails:
// Controller
public function sent(Request $request)
{
$recipients = explode(",", $request->recipients); // Need to explode since the recipients is being received as comma delimited string.
$ccs = explode(",", $request->ccs); // Need to explode since the cc emails is being received as comma delimited string.
ProcessMail::dispatch($recipients, $ccs);
}
// Service class responsible for doing the logic
public function processSent($recipients, $ccs)
{
$new_recipients = [];
$new_ccs = [];
foreach ($recipients as $recipient) {
$domain = explode('#', $recipient)[1];
$recipientModel = tap(Mail::updateOrCreate(
['email' => $recipient, 'domain' => $domain],
))->increment('count_column');
$new_recipients[] = [
'email' => $recipient,
'domain' => $domain,
'count_column' => $recipientModel->count_column,
];
}
// Same process for the cc emails
return array_merge($new_recipients, $new_ccs);
}
// ProcessMail Job
$recipients_and_ccs = $service->processSent($recipients, $ccs);
Http::pool(function (Pool $pool) use ($service, $recipients_and_ccs ) {
foreach ($recipients_and_ccs as $key => $rec_cc) {
$addtl_rows = $service->getAddtlRows($rec_cc['email'], $rec_cc['domain']);
// The purpose of this to append 5 additional key value pair in the array.
for ($i = 0; $i < 5; $i++) {
$rec_cc["addt_row_{$i}"] = isset($addt_rows[$i]) ? 'this' : 'that';
}
$pool->as("pool-{$key}")->withBody(json_encode($rec_cc), 'json')->post('ZAPIER_ENDPOINT');
return $pool;
}
});
Now, when I send a mail to 50 recipients, some of the task in the zap will stop with error saying: The app returned "Resource has been exhausted (e.g. check quota)."..
One solution that I can think of is to chunk the $recipients_and_ccs by desirable amount of rows, say 10 records per chunk.
But before I start with my solution. It would be really great to hear some more pro/optimized solution.

Codeigniter sending out multiple emails

I am using codeigniters email class inside an Expression Engine plugin (EE runs off CI).
For some reason each time the plugin is run it sends out 2 emails, instead of 1. The emails are identical.
{exp:cdwd_emailer:questionnaire type="{segment_3}" entry_id="{segment_4}"}
Here is the function being called by the above.
public function questionnaire() {
$type = $this->EE->TMPL->fetch_param('type');
$typeLower = str_replace("-", " ", $type);
$typeUpper = ucwords($typeLower);
print_r($type);
$entry_id = $this->EE->TMPL->fetch_param('entry_id');
$subject = $typeUpper.' Questionnaire Submission';
$fromEmail = 'email#email.com';
$fromName = 'Test Name';
$toEmail = 'email#email.com';
$message = '
<p>A new '.$typeLower.' has been submitted.</p>
<p>Please click here to view this submission</p>
';
$this->EE->load->library('email');
$this->EE->email->set_mailtype("html");
$this->EE->email->from($fromEmail, $fromName);
$this->EE->email->to($toEmail);
$this->EE->email->subject($subject);
$this->EE->email->message($message);
$this->EE->email->send();
}
Can anyone tell me why? I can't figure it out. I printed out the contents of the type and entry_id params to check only 1 of each are being collected.
Thanks
I think you have to clear you email object after sending mail.
As per Expression Engine, you have to call:
ee()->email->clear();
For your case:
$this->EE->email->clear();

How to Create a Recurring Payments Profile with Express Checkout

I'm currently integrating the paypal recurring payment process in my website. i used this code
function process()
{
include_once("config.php");
include_once("paypal.class.php");
if($_POST) //Post Data received from product list page.
{
//Mainly we need 4 variables from an item, Item Name, Item Price, Item Number and Item Quantity.
$ItemName = $_POST["itemname"]; //Item Name
$ItemPrice = $_POST["itemprice"]; //Item Price
$ItemNumber = $_POST["itemnumber"]; //Item Number
$ItemQty = $_POST["itemQty"]; // Item Quantity
$ItemTotalPrice = ($ItemPrice*$ItemQty); //(Item Price x Quantity = Total) Get total amount of product;
//Data to be sent to paypal
$padata = '&CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTACTION=Sale'.
'&ALLOWNOTE=1'.
'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTREQUEST_0_AMT='.urlencode($ItemTotalPrice).
'&PAYMENTREQUEST_0_ITEMAMT='.urlencode($ItemTotalPrice).
'&L_PAYMENTREQUEST_0_QTY0='. urlencode($ItemQty).
'&L_PAYMENTREQUEST_0_AMT0='.urlencode($ItemPrice).
'&L_PAYMENTREQUEST_0_NAME0='.urlencode($ItemName).
'&L_PAYMENTREQUEST_0_NUMBER0='.urlencode($ItemNumber).
'&AMT='.urlencode($ItemTotalPrice).
'&L_BILLINGTYPE0='.urlencode('RecurringPayments').
'&L_BILLINGAGREEMENTDESCRIPTION0='.urlencode('message plan').
'&RETURNURL='.urlencode($PayPalReturnURL ).
'&CANCELURL='.urlencode($PayPalCancelURL);
//We need to execute the "SetExpressCheckOut" method to obtain paypal token
$paypal= new MyPayPal();
$httpParsedResponseAr = $paypal->PPHttpPost('SetExpressCheckout', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
//Respond according to message we receive from Paypal
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{
// If successful set some session variable we need later when user is redirected back to page from paypal.
$_SESSION['itemprice'] = $ItemPrice;
$_SESSION['totalamount'] = $ItemTotalPrice;
$_SESSION['itemName'] = $ItemName;
$_SESSION['itemNo'] = $ItemNumber;
$_SESSION['itemQTY'] = $ItemQty;
if($PayPalMode=='sandbox')
{
$paypalmode = '.sandbox';
}
else
{
$paypalmode = '';
}
//Redirect user to PayPal store with Token received.
$paypalurl ='https://www'.$paypalmode.'.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='.$httpParsedResponseAr["TOKEN"].'';
header('Location: '.$paypalurl);
}else{
//Show error message
echo '<div style="color:red"><b>Error : </b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
}
}
//Paypal redirects back to this page using ReturnURL, We should receive TOKEN and Payer ID
if(isset($_GET["token"]) && isset($_GET["PayerID"]))
{
//we will be using these two variables to execute the "DoExpressCheckoutPayment"
//Note: we haven't received any payment yet.
$token = $_GET["token"];
$playerid = $_GET["PayerID"];
//get session variables
$ItemPrice = $_SESSION['itemprice'];
$ItemTotalPrice = $_SESSION['totalamount'];
$ItemName = $_SESSION['itemName'];
$ItemNumber = $_SESSION['itemNo'];
$ItemQTY =$_SESSION['itemQTY'];
$padata = '&TOKEN='.urlencode($token).
'&PAYERID='.urlencode($playerid).
'&PAYMENTACTION='.urlencode("SALE").
'&AMT='.urlencode($ItemTotalPrice).
'&CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&NOTIFYURL='.urlencode('http://mywebiste.com/listner');
//We need to execute the "DoExpressCheckoutPayment" at this point to Receive payment from user.
$paypal= new MyPayPal();
$httpParsedResponseAr = $paypal->PPHttpPost('DoExpressCheckoutPayment', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
//Check if everything went ok..
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{
echo '<h2>Success</h2>';
echo 'Your Transaction ID :'.urldecode($httpParsedResponseAr["TRANSACTIONID"]);
/*
//Sometimes Payment are kept pending even when transaction is complete.
//May be because of Currency change, or user choose to review each payment etc.
//hence we need to notify user about it and ask him manually approve the transiction
*/
if('Completed' == $httpParsedResponseAr["PAYMENTSTATUS"])
{
echo '<div style="color:green">Payment Received! Your product will be sent to you very soon!</div>';
}
elseif('Pending' == $httpParsedResponseAr["PAYMENTSTATUS"])
{
echo '<div style="color:red">Transaction Complete, but payment is still pending! You need to manually authorize this payment in your <a target="_new" href="http://www.paypal.com">Paypal Account</a></div>';
}
echo '<br /><b>Stuff to store in database :</b><br /><pre>';
$transactionID = urlencode($httpParsedResponseAr["TRANSACTIONID"]);
$nvpStr = "&TRANSACTIONID=".$transactionID;
$paypal= new MyPayPal();
$httpParsedResponseAr = $paypal->PPHttpPost('GetTransactionDetails', $nvpStr, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
$nvpstr="&TOKEN=".$_GET['token'];
$nvpstr.="&BILLINGPERIOD=Month";
$nvpstr.="&BILLINGFREQUENCY=1";
$nvpstr.="&AMT=1";
$nvpstr.="&CURRENCYCODE=USD";
$nvpstr.="&COUNTRYCODE=US";
$nvpstr.="&PAYERID=".$httpParsedResponseAr['PAYERID'];
$nvpstr.="&PROFILESTARTDATE=".date('Y-m-d');
$recurr = $paypal->PPHttpPost('CreateRecurringPaymentsProfile',$nvpStr,$PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
print_r($recurr);
} else {
echo '<div style="color:red"><b>GetTransactionDetails failed:</b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
}
}else{
echo '<div style="color:red"><b>Error : </b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
}
}
}
i am getting token and payer id etc . its all working fine. but when i try to create recurring profile iam getting this response
Array
(
[TIMESTAMP] => 2013%2d03%2d18T05%3a32%3a06Z
[CORRELATIONID] => 912b6004f40bb
[ACK] => Failure
[VERSION] => 76%2e0
[BUILD] => 5294323
[L_ERRORCODE0] => 11585
[L_ERRORCODE1] => 11518
[L_ERRORCODE2] => 11516
[L_ERRORCODE3] => 11519
[L_ERRORCODE4] => 11549
[L_SHORTMESSAGE0] => Missing%20Token%20or%20payment%20source
[L_SHORTMESSAGE1] => Invalid%20billing%20period%2e
[L_SHORTMESSAGE2] => Invalid%20billing%20frequency
[L_SHORTMESSAGE3] => Invalid%20amount
[L_SHORTMESSAGE4] => Start%20Date%20is%20required
[L_LONGMESSAGE0] => Missing%20Token%20or%20buyer%20credit%20card
[L_LONGMESSAGE1] => Billing%20period%20must%20be%20one%20of%20Day%2c%20Week%2c%20SemiMonth%2c%20or%20Year
[L_LONGMESSAGE2] => Billing%20frequency%20must%20be%20%3e%200%20and%20be%20less%20than%20or%20equal%20to%20one%20year
[L_LONGMESSAGE3] => Bill%20amount%20must%20be%20greater%20than%200
[L_LONGMESSAGE4] => Subscription%20start%20date%20is%20required
[L_SEVERITYCODE0] => Error
[L_SEVERITYCODE1] => Error
[L_SEVERITYCODE2] => Error
[L_SEVERITYCODE3] => Error
[L_SEVERITYCODE4] => Error
)
i dont know where i did wrong in this.
thank you.
Your request is missing a bunch of parameters which are required to create a recurring payment profile. Please refer to https://www.x.com/developers/paypal/documentation-tools/express-checkout/integration-guide/ECRecurringPayments.
I think the procedure is wrong: the second call should be a GetExpressCheckoutDetails to retrive the PAYERID in order to be able to do a CreateRecurringPaymentsProfile.
Just follow this tutorial step by step:
https://www.x.com/developers/paypal/documentation-tools/express-checkout/how-to/ht_ec-recurringPaymentProfile-curl-etc

Sandbox Paypal Money Deduction Issues

My code:
function paiement_echec()
{
echo "payment cancelled by the user";
}
function paiement_succes()
{
// Obtain the token from PayPal.
if(!array_key_exists('token', $_REQUEST))
exit('Token is not received.');
// Set request-specific fields.
$token = urlencode(htmlspecialchars($_REQUEST['token']));
// Add request-specific fields to the request string.
$nvpStr = "&TOKEN=$token";
// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = $this->PPHttpPost('GetExpressCheckoutDetails', $nvpStr);
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{
//print_r($httpParsedResponseAr);
$payerID = urlencode($httpParsedResponseAr["PAYERID"]);
//$token = urlencode("token");
$paymentType = urlencode('Sale'); // or 'Sale' or 'Order'
$paymentAmount = urlencode("4.39");
$currencyID = urlencode("USD"); // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')
// Add request-specific fields to the request string.
$nvpStr = "&TOKEN=$token&PAYERID=$payerID&PAYMENTACTION=$paymentType&AMT=$paymentAmount&CURRENCYCODE=$currencyID";
$httpParsedResponseAr = $this->PPHttpPost('DoExpressCheckoutPayment', $nvpStr);
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{
$this->load->model('payment_model');
$this->payment_model->paypal_payment();
$msg = "<label>Thank you !! your payment is successfully done</label>
<a href='".base_url()."envoie_de_photos/envoyer_vos_photos"."'>Go To Photo Uploading</a>";
echo $msg;
}
else
{
exit('GetExpressCheckoutDetails failed: ' . print_r($httpParsedResponseAr, true));
//echo "Payment failed for unknown reason";
}
}
else
{
//exit('GetExpressCheckoutDetails failed: ' . print_r($httpParsedResponseAr, true));
echo "Payment failed for unknown reason";
}
}
function pay_by_paypal()
{
$environment = 'sandbox';
$_SESSION['item_name']=$this->input->post('item_name');
$_SESSION['amount']=$this->input->post('amount');
$_SESSION['currency_code']=$this->input->post('currency_code');
$_SESSION['no_of_photo']=$this->input->post('no_of_photo');
$qty=urlencode("1");
$product_name=urldecode($_SESSION['item_name']);
$price=urlencode($_SESSION['amount']);
//$currencyID = urlencode($_SESSION['currency_code']);
$currencyID = urlencode("USD");
// or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')
$paymentType = urlencode('Order');
$nvpStr="";
$returnURL = (base_url()."paiement/paiement_succes");
$cancelURL = (base_url()."paiement/paiement_echec");
$i=0;
$total_amount=0;
$str = "&METHOD=SetExpressCheckout
&RETURNURL=$returnURL
&CANCELURL=$cancelURL
&L_PAYMENTREQUEST_0_NAME0=$product_name
&L_PAYMENTREQUEST_0_NUMBER0=$qty
&L_PAYMENTREQUEST_0_AMT0=$price
&L_PAYMENTREQUEST_0_DESC0=$product_name
&PAYMENTREQUEST_0_AMT=$price
&PAYMENTREQUEST_0_PAYMENTACTION=$paymentType
&PAYMENTREQUEST_0_CURRENCYCODE=$currencyID";
$nvpStr=$nvpStr.$str;
$httpParsedResponseAr = $this->PPHttpPost('SetExpressCheckout', $nvpStr);
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{
// Redirect to paypal.com.
$token = urldecode($httpParsedResponseAr["TOKEN"]);
$payPalURL = "https://www.$environment.paypal.com/webscr&cmd=_express-checkout&token=$token";
if("sandbox" === $environment)
{
$payPalURL = "https://www.$environment.paypal.com/webscr&cmd=_express-checkout&token=$token";
}
header("Location: $payPalURL");
exit;
}
else
{
exit('SetExpressCheckout failed: ' . print_r($httpParsedResponseAr, true));
}
}
/** SetExpressCheckout NVP example; last modified 08MAY23.
*
* Initiate an Express Checkout transaction.
*/
/**
* Send HTTP POST Request
*
* #param string The API method name
* #param string The POST Message fields in &name=value pair format
* #return array Parsed HTTP Response body
*/
private function PPHttpPost($methodName_, $nvpStr_) {
//global $environment;
$environment = 'sandbox'; // or 'beta-sandbox' or 'live'
// Set up your API credentials, PayPal end point, and API version.
$API_UserName = urlencode('saswat_1360720799_biz_api1.gmail.com');
$API_Password = urlencode('1360720821');
$API_Signature = urlencode('ApDCeFez-N1Gd1-O3ubTGdpyiow4AlNlRemm8XJFcbsA.WbSMtlMSqHf');
$API_Endpoint = "https://api-3t.paypal.com/nvp";
if("sandbox" === $environment) {
$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
}
$version = urlencode('65.0');
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
// Turn off the server and peer verification (TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
// Set the API operation, version, and API signature in the request.
$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
// Set the request as a POST FIELD for curl.
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
// Get response from the server.
$httpResponse = curl_exec($ch);
if(!$httpResponse) {
exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
}
// Extract the response details.
$httpResponseAr = explode("&", $httpResponse);
$httpParsedResponseAr = array();
foreach ($httpResponseAr as $i => $value) {
$tmpAr = explode("=", $value);
if(sizeof($tmpAr) > 1) {
$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
}
}
if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
}
return $httpParsedResponseAr;
}
I have three accounts in the Paypal sandbox: two business and one personal. All of my Paypal accounts have USD as default currency.
In the above code I was using EUR as a currency.
When I am carrying out transaction, if I am paying from my personal (buyer) account in EUR, then my buyer account is getting money deducted (equivalent amount of USD is getting subtracted from my buyer account). This is totally fine, there is no issue with that.
The problem is that no amount is getting added to my business or (seller) account.
I found a post on Stack Overflow that reads:
if the currencycode of the transaction and the seller account doesnt
match, then money doesnt get aded to sellers account
I changed the euro to USD, (since my sandbox seller test account is in USD) and found out that, after converting it into USD, then my money is getting added to my seller account.
Is this a problem with the sandbox only, or does it apply to live paypal as well?
I have a site where buyers can pay in GBP, EUR, MYN, SGD, AUD.
If the transaction needs to be carried out in particular currency, that is the currency set as per the seller account, then there's no need to use different currencies.
Since the currencyCode which is passed in SetExpressCheckOut should match with the DoExpressCheckout, and as I have faced problem, currencyCode needs to be same as that of sandbox seller account, so even if buyers are selecting GBP, I have to send it to SetExpressCheckout as the currencyCode of the seller account.
You should add the currencies you would like to receive payments in through the control panel of your business account in question.
Go to Profile -> My Settings -> Financial Information tab and Currency Balances. From there select a currency and add it to the list. Your received payments are then kept in the respective currency balance they were made until you convert them to whatever you want.
By default, transactions that take place in a currency you don't hold are held until you decide what to do with them. If you log into the seller account in question, you should see the transaction listed under your history. You should be able to accept it or deny it from there.
There are two ways around this:
Add Euros as a currency balance to your seller's account, as Alderis noted.
Have all transactions that take place in a currency you don't hold automatically accepted and converted to USD. To do this, log into the seller's account, click on Profile, then click on Payment Receiving Preferences (in the Selling preferences column), then set Block payments sent to me in a currency I do not hold to No, accept them and convert them to U.S. Dollars, then click Save.

Zend Framework Validator Chain messages

Struggling to understand why my validator chain is showing the incorrect message for the value I type in.
Currently my model's code is making the incorrect message appear when I type in non-identical passwords instead of just the expected 3rd message ('Please retype password between 8-25 alphanumeric characters and matching the first password' when expecting 'Retyped password must match first.') when i type in mismatched passwords of 8 -25 characters long.
$password2 is the one giving issues
Also unsure if the indentical validator is working due to this problem.
Zend Framework version 1.11
Specific code chunk related to above
$password2 = new Zend_Form_Element_Password('password2');
$password2->setAttrib('size', 25);
$password2->setRequired(true);
$validatorChain2 = new Zend_Validate();
$validatorChain2->addValidator(new Zend_Validate_StringLength(array('min' => 8,'max' => 25)), true);
$validatorChain2->addValidator(new Zend_Validate_Alnum(false), true);
$validatorChain2->addValidator(new Zend_Validate_Identical('password1'), true);
$password2->addValidator($validatorChain2);
$password2->addErrorMessage('Please retype password between 8-25 alphanumeric characters and matching the first password');
$password2->addErrorMessage('Passwords can only be alphanumeric characters.');
$password2->addErrorMessage('Retyped password must match first.');
Full model code listing
class Application_Model_RegisterNewAccount extends Zend_Form
{
public function __construct($options = null)
{
// TODO: The errors are been grouped together at the top of the page now but the original error messages below each field need to be removed
parent::__construct($options);
$this->setName('newaccountregistration');
$this->setMethod('post');
$this->setAction($options['action']); // Variable action passed via parameter array for argument 'action'
$email = new Zend_Form_Element_Text('email'); // Create form text field
$email->setAttrib('size', 75); // Set for, element max size/length
$email->setRequired(true); // Make this field a required item
$validator_email = new Zend_Validate_EmailAddress();
$email->addValidator($validator_email); // Set validator type and minimum and maximum size required
$email->addErrorMessage('Please provide a valid email address');
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->setAttrib('size', 35);
$firstname->setRequired(true);
$validator_firstname = new Zend_Validate_StringLength(array(1,35));
$firstname->addValidator($validator_firstname);
$firstname->addErrorMessage('Please provide your first name between 1-35 characters');
$surname = new Zend_Form_Element_Text('surname');
$surname->setAttrib('size', 35);
$surname->setRequired(true);
$validator_surname = new Zend_Validate_StringLength(array(1,35));
$surname->addValidator($validator_surname);
$surname->addErrorMessage('Please provide your first name between 1-35 characters');
$password1 = new Zend_Form_Element_Password('password1');
$password1->setAttrib('size', 25);
$password1->setRequired(true);
$validatorChain1 = new Zend_Validate();
$validatorChain1->addValidator(new Zend_Validate_StringLength(array('min' => 8,'max' => 25)), true);
$validatorChain1->addValidator(new Zend_Validate_Alnum(false), true);
$password1->addValidator($validatorChain1);
$password1->addErrorMessage('Please provide a password between 8-25 alphanumeric characters');
$password1->addErrorMessage('Passwords can only be alphanumeric characters.');
$password2 = new Zend_Form_Element_Password('password2');
$password2->setAttrib('size', 25);
$password2->setRequired(true);
$validatorChain2 = new Zend_Validate();
$validatorChain2->addValidator(new Zend_Validate_StringLength(array('min' => 8,'max' => 25)), true);
$validatorChain2->addValidator(new Zend_Validate_Alnum(false), true);
$validatorChain2->addValidator(new Zend_Validate_Identical('password1'), true);
$password2->addValidator($validatorChain2);
$password2->addErrorMessage('Please retype password between 8-25 alphanumeric characters and matching the first password');
$password2->addErrorMessage('Passwords can only be alphanumeric characters.');
$password2->addErrorMessage('Retyped password must match first.');
$submit = new Zend_Form_Element_Submit('submit'); // Added submit button
$submit->setLabel('Register');
$submit->removeDecorator('DtDdWrapper'); // Remove the default DD div wrapper
$this->setDecorators( array( array('ViewScript',
array('viewScript' => '_register.phtml')))); // The form html page
$this->addElements(array($email, $firstname, $surname, $password1, $password2, $submit)); // Add all the form elements
}
}
You should instantiate it like this...
$validatorChain2->addValidator(new Zend_Validate_Identical(array('token' => 'password1', 'messages' => ....)), true);

Resources