I'm having trouble figuring this out. I would like to create a monthly subscription in paypal that never ends unless the user cancels it. Every time the subscription runs, I want it to call my IPN url.
Below is what I'm using:
<script
data-env="sandbox"
data-callback=""
data-period="M"
data-recurrence="1"
data-currency="USD"
data-amount="9.99"
data-name="Premium Monthly"
data-button="subscribe" src="https://www.paypalobjects.com/js/external/paypal-button.min.js?merchant=admin-facilitator#jcink.com"
></script>
Note that I removed the IPN url, but anyway, the problem is that no matter how many times I test this, the subscription immediately "expires"
The total cycles listed is "1", the remaining cycles are 0, and the cycle frequency is monthly. What am I getting wrong here? Before anyone says change data-recurrence to 12 for how many months, it doesn't matter, the remaining cycles are always 0. This is really not what I want either; it should be monthly infinitely until the person cancels.
In order to have it indefinite until the customer cancels you would need to add in data-src="1"
Related
I have been using
Net::SSLeay
for 20 years to post data to authorize.net and receive the reply, as shown below:
($reply_data, $reply_type, %reply_headers) =
post_https($host, $port, $script, '', $form_data);
#data = split (/\,/, $reply_data);
$FORM{'x_response_code'} = $data[0];
$FORM{'x_response_reason_text'} = $data[3];
$FORM{'x_auth_code'} = $data[4];
$FORM{'x_amount'} = $data[9];
if ($FORM{'x_response_code'} != 1) {...
authorize.net received the data and processed the payment, but my system did not receive a reply. The user got a server error, and tried submitting the form several more times, all which resulted in payment processing, but no reply from authorize.net. When comparing my logs with authorize.net's processing time, I see that there's about a fifteen minute lag time between when the call was sent, and when authorize.net processed the payment. All four attempts were completed before the first processing occurred. Authorize.net says there were no problems or changes on their end.
How can I suppress the server error and instead return a custom error message?
As I understand it, your problem is that your local server is timing out before receiving a response from authorize.net, and from your log files, it seems that the response does arrive, but after a long delay. Although it is probably possible to configure your server to wait for longer before timing out (assuming you have control of the server config, etc.), 15 minutes is too long for a user to wait and would provide very poor user experience. Therefore, I'd suggest one of the following strategies:
submit the form by AJAX and wait for a response -- i.e. translate your form processing logic into javascript and perform the transaction asynchronously. Looks like there's an existing authorize.net JS API.
the old school method: when the form is submitted, fork a new process that posts the form data (e.g. using curl) and saves the response to a file. The UI would return an intermediate page informing the user that their payment is being processed, and would periodically check whether the response has arrived, either through a link the user clicks to trigger a test for the presence of the response file, or through automatically refreshing the page (but see these accessibility guidelines).
Whatever strategy you use, I would get in touch with authorize.net and see if you can find out why the response is taking so long. Adding a note to users that indicates that there have been delays recently and preventing them from submitting the same payment four times in a row would also definitely be good!
The problem in short - Paypal is returning the POST var item_number but it is blank.
Details:
Customer hits Buy Now and is taken over to Paypal where the transaction is completed and then they are sent back to my site.
I use a notification url/page to update the database, but it relies on an item_number to trigger the proper code.
I know there was recently a change to item_number1 or item_number_1 that I've seen referenced in some other questions but I'm printing all POST vars to a temporary file (via php in the notification url) and all I see is item_number and it is blank.
Any advice would be greatly appreciated as I'm no Paypal expert and I've been banging my head against the wall trying to figure out why it's not sending me back a value. Some code snippets and useful stuff below...(note i've modified some of the values for security, but nothing else)
My "Buy Now" Link = https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MYBUTTONID&lc=US&page_style=primary&item_number=PayPerCard&invoice=00000000&custom=userName
Loop for printing POST vars
foreach ($_POST as $key => $value) {
$data.= $key.'='.$value.'\n';}
$data is just printed into a temp file every time a transaction is completed
$data =
transaction_subject=
payment_date=17:25:25 Oct 16, 2017 PDT
txn_type=web_accept
last_name=McDougal
receipt_id=0000-0000-0000-0000
residence_country=US
item_name=Buy & Send
payment_gross=1.50
mc_currency=USD
business=sales#mydomain.com
payment_type=instant
protection_eligibility=Ineligible
verify_sign=BIGLONGSTRING
payer_status=unverified
payer_email=customer#gmail.com
txn_id=BIGLONGSTRING
quantity=1
receiver_email=sales#mydomain.com
first_name=Sticky
invoice=00000000
payer_id=0000000000000
receiver_id=0000000000000
item_number=
payment_status=Completed
payment_fee=0.37
mc_fee=0.37
mc_gross=1.50
custom=userName
charset=windows-1252
notify_version=3.8
ipn_track_id=0000000000000
So of course after spending hours hunting and debugging and finally posting to stackoverflow, I figured out the problem ten minutes later and it was a super easy fix. Posting here on the off chance someone else can benefit.
SOLUTION : Not sure when it happened, but Paypal uses a field labeled as "Item ID" when you create a hosted button. This is the item_number and it must be set here, not in the Buy Now link as I previously had it.
image of PayPal fields
Setting that field to my desired item_number did the trick.
I am wrestling with the PayPal service . I almost have it done . Last step, when the customer payed and has the last page, which stays open for 10 seconds and then redirects them to the page of your choosing.
What parameters, posts, etc are sent with that page opening? And how do I get access to them, so I can link the returning user with their created account (from ipn and my personalized database entry on the initial buyitnow)
I tried echo($_post). But it just shows .... Array() But no key value pairs.
I'd think there would be a lot more
I have rm=2. Set already.
Plus, I see some Get() cars in the URL but, nothing I can use .
Also, I am passing a custom variable , which is going through, and being used by the IPN to update the user account just fine. I just don't see how to connect the return page and the customer, preferably with the $custom var
Help?
Try using var_dump($_POST); instead of echo($_post);
Apparently, there are no POST variables coming from PayPal, they're all GET variables. A VAR_DUMP(GET) will show like 6 things, including your CUSTOM variable (id cm). I thought there would be more and it would be in POST format.
I also thought there would be a way to show everything, POST, GET, SESSION, etc. I even tried using Firefox NETWORK setting, but there were like 50 separate items. None of which seemed to contain my data. I'm sure it was there, but, hidden.
First off - I am new to Google Apps.
I have created a form that I want to be automatically emailed to me upon submission.
I have set up a trigger as follows :
timeDriven --> Time-driven --> Minutes timer --> every minute
I have created two forms and it has collected the data.
But is is NOT being emailed to me.
Any ideas why?
-Jena
When troubleshooting problems with triggers it helps to set the notification frequency to "immediately", to ensure that errors are emailed to you as soon as they happen.
My Magento Verison is - 1.4.1.1
I am having two problems:
1) When I am going through various steps of Onepage checkout (registration, billing, shipping, and payment tabs), sometimes during this process I am redirected to the cart page. There is no error, no exception, no report gets generated in var/report. I dont know how to debug it. Aren’t there any logs I can look for?
2) In same Onepage Checkout process after clicking on place the order (last step) , some times it redirects to the cart page, sends an email saying that the order failed with the message:
Quote totals must be collected before this operation.
To resolve it I commented this line in prepareRecurringPaymentProfiles in the file magento/app/code/core/Mage/Sales/Model/Quote.php, which solved the problem:
throw new Exception("Quote totals must be collected before this operation.");
I dont know if these 2 problems are related or not. But I am not having the 2nd problem now but having 1st one quite frequent. What could be the reason and how to resolve it?
further update-I checked the firebug trace, It is 500 internal server error which comes sometimes in any of the step in one page checkout. I was able to dig down into savebillingaction, saveshippingaction functions in onepagecontroller.php and found that error comes when $this->getRequest()->isPost() is blank , If it is 1 then it goes ahead, and goes to the next step else it redirects to cart, No I dont know why this is not 1 or is it because ajax is not able to send post data but I checked XHR request, Ajax send the post data every time (checked with firebug extension). Can Someone tell me What I could do next to troubleshoot. Where I can look for these Ajax Calls?
Shipping.phtml (any step.phtml) has JS at the bottom , How does it call OnePagecontroller saveshippingaction function ?
Since it's internal server error, try to access the error log of the server. Will tell you where is the problem. I' ve had the same problem in 1.7.0. In my example the problem was at /app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
For anyone else coming across the "Quote totals must be collected before this operation." error, check your Apache logs for the reason of the 500 internal server error. If it's something like this:
mod_fcgid: read data timeout in 40 seconds
Premature end of script headers: index.php
process 26126 graceful kill fail, sending SIGKILL
..PHP is taking too long to respond. Usually its the onepage/checkout saveOrder action because it's quite heavy and often needs to connect to third party services (payment gateways, newsletter services like mailchimp, etc.). These calls to third party services can take a while, depending on the network state and might be the reason of PHP timing out.
You can start by increasing the timeout, but it's not a good permanent solution because you want to find out why this is happening in the first place.
New Relic is a good tool to monitor these calls (and a good tool to monitor your Magento store in general).
Firstly, commenting an error message is almost never the way to solve a problem, as you are just covering up some issue that may have severe consequences for your system.
Nailing down errors like this can be hard, but there are a few places to look first:
Did you install this system on a lower version and then upgrade? If so, how?
Are you using any extensions that modify the sales/checkout portion of the site?
Have you overridden any of the models concerned with this part of the site?
Have you changed the JS or HTML for the checkout?
If one of those is the case, you should review those changes for bugs. If not, try turning on the default theme for the site and checking out again. If the bug disappears, there is a problem with the theme that you are using. If it still appears, the problem is in code.
In that latter case, use Firebug to verify that the offending page requests result in Magento sending back "redirect" commands to the frontend. If that isn't the case, it may be some kind of JS error, but more likely you are ending up with invalid data in the system somewhere that causes Magento to choke during checkout.
Also (just thought of this, haven't tried it), try the multi-address checkout. As I recall, it uses regular page posts, and may even have more useful messaging than the OnePage checkout. Please edit your post with your findings from the above so that we can help more if that doesn't do it.
Hope that helps!
Just in case someone gets the "Quote totals must be collected before this operation." error, and none of these solutions fixes their particular problem, I'll mention that mine was an issue with this:
skin/frontend/base/default/js/opcheckout.js
var params = Form.serialize(payment.form);
There was a JS error unique to this site which was clearing the Payment form and preventing JS from reading it's contents. The module or theme that you use will differ, but check to make sure that the payment form can serialize correctly. If not, then that could be your problem.
I had the very same problem on my store Princessly:
It takes about 20 to 130 seconds or even longer for "Submitting order information ..." to go through and redirect to the payment gateway such as PayPal, if at all, after clicking the Place Order button, last step of one page checkout.
If it doesn't go through, very probably because something timed out since it took too long, it will redirect back to shopping cart, leaving the customer an empty cart and a Pending Payment order, OR, it will give the exception of:
Quote totals must be collected before this operation.
Since obviously, well, something timed out and the script ends before quote totals are collected (which is just my theory), thus sending the Payment Transaction Failed Reminder email.
After 12 hours of research and debug, I finally found the culprit and the solution.
Magento enables RSS stock and new order notification by default, so every time Place Order is pressed ('sales/order' resources are then saved), cache is refreshed so RSS will be published. Cache cleaning can be very time-expensive for Magento. Therefore the solution is simple. Just disable RSS notification for save of 'sales/order' resources.
Find /app/code/core/Mage/Rss/etc/config.xml and locate this block:
<sales_order_item_save_after>
<observers>
<notifystock>
<class>rss/observer</class>
<method>salesOrderItemSaveAfterNotifyStock</method>
</notifystock>
</observers>
</sales_order_item_save_after>
<sales_order_item_save_after>
<observers>
<ordernew>
<class>rss/observer</class>
<method>salesOrderItemSaveAfterOrderNew</method>
</ordernew>
</observers>
</sales_order_item_save_after>
Simply remove or comment it out and refresh Magento cache in System => Cache Management => Select All => Submit.
Now it only takes 1 second or even less for my store to go through Place Order and redirect to payment gateway.