How to pass custom amount with Bitpay hosted checkout form? - button

I am looking to integrate BitPay for processing bitcoin payments on one of my sites.
Their hosted checkout form (similar to PayPal checkout form) is easy to integrate however I don't know how I can pass order amount with the form so that the same checkout button can be used for different orders (payments).
Here's their page regarding hosted checkout: https://bitpay.com/help-hosted-checkout
Bitpay has clearly stated that we can pass different order amount but they have not provided any field for this on the above mentioned page. I have contacted them and they will reply in 3 days but since I need to integrate this at the earliest, I hope somebody here can help me fast.
Thanks.

I was also looking for help with a bitpay button for a project and found this question (and another one like it), so coming back to answer in case it can help others in the future: If you got your bitpay button code from the payment button option on bitpay, your code might look something like this:
<form action="https://test.bitpay.com/checkout" method="post">
<input type="hidden" name="action" value="checkout" />
<input type="hidden" name="posData" value="" />
<input type="hidden" name="price" value="<?php echo $price_var;?>" />
<input type="hidden" name="data" value="...(your data value)..." />
<input name="checkout" type="submit" value="Checkout" class="form-button-submit button"/>
</form>
Having the line of code with 'name="price"' allows you to set a global variable (potentially your shopping cart total) as an order amount. Hope this helps!

Related

Wordpress search form by category not working?

Objective
I am trying to create different search forms for two different landing pages. Thus, users who end up on landing page A will only be able to search for products with categories Man and Book. Users landing on page B will only be able to search for products with categories Beast and Funny.
Here is my example setup in WooCommerce.
What I have tried
Based on this link, I have tried the following search function for page A.
<form role="search" method="get" id="searchform" action="https://test.com/">
<div>
<label for="s">Search for (Man and Book):</label>
<input type="text" value="" name="s" id="s" />
<input type="hidden" value="1" name="sentence" />
<input type="hidden" value="product" name="post_type" />
<input type="hidden" value="product_cat" name="man,book" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
Problem
If I key in GetAllX into the search form, I expect to see GetAllX (Copy 2) only. Instead, I see GetAllX (Copy 2) and GetAllX.
Also, when I key in test, I expect to see Test product 2 only. Instead, I see both Test product 2 and Test Product.
Questions
Why is WordPress behaving like this? Can someone help me out with this, please?
If there is an easier way to create search forms for different product categories based on landing pages, please do let me know.
Found the error. It was in this line:
<input type="hidden" value="product_cat" name="man,book" />
It should be instead:
<input type="hidden" value="man,book" name="product_cat" />
There was a typo in the article I linked to.

Paypal Form Payment correct workflow

I need to integrate payments with PayPal and I'm using the form integration
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
...
<input type="hidden" name="return" value="http://example.com/Thankyou.html">
<input type="hidden" name="notify_url" value="http://example.com/IPN">
<input type="image" name="submit" border="0" src="/img/logos_icons/paypal-btn.png" alt="PayPal - The safer, easier way to pay online">
</form>
After this point I'm a little bit confused: when the user click on the buy button is redirected on the PayPal website and when the transaction is completed is redirected on the "retun" link (a thank you page). At the same time PayPal send a notification (IPN) to the "notify_url".
is this the correct workflow?
if yes, in the notify method I should book the purchased products but how can I understand which is the original transaction linked to the current notification ?
You have the flow correct, although depending upon the nature of the transaction or user experience you are trying to provide you may have the fulfillment activity "book the purchased products") possible in two places: handled by the page the user the returns to (if they do return promptly and you want to fulfill the order immediately, e.g. so that they can navigate to a subscribed page) and via IPN to catch the cases where the user pays but does not return immediately to your site.
Generally you send a unique identifier of your choice to PayPal in the invoice field of the button; that identifier is linked to whatever context you need (purchase details/shopping cart, user account, whatever) on your side.

Analytic funnelling, tracking two URLs with different parameters, both being triggered as the same URL.

I want to be able to track goals but I need to know whether they came from a page with a social media parameter or a digital marketing parameter in the URL.
I currently have subscription form which returns a URL with a specific parameter depending on which page we're on. We're using wordpress.
<?php if(is_page( 'internet-marketing-software')): ?>
<div class="free-trial" style="display:none;">
<div class="sign-up-button" style="/* display:none; */">
<form name="signup" id="signup" action="http://dmtrk.net/signup.ashx" method="post" onsubmit="return validate_signup(this)">
<input type="hidden" name="addressbookid" value="1922561">
<input type="hidden" name="userid" value="52978">
<input type="hidden" name="ReturnURL" value="http://test-site.com/?signup=false&step2=true&digital-marketing=true&form=form-banner">
<input id="input" type="text" name="Email" placeholder="name#email.com">
<input type="hidden" id="double" name="double" value="double">
<input id="submit" class="banner" type="Submit" name="Submit" value="sign up">
</form>
</div>
<div class='trial-desc'>
<p>Interested? <span>Start 30 day FREE trial now!</span>
</p>
</div>
</div>
<?php endif; ?>
I load a similar piece of code in the header this time with the condition
if(is_page( 'social-media'))
and which returns the url
http://test-site.com/?signup=false&step2=true&social-media=true&form=form-banner.
I so depending on the page each user gets taken to either the social-media or digital-marketing page.
When this URL us triggered a double opt-in email is sent with a link taking them to the true goal page http://test-site.com/?signup=true.
In Google Analytics I have set up two goals with the funnelling capability turned on.
I currently have the destination setup as:
RegEx /?signup=true
Funnelling On
Step &digital-marketing=true
And then for social:
RegEx /?signup=true
Funnelling On
Step &social-media=true
Looking at my reports each time a goal is triggered, no matter which URL was used they both register as a goal.
I'm not sure what I'm doing wrong, is there something I'm overlooking with Analytics and URL parameters?
To follow up on the comments (I cannot comment) - You should mark the previous page (coming from digital marketing or social) as "required step" to make sure that the goal will register in one of the paths, and not both. See the button on the right.

Detecting which option was selected by the buyer in PayPal IPN Listener

I'm testing my IPN handler with micro-payments using Live PayPal and I want to know how to detect what option was selected when the user clicked my PayPal "Buy Now" button. I've checked many places and found conflicting documentation and guidance.
Based on another StackOverflow thread, I added the last 4 hidden elements below to the SELECT drop-down OPTION(s) on the ASP.NET page with my Buy Now button:
<input type="hidden" runat="server" name="hosted_button_id" value="WYUM54ACPKUH6" id="hosted_button_id"/>
<input type="hidden" name="on0" value="SubType"/>SubType
<select name="os0">
<option value="S10">Standard (10 users) $0.04 USD</option>
<option value="ENT">Enterprise (unlimited) $0.05 USD</option>
</select>
<input type="hidden" name="option_select0" value="S10"/>
<input type="hidden" name="option_select1" value="ENT"/>
<input type="hidden" name="option_amount0" value="0.04" />
<input type="hidden" name="option_amount1" value="0.05" />
These are not being POSTed back. In a specific test case, I bought the "Standard" option for $0.04 and dumped out the Form variables posted back to my site from PayPal and here are the only things even close to what I am looking for:
option_name1 = SubType
option_selection1 = S10
payment_gross = 0.04
The threads I read and the doc I read emphasized the naming convention of the OPTION elements and the name and value of the corresponding hidden elements as being as shown above. YET - my testing indicates different things being posted back regarding the choice that was made by the user (i.e. me).
One specific thing is why the suffix is 1 when it seems like it should be 0 (since that first choice and it should be relative to 0). Is there anybody who can clarify what to expect?

Wordpress search form not passing get variables

I have an issue where I am creating a simple custom search form in Wordpress 3.4 sitting in a template file.
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>">
<input type="text" value="" name="s" id="s" />
<input type="hidden" name="search-type" value="vacancies" />
<input name="submit" type="submit" value="Go" />
</form>
Upon submitting it hits a search.php file where further processing takes place.
<?php print_r($_GET); ?>
The problem is that I cannot access the get variables in search.php. I can echo here so I know I'm definitely hitting search.php but my get array is empty every time.
Any ideas would be a big help. I feel I may be making a rookie mistake...
I was having this problem too. The theme I am using (Roots) does some fancy rewriting of the search page URLs. So, searching for "french holiday" will be site.com/search/french+holiday instead of site.com/?s=french+holiday.
If you can't see the variable in the URL, you won't be able to access it using $_GET.
I changed back to the standard URLs and can now access my $_GET values.
Hope that helps.

Resources