I have the following HTML which works well for subscription payments in my test environment.
<form action="paypalWebAddress" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions"/>
<input type="hidden" name="business" value="myPaypalAccountId"/>
<input type="hidden" name="paymentaction" value="sale"/>
<input type="hidden" name="item_name" value="Subscription For abc123"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="a3" value="50"/>
<input type="hidden" name="p3" value="6"/>
<input type="hidden" name="t3" value="M"/>
<input type="hidden" name="src" value="1" />
<input type="hidden" name="srt" value="0" /><!--needs to be never ending-->
<input type="hidden" name="return" value="www."/>
<input type="hidden" name="notify_url" value="www."/>
<input type="hidden" name="cancel_url" value="www."/>
<input type="hidden" name="custom" value="abc123"/>
<input TYPE="hidden" name="charset" value="utf-8">
<input type="hidden" name="bn" value="Me_Subscribe_WPS_UK" />
<input type="submit" name="submit" value="Make Payment"/>
</form>
I'm about to go live and concerned that some one could easily manipulate the DOM and I'm suddenly sending bogus payments. I feel it would be safer to somehow post these values from the code behind so the user can't tamper with the values but, the user will still need to use the PayPal interface in their browser to log in and subscribe.
PayPal-NET-SDK has a quick start and shows how to get going. I have completed this (copied and pasted and ran in debug mode) and it executes fine. However, this doesn't cover subscriptions, probably for the reason explained above (and would probably prevent them accessing the PayPal gui in their browser).
I get the option in the PayPal dashboard area to create a button and reference by button, but, this won't work for me as I need to be able to set the custom field per subscription as a user can subscribe to 1 or more services and each service is unique to that user.
I can't understand how to achieve this
If I understand this right, every subscription is unique per customer in your case and that won't work with the static buttons, so the API seems the only way to go.
The PayPal API does cover subscriptions, they're called Billing Plans. Because each subscription is different, you could create a new Billing Plan for each unique service (or combination of services). This can be done without any intermediate SDK using the HttpClient directly to their API.
Alternatively, the PayPal-NET-SDK you mentioned also seems to cover Billing plans. Their Sample application has quite a lot of examples on how to create, enumerate and issue Billing Plans. Make sure you check out the billing_agreement_tokens collection on the Payment class. You might add multiple "service" tokens there.
No matter how close you are to releasing, a lot of testing still seems to be in order here.
You can try using HttpClient, something like this will help
HttpContent content = new FormUrlEncodedContent(
new List<KeyValuePair<string, string>> {
new KeyValuePair<string, string>("key1",
"value1"),
new KeyValuePair<string,string>("key2","value2")
});
content.Headers.ContentType = new
MediaTypeHeaderValue("application/x-www-form-
urlencoded");
content.Headers.ContentType.CharSet = "UTF-8";
HttpResponseMessage resposne = await
client.PostAsync(new Uri("paypalWebAddress"),
content);
You should not hardcode the values in forms, instead you should create an API in the backend which will return the correspoding values.Then you can dynamically create the form based on the response of the API.
Make sure you create this form after you have received the response from the API.You can have a check like if response is null show some spinner.
<form action="paypalWebAddress" method="post" target="_top">
<input type="hidden" name="cmd" value="{response.cmd}"/>
<input type="hidden" name="business" value={response.business}"/>
<input type="hidden" name="paymentaction" value={response.action}/>
<input type="hidden" name="item_name" value="{response.item}"/>
<input type="submit" name="submit" value="Make Payment"/>
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="business.test.com">
<input type="hidden" name="item_name" value="Memory Stick">
<input type="hidden" name="item_number" value="MEM32507725">
<input type="hidden" name="amount" value="3">
<input type="hidden" name="tax" value="1">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="currency_code" value="USD">
<!-- Enable override of buyers's address stored with PayPal . -->
<input type="hidden" name="address_override" value="1">
<!-- Set variables that override the address stored with PayPal. -->
<input type="hidden" name="first_name" value="John">
<input type="hidden" name="last_name" value="Doe">
<input type="hidden" name="address1" value="345 Lark Ave">
<input type="hidden" name="city" value="San Jose">
<input type="hidden" name="state" value="CA">
<input type="hidden" name="zip" value="95121">
<input type="hidden" name="country" value="US">
<input type="image" name="submit"
src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"
alt="PayPal - The safer, easier way to pay online">
</form>
On Click on buy now :
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="herschelgomez#xyzzyu.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Premium Umbrella">
<input type="hidden" name="amount" value="50.00">
<input type="hidden" name="currency_code" value="USD">
<!-- Prompt buyers to enter the quantities they want. -->
<input type="hidden" name="undefined_quantity" value="1">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"
alt="Buy Now">
<img alt="" border="0" width="1" height="1"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
to enabling OpenID authentication with Spring Security
We can add OpenID to the login page as follows:
`
<form action="j_spring_openid_security_check" method="post">
<input name="openid_identifier" size="50" maxlength="100"
type="hidden" value="https://www.google.com/accounts/o8/id"/>
<input type="submit" value="Sign in with Google"/>
</form>
for migrating to Google+ Sign-In how to integrated it with following HTML sign-in button?
<span id="signinButton">
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="CLIENT_ID"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schema.org/AddAction"
data-scope="https://www.googleapis.com/auth/plus.login">
</span>
</span>
this solution not work
<form action="<c:url value='j_spring_openid_security_check'/>"
method="post">
<input id="openid_identifier" name="openid_identifier" type="hidden"
value="https://accounts.google.com/o/oauth2/auth?" />
<input name="scope" value="https://www.googleapis.com/auth/plus.login"
type="hidden" />
<input name="response_type" value="code" type="hidden" />
<input name="client_id"
value="*****************.apps.googleusercontent.com"
type="hidden" />
<input name="client_url" value="**********" type="hidden" />
<input name="redirect_uri" value="postmessage" type="hidden" />
<input name="origin" value="**********" type="hidden" />
<input id="openid_submit" type="submit" value="Sign-In" />
</form>
I have gone through many questions similar to this but I could not resolve the issue. This is not the first time I am using paypal, I have successfully used the code below in other websites as well.
I have also checked the option for overriding the profile postage settings.
I am using the following code:
<form id="f1" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
#* <input type="hidden" name="shipping" value="0.00">*#
<input type="hidden" name="handling_cart" value="#shipamt" />
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="businessEmail#paypal.com" />
<input type="hidden" name="currency_code" value="GBP" />
<input name="custom" type="hidden" id="custom" value="#cartId" />
#foreach(var cartdetail in Model.cartDetail)// (int i = 0; i < Model.order.cart.cartDetail.Count;i++ )
{
<input type="hidden" name="item_number_#i" value="#i" />
<input type="hidden" name="item_name_#i" value="#cartdetail.product.Title" />
<input type="hidden" name="quantity_#i" value="#cartdetail.Quantity" />
<input type="hidden" name="amount_#i" value="#cartdetail.product.getCurrentPrice()">
i++;
}
<input type="hidden" name="return" value="http://parduh.com" />
<input type="hidden" name="cancel_return" value="http://cancelurl.com" />
<input type="hidden" name ="notify_url" value="http://notifyurl.com" />
#* <input type="hidden" name="no_shipping" value="1" />*#
<input type="hidden" name="image_url" value="http://parduh.com/images/logo.png">
</form>
These are the values from chrome's developer tool, all the values are being posted to paypal
handling_cart:16.6167
cmd:_cart
upload:1
business:mybusinessemail#hotmail.com
currency_code:GBP
custom:13
item_number_1:1
item_name_1:Dress
quantity_1:1
amount_1:68.00
Thanks for the help.
The issue is that you are passing the value for handling_cart with more than 2 decimal places. Try the same request, but making sure that you round off so that handling_cart = 16.62.
I made a e-commerce which handles payments by Paypal, the flow works good although there is a boring thing, when the user finish to pay, to go back to the StoreWebSite has to click to the button which was provided by PayPal page.
there is anyway to make that operation automatic?
there is any flag I can set to force paypal redirect to my StoreWebSite when the user finish to pay?
basically I do that
Basically I do the following:
<html ng-app>
<body data-ng-controller="testController">
<form id="Checkpay" name="Checkpay" style="margin: 0" method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" target="_blank" class="ng-pristine ng-valid">
<input type="hidden" id="return_url" name="return_url" value="">
<input type="hidden" name="quantita" id="qtytext" value="0">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Le Spose di Nika">
<input type="hidden" name="business" value="TEST#TEST.it">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="cancel_return" id="cancel_return" value="">
<input type="hidden" name="return" id="return" value="">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" id="H_amount" name="amount" value="719.80">
<input type="hidden" id="H_first_name" name="first_name">
<input type="hidden" id="H_address1" name="address1">
<input type="hidden" id="H_city" name="city">
<input type="hidden" id="H_state" name="state">
<input type="hidden" id="H_zip" name="zip">
<input type="hidden" id="H_email" name="email">
<input type="hidden" id="Country" name="country">
<input type="hidden" id="charset" name="charset" value="utf8">
<input type="hidden" id="rm" name="rm" value="2">
<input type="hidden" id="notify_url" name="notify_url" value="">
<input id="Submit1" type="submit" value="submit_post" />
</form>
<input id="Submit2" type="button" data-ng-click='pay()' value="js_post" />
</body>
</html>
<script src="http://localhost:27433/Scripts/jquery-1.7.1.min.js"></script>
<script src="http://localhost:27433/Scripts/jquery-ui-1.8.20.min.js"></script>
<script src="http://localhost:27433/Scripts/angular.js"></script>
<script>
function test() {
}
function testController($scope, $http) {
var URL = "http://backend.MYSITE.com/";
$scope.payTest = function () {
var PAYPAL_URL_RELEASE = "https://www.paypal.com/cgi-bin/webscr";
$('#return_url').val(URL);
$('#cancel_return').val(URL + '/ErrorPay');
$('#return').val(URL + '/Success');
$('#notify_url').val(URL + '/PayPalReceiverIPN.ashx?idOrder=');
document.forms["Checkpay"].action = PAYPAL_URL_RELEASE;
document.forms["Checkpay"].submit();
}
}
</script>
return_url
The URL to which the sender's browser is redirected after approving a payment on paypal.com.
You can find it here
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
This is my form view source ,
When i click on submit button
Redirect to Paypal sendbox and showing one item
<form id="Paypal" name="Paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<form action="/ShoppingCart/PostToPaypal" method="post"><input id="cmd" name="cmd" type="hidden" value="_xclick" /><input id="business" name="business" type="hidden" value="anilcs_1361585097_biz#gmail.com" /><input id="no_shipping" name="no_shipping" type="hidden" value="" /><input id="return" name="return" type="hidden" value="http://localhost:49424/Checkout/IPN" /><input id="cancel_return" name="cancel_return" type="hidden" value="http://localhost:49424/SportsStore/CancelFromPaypal" /><input id="notify_url" name="notify_url" type="hidden" value="http://localhost:49424/SportsStore/NotifyFromPaypal" /><input id="currency_code" name="currency_code" type="hidden" value="USD" /> <input type="hidden" name="item_name" value="2252330"/>
<input type="hidden" name="amount" value="122.75"/>
<input type="hidden" name="item_name" value="51057"/>
<input type="hidden" name="amount" value="32.99"/>
<input type="hidden" name="item_name" value="2252330"/>
<input type="hidden" name="amount" value="122.75"/>
<input type="hidden" name="item_name" value="51057"/>
<input type="hidden" name="amount" value="32.99"/>
<input type="hidden" name="item_name" value="2252330"/>
<input type="hidden" name="amount" value="122.75"/>
<input type="image" name="btnsubmit" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
alt="PayPal - The safer, easier way to pay online" />
</form>
Can any help me how i will show my 5 item in Paypal
This is expected with the 'Buy now' button (cmd=_xclick).
If you want to display multiple items, you'll want to use something like this instead:
<form id="Paypal" name="Paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr method="POST">
<input id="cmd" name="cmd" type="hidden" value="_cart" />
<input id="business" name="business" type="hidden" value="anilcs_1361585097_biz#gmail.com" />
<input id="return" name="return" type="hidden" value="http://localhost:49424/Checkout/IPN" />
<input id="cancel_return" name="cancel_return" type="hidden" value="http://localhost:49424/SportsStore/CancelFromPaypal" />
<input id="notify_url" name="notify_url" type="hidden" value="http://localhost:49424/SportsStore/NotifyFromPaypal" />
<input id="currency_code" name="currency_code" type="hidden" value="USD" />
<input type="hidden" name="item_name_1" value="2252330"/>
<input type="hidden" name="amount_1" value="122.75"/>
<input type="hidden" name="item_name_2" value="51057"/>
<input type="hidden" name="amount_2" value="32.99"/>
<input type="hidden" name="item_name_3" value="2252330"/>
<input type="hidden" name="amount_3" value="122.75"/>
<input type="hidden" name="item_name_4" value="51057"/>
<input type="hidden" name="amount_4" value="32.99"/>
<input type="hidden" name="item_name_5" value="2252330"/>
<input type="hidden" name="amount_5" value="122.75"/>
<input type="hidden" name="upload" value="1">
<input type="image" name="btnsubmit" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
alt="PayPal - The safer, easier way to pay online" />
</form>
In this, I have:
Added an "action" to the first <form>
Added input upload=1
Change cmd from _xclick to _cart
Numerated the cart items (_n)
By the way, I noticed you set your return URL to 'something/IPN'.
You do realize IPN is different from the return URL, right?
IPN is an asynchronous PayPal server-to-server POST which includes a payload about the transaction. Whereas return is the URL the buyer is redirected back to.
You set the IPN URL by populating the notify_url parameter (which you have done as well).