paypal gateway integration (in - context checkout) in asp.net mvc

Smith
Smith
Participant
360 Points
110 Posts

Hi,

I am try to integrate PayPal Gateway (in context checkout). For this I have create developer account (Sandbox test account). I have created two account merchant and buyer. I have API credential  UserName, Password and Signature.

I want to implement in MVC. Please give some reference or example.

Views: 8184
Total Answered: 1
Total Marked As Answer: 1
Posted On: 26-Jan-2016 23:34

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1170 Points
210 Posts
Marked as answer      

Hi smith,

It is similar to express checkout functionality just to need to enable the in-context checkout. For this you need to added the following script link and script code in your checkout  page:

<script src="//www.paypalobjects.com/api/checkout.js" async></script>
<script type="text/javascript">
window.paypalCheckoutReady =function () {
paypal.checkout.setup("@MvcApplication1.Models.PayPalSettings.MerchantAccountID", {
environment:'@MvcApplication1.Models.PayPalSettings.Environment',
click:function (event) {
event.preventDefault();
paypal.checkout.initXO();
$.support.cors =true;
$.ajax({
url:'@Html.Raw(Url.Action("PayPaltoken", "Cart"))',
type:"GET",
async:true,
crossDomain:true, 
//Load the minibrowser with the redirection url in the success handler
success:function (token) { 
var url = paypal.checkout.urlPrefix + token; 
//Loading Mini browser with redirect url, true for async AJAX calls
paypal.checkout.startFlow(url);
},
error:function (responseData, textStatus, errorThrown) {
alert("Something going wrong "); 
//Gracefully Close the minibrowser in case of AJAX errors
paypal.checkout.closeFlow();
}
});
},
button: ['btPaypal']
});
}
</script>

You can follow the detail step by step integration in blog:

https://www.niceonecode.com/Blog/DotNet/MVC/-PayPal-Gateway-Integration-(in-context-checkout)-in-ASP_NET-mvc/5

you can also refer to link

https://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/checkout-and-payment-with-paypal

 

Posted On: 06-Feb-2016 03:08
banner

Blog

Active User (2)

 Log In to Chat