Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Haematite 2 posts 23 karma points
    Nov 01, 2014 @ 14:42
    Haematite
    1

    Installing Payment Provider Plugins

    Hi all,

    I'm relatively new to Umbraco, so appologies if this is a dumb question. However, I've just started looking into Merchello and so far it looks fantastic. I now want to add the PayPal payment provider, but I can't find any documentation on how to do this anywhere?

    I've noticed that's it located here: https://github.com/Merchello/Merchello/tree/1.5.0/Plugin/Payments so I assume it's just a case of dropping some files somewhere?

    Any help with this would be greatly appreciated.

    Thanks

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Nov 01, 2014 @ 15:11
    Nik Wahlberg
    0

    Hi there! Welcome to the Umbraco community and specifically to Merchello.

    We haven't added any documentation around this yet, but I will get something together and will post in this thread ASAP (then we'll add it to the repo). 

    Thanks,
    Nik  

  • Haematite 2 posts 23 karma points
    Nov 01, 2014 @ 15:29
    Haematite
    0

    Thanks! Look forward to your reply

  • Eidos 44 posts 66 karma points
    Dec 04, 2014 @ 17:34
    Eidos
    0

    To install the plugin, I opened the plugin project and I updated the references (merchello and umbraco).

    After that, I referenced the plugin project in the Umbraco project.

    Finally, I copied all contents form the plugin project app_plugin folder in the umbraco project app_plugin folder.

    someone has worked differently?

     

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Dec 04, 2014 @ 17:51
    Rusty Swayne
    0

    @Eidos the plugins (like payment providers and shipping providers) are generally installed a standard Umbraco packages.

  • Eidos 44 posts 66 karma points
    Dec 10, 2014 @ 12:29
    Eidos
    0

    The paypal plugin seems not have the package generator.

    In addition, seems it is not updated to the latest version of umbraco and merchello.

    I can try to update it. There is any guide/tutorial to build a payment provider?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Dec 13, 2014 @ 17:26
    Rusty Swayne
    0

    Hi Eidos,

    We only have scraps of documentation thus far on the gateway providers but have it scheduled to be working on the formal (merchello.com) docs this month. We will be starting with the Notification provider.

    However, I'd be happy to help you out getting the PayPal provider patched up. Also Nik Walhberg's team (Scandia) are the ones that built it originally ...

    In that plugin, other than updating the dependencies, I think the return notification needs some work - perhaps going to a HttpHandler.

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Dec 15, 2014 @ 16:48
    Nik Wahlberg
    0

    Hi Eidos/Rusty,

    We're working on refactoring the plugin today/tomorrow to make it work with the core changes as well as cleaning up the return notification (whcih, as Rusty pointed out, defintiely needs some TLC). Along with this we'll also start some documentation which should help folks use it.

    Thanks for your patience all.

    Best,
    Nik  

  • Eidos 44 posts 66 karma points
    Dec 15, 2014 @ 17:28
    Eidos
    0

    Hi Nik, hi Rusty,

    They are good news.
    Thanks 

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Dec 15, 2014 @ 20:21
    Rusty Swayne
    0

    Hey Nik - let me know if you want to chat about it as you get going - I'll set my alarm to start work EST tomorrow ... 6am here ... so feel free to ping me on Skype if you like. Have a bunch of stuff on my plate tomorrow and I should start early anyway ;-)

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Dec 16, 2014 @ 15:45
    Nik Wahlberg
    0

    Hey Rusty, thanks. We're working through some of the items now and will post to our Basecamp project as things come up. We should schedule a review once it's complete. Thanks for waking early! :) Hope you have a coffee nearby. 

  • Eidos 44 posts 66 karma points
    Jan 07, 2015 @ 09:46
    Eidos
    0

    @Nik - any news about the paypal plugin?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 07, 2015 @ 09:48
    Dennis Aaen
    1

    Hi Eidos,

    Could it be this that you are looking for http://our.umbraco.org//projects/collaboration/merchello-paypal-express-payment-provider

    /Dennis

  • Eidos 44 posts 66 karma points
    Jan 07, 2015 @ 10:19
    Eidos
    0

    I didn't found it.

    Thanks!

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 07, 2015 @ 13:43
    Nik Wahlberg
    0

    Hi Eidos, sorry that we didn't update you sooner. We're also releaseing a new version with additional features this week. I will post a message here when that is complete, but feel free to check out this one in the meantime. 

    Thanks! 

  • Eidos 44 posts 66 karma points
    Jan 07, 2015 @ 17:34
    Eidos
    0

    Thanks Nik, as soon as possible I will test your plugin and the next week version!=)

  • Craig Agnew 22 posts 138 karma points
    Jan 09, 2015 @ 11:28
    Craig Agnew
    0

    Hi Nik,

    I'm also having a bash using the Paypal gateway plugin. Could you point me in the direction of a sample of where it integrates in my CheckoutController (or equivalent)? Cutting my teeth on Merchello as well so trying to get my head round it all!

    Thanks, Craig

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 12, 2015 @ 16:13
    Nik Wahlberg
    0

    Hi guys, I will get some more documetaion up there but for now I wanted to let you know that we've released a new version of the plugin that also provides automaitc redirect for authorization and capture of the payment (assuming the user successfully logs in to PayPal). 

    If you haven't already, grab the latest plugin and documentation from the our page:http://our.umbraco.org/projects/collaboration/merchello-paypal-express-payment-provider

    Cheers!

  • Eidos 44 posts 66 karma points
    Jan 14, 2015 @ 10:14
    Eidos
    0

    Hi Nik,

    one problem:

    when I call
    IPaymentResult attempt = base.Basket.SalePreparation().AuthorizePayment(<PayPalMethodKey>);

    the result is the following:
    attempt.Payment.Success = false
    attempt.Payment.Error.Message = "Order total is invlaid"
    attempt.Payment.Exception.Message = "Order total is invlaid"
    attempt.Payment.Result.Amount = 86.8974
    attempt.Payment.Result.Authorized = false
    attempt.Payment.Result.Collected = false
    attempt.Payment.Result.......

    I'm using sendbox test account and its api key.
    User should be redirected to the paypal website, is it correct?
    Have you got any idea what is the problem?

    Thanks

  • Flavio Spezi 129 posts 315 karma points
    Jan 14, 2015 @ 14:06
    Flavio Spezi
    0

    Hi Eidos.

    I suggest you to round any price to 2 decimals. PayPal requires that the price is round to 2 decimals, and the decimal separator must be ".".

    Use this:

    var myStringPrice = decimalPrice.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture);

  • Flavio Spezi 129 posts 315 karma points
    Jan 14, 2015 @ 14:40
    Flavio Spezi
    0

    Hi Nik,
    Can you help me? I am some question for you.

    Demo website
    I look that in your PayPal Express plugin you link this demo website: http://merchello.scandi.co/
    Where I can find the source? I need to know how to activate the PayPal payment, check the success or fail result, then how to show confirm or do rollback.

    Issues after fail PayPal communication
    If I try to test to communicate to PayPal and it fail (because wrong account information), I look that the Basket does not works properly. There are some strange behavior that it can be solved by changing the products list (change quantity, add or remove item) for 2 or mre times (one time is not enough).
    What is the best way to do a rollback?
    I would that the buyer view the check-up basket page, where he can look the fail result of transaction. He will change the payment method or retry with the same.
    But I can't do it because, after gateway fails, the Basket (or salesPreparation object) is not consistency.

    Developing plugin
    I look that January 12, 2015 you publish the 1.0.1 version.
    Is this the final release? I am working to apply some change to source today.

    Thanks!

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 14, 2015 @ 14:46
    Dennis Aaen
    0

    Hi Flavio Spezi

    I think that you can found the source code for the PayPal provider here: https://github.com/Merchello/Merchello/tree/1.6.1/Plugin/Payments/PayPal

    Hope this helps,

    /Dennis

     

  • Flavio Spezi 129 posts 315 karma points
    Jan 14, 2015 @ 14:49
    Flavio Spezi
    0

    Thanks Dennis, I'm searching the demo source.

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 14, 2015 @ 15:18
    Nik Wahlberg
    0

    Hi Flavio, thanks for posting your questions. 

    The demo source is really not anyting more than just a standard Umbraco 7 install with Merchello 1.6. The thing that changed as part of our installation is the invoice confirmation. The following example shows how a link might be included if the user reaches the confirmation page but the payment has not yet been authorized. 

    I will find a place to post our sample site so you can see the entier solution, but this is the only place where we've made changes (merchReceiptPage.cshtml).

    @inherits MerchKit.Mvc.MerchKitTemplatePage
    @using System.Diagnostics
    @using Merchello.Core
    @using Merchello.Core.Models
    
    @{
        Layout = "merchBase.cshtml";
    
        var invoiceKey = string.IsNullOrEmpty( Request.QueryString["inv"]) ? Guid.Empty : new Guid(Request.QueryString["inv"].DecryptWithMachineKey());
    
        // Get the invoice    
        var invoice = MerchelloContext.Current.Services.InvoiceService.GetByKey(invoiceKey);
        if (invoice == null)
        {
            Response.Redirect(HomePage.Url);
        }
    
        Debug.Assert(invoice != null, "invoice != null");
    
        // We are planning on adding a few extension methods to assist in the retrieving the shipment information ...
        // get the shipment line item    
        var shipmentLineItem = invoice.Items.FirstOrDefault(x => x.LineItemType == LineItemType.Shipping);
    
        IShipment shipment = null;
        var shipmentName = "";
        if (shipmentLineItem != null)
        { 
            // there will be only one shipment in this version
            shipment = shipmentLineItem.ExtendedData.GetShipment<InvoiceLineItem>();
            shipmentName = shipmentLineItem.Name;
        }
    
        var payments = invoice.Payments();
    }
    
    
    <section id="primary">
        <h1>@Umbraco.GetDictionaryValue("merchReceiptHeadline")</h1>
    
        <section class="receipt">
            <p>@Umbraco.GetDictionaryValue("merchInvoiceNoLabel"): @invoice.PrefixedInvoiceNumber()</p>
            <p>
                @MvcHtmlString.Create(Umbraco.GetDictionaryValue("merchThanksParagraph"))
            @if (payments.Count() > 0) { var payment = payments.First(); if (!payment.Authorized && payment.ExtendedData != null && payment.ExtendedData.ContainsKey("OrderConfirmUrl")) { <a href='@(payment.ExtendedData["OrderConfirmUrl"])'>Please confirm your order!</a> } }
            </p>
    
            <h3>Billed To</h3>
            <span class="fn">@invoice.BillToName</span>
            <span class="adr">
                <span class="street-address">@invoice.BillToAddress1</span>
                <span class="extended-address">@invoice.BillToAddress2</span>
                <span class="locality">@invoice.BillToLocality</span>, <span class="region">@invoice.BillToRegion</span> <span class="postal-code">@invoice.BillToPostalCode</span>
                <span class="country-name">@GetCountryName(invoice.BillToCountryCode)</span>
            </span>
    
            @if (shipment != null)
            { 
                <h3>Shipped To</h3>
                <span class="fn">@shipment.ToName</span>
                <span class="adr">
                    <span class="street-address">@shipment.ToAddress1</span>
                    <span class="extended-address">@shipment.ToAddress2</span>
                    <span class="locality">@shipment.ToLocality</span>, <span class="region">@shipment.ToRegion</span> <span class="postal-code">@shipment.ToPostalCode</span>
                    <span class="country-name">@GetCountryName(shipment.ToCountryCode)</span>
                </span>
            }
            <table class="order-summary">
                @foreach (var item in invoice.Items.Where(x => x.LineItemType == LineItemType.Product))
                { 
                    <tr class="product">
                        <td>@item.Name<span class="variant">x @item.Quantity @@ @item.Price.ToString("C")</span></td>
                        <td>@item.TotalPrice.ToString("C")</td>
                    </tr>
                }
                <tr class="subtotal">
                    <td>@Umbraco.GetDictionaryValue("merchSubtotalLabel")</td>
                    <td>@invoice.TotalItemPrice().ToString("C")</td>
                </tr>
                <tr class="shipping">
                    <td>@Umbraco.GetDictionaryValue("merchShippingLabel")<span class="variant">@shipmentName</span></td>
                    <td>@invoice.TotalShipping().ToString("C")</td>
                </tr>
                <tr class="taxes">
                    <td>@Umbraco.GetDictionaryValue("merchTaxesLabel")</td>
                    <td>@invoice.TotalTax().ToString("C")</td>
                </tr>
    
                <tr class="total">
                    <td>@Umbraco.GetDictionaryValue("merchTotalLabel")</td>
                    <td>@invoice.Total.ToString("C")</td>
                </tr>
            </table>
        </section>
    
    </section>
    
    @functions
    {
    
        private string GetCountryName(string countryCode)
        {
            return MerchelloContext.Current.Services.StoreSettingService.GetCountryByCode(countryCode).Name;
        }
    
    }
    
    
    

    Let me know if this helps. Thanks!

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 14, 2015 @ 15:20
    Dennis Aaen
    0

    Hi Flavio,

    The demo shop source can you find here: https://github.com/Merchello/Samples/tree/master/Samples/Kitten/Merchello.StarterSite and I can see that there have been made a pull-request for PayPal, 2 days ago, and the file that have been made changes to is located here: https://github.com/Merchello/Samples/blob/master/Samples/Kitten/Merchello.StarterSite/App_Code/MerchKit/Controllers/MerchKitApiController.cs

    You can find the pull-request here https://github.com/Merchello/Samples/pull/20 perhaps, it can help you closer.

    /Dennis

  • Eidos 44 posts 66 karma points
    Jan 14, 2015 @ 16:10
    Eidos
    0

    @Flavio: thanks for your suggests.

    I tried to change the price so that the total has 2 decimals but ApproveOrderCreation is false again and return the same error.

    @Nik in your PerformAuthorizePayment method, how do you check if the order total is invalid or not? (so I know where I get wrong)

     

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 14, 2015 @ 16:13
    Nik Wahlberg
    0

    Eidos, which version of the plugin are you using? Also, what version of Merchello do you have installed? 

  • Eidos 44 posts 66 karma points
    Jan 14, 2015 @ 16:19
    Eidos
    0

    Umbraco 7.2.1, Merchello 1.6.1 and PayPal 1.0.1

  • Flavio Spezi 129 posts 315 karma points
    Jan 14, 2015 @ 17:15
    Flavio Spezi
    0

    I compared my controller code with MerchKitApiController: they are the same.

    I test plugin using a bad paypal account. Then when buyer try to confirm the basket, website returns an expected error.
    If the buyer try again with another click to confirm button, the application returns an unexpected issue: System.NullReferenceException.

    I think that I need to invoke a rollback method...
    Is it right?

    I look that I can solve this with 2 or more updates of basket.items list.

    stack

    • in Merchello.Core.Persistence.Repositories.ItemCacheRepository.PersistDeletedItem(IItemCache entity) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Persistence\Repositories\ItemCacheRepository.cs:riga 133
    • in Merchello.Core.Persistence.Repositories.MerchelloRepositoryBase`1.PersistDeletedItem(IEntity entity) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Persistence\Repositories\MerchelloRepositoryBase.cs:riga 126
    • in Merchello.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action`1 transactionCompleting) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Persistence\UnitOfWork\PetaPocoUnitOfWork.cs:riga 115
    • in Merchello.Core.Services.ItemCacheService.Delete(IItemCache itemCache, Boolean raiseEvents) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Services\ItemCacheService.cs:riga 177
    • in Merchello.Core.Sales.SalesPreparationEvents.SalePreparationBaseOnFinalizing(SalePreparationBase sender, SalesPreparationEventArgs`1 args) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Sales\SalesPreparationEvents.cs:riga 52
    • in Umbraco.Core.Events.TypedEventHandler`2.Invoke(TSender sender, TEventArgs e)
    • in Merchello.Core.Sales.SalePreparationBase.AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Sales\SalePreparationBase.cs:riga 338
    • in Merchello.Web.Workflow.BasketSalePreparation.AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Web\Workflow\BasketSalePreparation.cs:riga 39
    • in WebLib.Controller.BasketApiController.ConfirmBasket(JObject namedArgs) in c:\InetWeb\Domini\Benesse-Store.it\wwwv2\AppCode\WebLib\Controller\BasketApiController.cs:riga 596
    • in lambda_method(Closure , Object , Object[] )
    • in System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass13.c(Object instance, Object[] methodParameters)
    • in System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
    • in System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)
  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 14, 2015 @ 18:08
    Nik Wahlberg
    0

    Hi Flavio, I think this is unlreated to the payment provider plugins. This last issue should probably have it's own thread. 

    Thanks,
    Nik 

  • Flavio Spezi 129 posts 315 karma points
    Jan 14, 2015 @ 19:17
    Flavio Spezi
    0

    Ok, I created new issue: http://issues.merchello.com/youtrack/issue/M-573

    NIK,
    I build many changes to your PayPal plugin. Are you interested to it? I can push the version to GitHub.
    I am not expert to collaboration in opensource project, then maybe my work is to trash.
    I do this changes:

    • send Ship address to PayPal
    • Currency is set with invoice.Currency value
    • prices is round to 0 or 2 decimals (it depends by currency)
    • Custom lineTime are discard
    • add ReturnUrl, CancelUrl and AllArticlesPath to backoffice setting
    • add feature to customize ReturnUrl, CancelUrl and AllArticlesPath per request (with ProcessorArgumentCollection)
    • add "live mode" to switch on/off sandbox mode
    • some more little details

    I am at your command, Nik

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 14, 2015 @ 19:53
    Nik Wahlberg
    0

    Hi Flavio, that'd be great. We're definitely open to suggestions and improvements. Feel free to do a pull request in GitHub and we'll check it out and merge in as appropriate. There may be some items that we'll have feedback on, but that's the nature of contributing :)

    Thanks for your feedback and work on this Flavio!

    Best,
    Nik  

  • Eidos 44 posts 66 karma points
    Jan 15, 2015 @ 17:41
    Eidos
    0

    thanks @Nik and @Flavio:
    now the PayPal plugin seems to work fine but I will test it!

    The problem was about the separator of decimal price (I had to fix it in all occurrences).

    Short question: how can I obtain the paymentMethodKey from an invoice? (I woult like to use the same result order page for all payment used).

     

  • Flavio Spezi 129 posts 315 karma points
    Jan 15, 2015 @ 18:42
    Flavio Spezi
    0

    It is simply when you have only one Payment:
    invoice.Payments().First().PaymentMethodKey

  • Raoul Jacobs 4 posts 24 karma points
    Jan 16, 2015 @ 17:14
    Raoul Jacobs
    0

    Hi Nik, Flavio,

    this code below seems only to handle cashpayments

    var authorize = salesPreparation.AuthorizePayment(model.PaymentMethodKey);
    
    if (authorize.Payment.Success) 
    {
       if (authorize.Payment.Result.ExtendedData != null && authorize.Payment.Result.ExtendedData.ContainsKey("OrderConfirmUrl"))
           return new { Redirect = authorize.Payment.Result.ExtendedData["OrderConfirmUrl"] };
        return new { Redirect = string.Format("/receipt/?inv={0}", authorize.Invoice.Key.ToString().EncryptWithMachineKey()) };
    }
    
    return new { Error = authorize.Payment.Exception.Message };
    

    Currently it doesn't redirect to paypal. Do we need to add extra code when the paymentmethod is PayPal?

    We couldn't find any code nor example on that.

    Can any of you enlight me? :)

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 16, 2015 @ 17:21
    Rusty Swayne
    0

    Hi Raoul,

    You just need to make sure the model.PaymentMethodKey is the key for the PayPal payment method. If you have multiple payment providers configured (and activated)

      invoice.Payments().First().PaymentMethodKey
    

    may not return the PayPal payment method key.

  • Raoul Jacobs 4 posts 24 karma points
    Jan 17, 2015 @ 23:46
    Raoul Jacobs
    0

    Hi Rusty,

     

    I checked this one... the key which we get is the paypal key.

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 19, 2015 @ 21:12
    Nik Wahlberg
    0

    Hey Raoul,

    the PayPal plugin will return an OrderConfirmUrl if the payment was successful or throw an exception if it was not (with a message and success flag set to false). 

    try
     {
         var response = GetPayPalService().SetExpressCheckout(new SetExpressCheckoutReq { SetExpressCheckoutRequest = new SetExpressCheckoutRequestType(setExpressCheckoutRequestDetails) });
         if (response.Ack == AckCodeType.SUCCESS)
         {
             payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.OrderConfirmUrl, "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + response.Token);
             return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
         }
    
         var errorMessage = response.Errors.Count > 0 ? response.Errors[0].LongMessage : "An unknown error";
         return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(errorMessage)), invoice, false);
     }
     catch (Exception ex)
     {
         return new PaymentResult(Attempt<IPayment>.Fail(payment, ex), invoice, false);
     }
    

    Are you using 1.0.0 or 1.0.1? 

    Thanks,
    Nik  

  • Raoul Jacobs 4 posts 24 karma points
    Jan 20, 2015 @ 01:02
    Raoul Jacobs
    0

    Hi Nik,

    Thx for your reply.
    We are 1.01

    Looking at Rusty's reply I would imagine that there is an automatic redirect to paypal which we don't get to work.

    Your code above is this the one which is invoking the redirect to paypal?

    Raoul

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jan 22, 2015 @ 11:59
    Damiaan
    0

    Hi,

    I have the same issue with the sample site. I just used the documentation of the paypal plug-in together with the sample site, but I never got redirected to the paypal site. Any ideas why? How can I debug this?

    What event/command from merchello should trigger the plugin to redirect to paypal?

    Kind regards
    Damiaan

  • Eidos 44 posts 66 karma points
    Jan 22, 2015 @ 14:10
    Eidos
    0

    In your checkout controller you confirm the order with the following code (or like this):
    attempt = preparation.AuthorizePayment(paymentMethod.Key);

    If paypal plugin works fine (attempt.Payment.Success==true), you mast to redirect the user to the following url:
    string url = attempt.Payment.Result.ExtendedData.GetValue("OrderConfirmUrl")

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jan 23, 2015 @ 15:27
    Damiaan
    0

    Hi guys thanks for helping out!

    Currently the property of Authorize.Payment.Success is false. The error message on the Payment object is: "Order total is invalid."

    Any hints?

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jan 23, 2015 @ 16:23
    Damiaan
    0

    Hi Nik,

    We looked it up and apparently this is a PayPal error

    10401 Transaction refused because of an invalid argument. See additional error messages for details. Order total is invalid. SetExpressCheckout

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jan 23, 2015 @ 16:42
    Damiaan
    0

    We found a work-around. We needed to set the culture needs to en-US before running the payment handling.

    string language = "en";
    string culture = "US";
    
    Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(string.Format("{0}-{1}", language, culture));
    Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(string.Format("{0}-{1}", language, culture));
    
  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jan 23, 2015 @ 16:43
    Damiaan
    0

    We have now a new Exception from PayPal.

    Invalid CancelUrl how can we sort this?

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Jan 25, 2015 @ 18:38
    Andy Butland
    0

    Hope one more chipping in on this thread is OK!  But also trying to set up the PayPal processor.  Have set up the Gateway provider but getting the following error.

    [NullReferenceException: Object reference not set to an instance of an object.]
       Merchello.Plugin.Payments.PayPal.PayPalPaymentProcessor.ExpressCheckout(IInvoice invoice, IPayment payment) in d:\Merchello\SVN\GitHub\Plugin\Payments\PayPal\src\Merchello.Plugin.Payments.PayPal\PayPalPaymentProcessor.cs:48
       Merchello.Plugin.Payments.PayPal.Provider.PayPalPaymentGatewayMethod.ProcessPayment(IInvoice invoice) in d:\Merchello\SVN\GitHub\Plugin\Payments\PayPal\src\Merchello.Plugin.Payments.PayPal\Provider\PayPalPaymentGatewayMethod.cs:74
       Merchello.Plugin.Payments.PayPal.Provider.PayPalPaymentGatewayMethod.PerformAuthorizePayment(IInvoice invoice, ProcessorArgumentCollection args) in d:\Merchello\SVN\GitHub\Plugin\Payments\PayPal\src\Merchello.Plugin.Payments.PayPal\Provider\PayPalPaymentGatewayMethod.cs:50
       Merchello.Core.Gateways.Payment.PaymentGatewayMethodBase.AuthorizePayment(IInvoice invoice, ProcessorArgumentCollection args) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Gateways\Payment\PaymentGatewayMethodBase.cs:108
       Merchello.Core.Sales.SalePreparationBase.AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Sales\SalePreparationBase.cs:336
       Merchello.Web.Workflow.BasketSalePreparation.AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Web\Workflow\BasketSalePreparation.cs:39
       Merchello.Core.Sales.SalePreparationBase.AuthorizePayment(Guid paymentMethodKey, ProcessorArgumentCollection args) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Sales\SalePreparationBase.cs:363
       Merchello.Core.Sales.SalePreparationBase.AuthorizePayment(Guid paymentMethodKey) in c:\Working Repositories\GitHub\Merchello\src\Merchello.Core\Sales\SalePreparationBase.cs:373
       MerchelloDemo.Web.Controllers.PaymentPageController.SelectPayment(PaymentPageViewModel vm) in c:\Projects\Source\Spikes\MerchelloDemo\MerchelloDemo.Web\Controllers\PaymentPageController.cs:74 ...
    

    This occurs when I call AuthorizePayment here:

    var paymentMethod = MerchelloContext.Current.Gateways.Payment.GetPaymentGatewayMethodByKey(vm.SelectedPaymentMethod).PaymentMethod;
    var preparation = basket.SalePreparation();
    preparation.SavePaymentMethod(paymentMethod);
    
    var attempt = preparation.AuthorizePayment(paymentMethod.Key);
    

    Many thanks in advance for any pointers.

    Andy

  • Barry Fogarty 493 posts 1129 karma points
    Jan 26, 2015 @ 16:56
    Barry Fogarty
    0

    I am also suffering from the same problem @Damiaan reported when integrating the PayPal express plugin:  authorize.Payment.Success is false, and the reported error in authorize.Payment is  {"CancelURL is invalid."}

    CancelURL is a parameter PayPal expects when setting up the checkout, but it is not available as a setting in the provider configuration.  Can you shed some light on how I can set this parameter so the redirect to the PayPal checkout works?

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jan 26, 2015 @ 17:17
    Damiaan
    0

    Andy, are you sure you have setup everything correctly? Barry, I have still the problem and haven't had any time to dive in. I remember something that paypal rejects local (http://localhost:4444) urls. Let us know if you solved the problem!

  • Barry Fogarty 493 posts 1129 karma points
    Jan 26, 2015 @ 17:50
    Barry Fogarty
    0

    Thanks Damiaan, I tried your suggestion but using a non-localhost address does not help unfortunately.

     

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 26, 2015 @ 18:05
    Nik Wahlberg
    0

    Hi all,

    righht now we use Confirmation Return URL for the cancel URL. If the user confirms (pays) for the order, then the standard confirmation page is displayed, if they choose to cancel the PayPal process, then they are redirected to the Invoice Details (which is the same as the order confirmation), but this time a link is displayed to "try again" (see code in earler post in this thread). 

    Also, when configuring the confirm URL, make sure to keep it relative and not absolute (exclude the domain). We're prefixing the return URL based on the current site domain. 

    Hope this helps. 

    Cheers,
    Nik  

  • Barry Fogarty 493 posts 1129 karma points
    Jan 26, 2015 @ 19:40
    Barry Fogarty
    0

    Thanks Nik excluding the domain from the confirm URL was it!  You should include this little gotcha in the instructions PDF :-)

    Could you also give me a pointer on how to look up the invoice on my confirm page please?  I would like to display a page similar to the receipt on the Kitten example, however this depends on a reference to the invoice key in the URL and I cannot figure out how this can be passed to Paypal in the plugin settings.  Is there a token I can use, or do I need to implement a different method to return the buyer's invoice?

  • Flavio Spezi 129 posts 315 karma points
    Mar 31, 2015 @ 09:48
    Flavio Spezi
    0

    Have you tried to install the latest version of the PlugIn?
    You can find it here:

    https://github.com/Merchello/Merchello/tree/1.8.1/Plugin/Payments/PayPal

  • Cristovao 12 posts 33 karma points
    Apr 27, 2015 @ 17:21
    Cristovao
    0

    Hi all,

    I have Merchello 1.8.0 and Paypal Provider version 1.0.4 (downloaded from project page). I have installed successfully both plugins without any errors, createad a sandbox account, configured the account on paypal provider backoffice, and now I would like to have some paypal action...

    The Merchello store is very good, I have created a new theme, and it is working fine. Congratulations for all your work!

    Now I have a problem, on the confirm sale page, I have configure two payments: cash and paypal.

    When I select Cash, everything is ok, and I can create the order, but when I select paypal, the "confirm sale" button disappear.

    Anyone with the same problem? The 1.0.4 version work with the 1.8.0 version of Merchello? What are the Paypal configurations that I should have?

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jul 16, 2015 @ 08:30
    Biagio Paruolo
    0

    Which are the rights url to configure into Paypal gateway plugin?

  • J. B. 15 posts 88 karma points
    Apr 30, 2015 @ 16:35
    J. B.
    0

    Nik advised a few weeks ago that his team was working on a Bazaar version of PayPal for release on/about 4/20.  I guess keep checking back?  We've had to abandon this PayPal payment extension and roll our own, due to time constraints, but it has great promise.

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Apr 30, 2015 @ 16:47
    Nik Wahlberg
    0

    Sorry all, we've been swamped here and have not had time to come up for air to work on this. I will reach out to Rusty and try to coordinate ASAP! Thanks for your continued support. 

    Best,
    Nik 

  • Nathan Sleigh 109 posts 353 karma points
    May 06, 2015 @ 15:43
    Nathan Sleigh
    0

    Hi guys,

    Is there any solution to Cristovao's issue yet? I am having the same problem.

    Thanks

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jul 15, 2015 @ 09:03
    Biagio Paruolo
    0

    Me too

  • Tom Van Rompaey 38 posts 136 karma points
    May 17, 2015 @ 15:41
    Tom Van Rompaey
    1

    You need to add a separate button for the PayPal payment when using the Bazaar Starter kit:

    <!-- Cash Payment Method -->
    <div id="CashPaymentMethod" class="payment-method-form">
        @using (Html.BeginUmbracoForm<SalePreparationOperationsController>("ConfirmSale", null, new { @id = "ConfirmSale" }))
        {
            @Html.HiddenFor(x => x.ShipMethodKey, new { @class = "selected-shipmethod-key" })
            @Html.HiddenFor(x => x.PaymentMethodKey, new { @class = "selected-paymentmethod-key" })
            @Html.HiddenFor(x => x.CustomerToken, new { @id = "customer-token" })
            @Html.HiddenFor(x => x.ReceiptPageId)
            <div class="form-group">
                <button type="submit" class="btn btn-primary">Confirm Sale</button>
            </div>
        }
    </div>
    
    <!-- PayPal Payment Method -->
    <div id="PayPalPayment" class="payment-method-form">
        @using (Html.BeginUmbracoForm<SalePreparationOperationsController>("ConfirmPayPalSale", null, new { @id = "ConfirmPayPalSale" }))
        {
            @Html.HiddenFor(x => x.ShipMethodKey, new { @class = "selected-shipmethod-key" })
            @Html.HiddenFor(x => x.PaymentMethodKey, new { @class = "selected-paymentmethod-key" })
            @Html.HiddenFor(x => x.CustomerToken, new { @id = "customer-token" })
            @Html.HiddenFor(x => x.ReceiptPageId)
            <div class="form-group">
                <button type="submit" class="btn btn-primary">Confirm Sale</button>
            </div>
        }
    </div>
    
  • Cristovao 12 posts 33 karma points
    May 19, 2015 @ 00:09
    Cristovao
    0

    Hi Tom,

    Thank you for your clarification. I have placed the div with the button and now it appears.

    But are you sure that it is the correct controller name? When I make the "Confirm Sale" request, I have a 404 not found error...

    Note: I am working with a PayPal Sandbox Account, I havent enable the https yet, I do not now if this is relevant..

    Any sugestions?

  • Tom Van Rompaey 38 posts 136 karma points
    May 19, 2015 @ 21:43
    Tom Van Rompaey
    1

    Hi Cristovao,

    The post from the button is pointing to ConfirmPayPalSale from the SalePreparationOperationsController (I've just copied the controller name to show you the example).

    You have to write your own method to make this work.

    This is the method I'm currently using for handling the PayPal payments:

    [HttpPost]
    public ActionResult ConfirmPayPalSale(CheckoutConfirmationForm model)
    {
        if (!ModelState.IsValid) return this.CurrentUmbracoPage();
    
        var preparation = Basket.SalePreparation();
        preparation.RaiseCustomerEvents = false;
    
        preparation.ClearShipmentRateQuotes();
        var shippingAddress = Basket.SalePreparation().GetShipToAddress();
    
        // Get the shipment again
        var shipment = Basket.PackageBasket(shippingAddress).FirstOrDefault();
    
        // get the quote using the "approved shipping method"
        var quote = shipment.ShipmentRateQuoteByShipMethod(model.ShipMethodKey);
    
        // save the quote
        Basket.SalePreparation().SaveShipmentRateQuote(quote);
    
        var paymentMethod = GatewayContext.Payment.GetPaymentGatewayMethodByKey(model.PaymentMethodKey).PaymentMethod;
        preparation.SavePaymentMethod(paymentMethod);
    
        // AuthorizePayment will save the invoice with an Invoice Number.
        var attempt = preparation.AuthorizePayment(paymentMethod.Key);
    
        if (!attempt.Payment.Success)
        {
            return this.CurrentUmbracoPage();
        }
    
        // Trigger the order confirmation notification
        var billingAddress = attempt.Invoice.GetBillingAddress();
        string contactEmail;
        if (string.IsNullOrEmpty(billingAddress.Email) && !CurrentCustomer.IsAnonymous)
        {
            contactEmail = ((ICustomer)CurrentCustomer).Email;
        }
        else
        {
            contactEmail = billingAddress.Email;
        }
    
        if (!string.IsNullOrEmpty(contactEmail))
        {
            Notification.Trigger("OrderConfirmation", attempt, new[] { contactEmail });
        }
    
        // store the invoice key in the CustomerContext for use on the receipt page.
        CustomerContext.SetValue("invoiceKey", attempt.Invoice.Key.ToString());
    
        string url = attempt.Payment.Result.ExtendedData.GetValue("RedirectUrl");
        return Redirect(url);
    }
    
  • Ian Black 54 posts 230 karma points
    Jul 18, 2015 @ 19:24
    Ian Black
    0

    Hey Tom,

    Thanks for the info here. I'm still struggling to get PayPal working. I'm running with the Bazaar Starter Kit which was installed via the packages so I don't have access to the source code for it - is it available? I don't see it on github.

    I've added the code for the PayPal button on the front end and that's working correctly, however, without access to the source can I add the controller action which deals with the PayPal request? I don't have access to SalePreparationOperationsController to add the new action as it's compiled within the Bazaar .dll.

    Thanks, Ian.

  • Cristovao 12 posts 33 karma points
    May 20, 2015 @ 19:13
    Cristovao
    0

    Hi Tom,

    Thank you for your quick reply. I understand, there is not controller to handle the request... I do not know the Merchello or PayPal structure, I have only changed some views on Baazar project and thats it.

    Witch project do I need to compile? I have the VS project for the Merchello 1.8.0 with Bazaar. Can I use that to compile the code on top?

    I take a look on the PayPal page on GitHub https://github.com/Merchello/Merchello/tree/1.6.1/Plugin/Payments/PayPal

    But this do not seem to be the current 1.0.4 version of the plugin available on Umbraco page (I have installed version 1.0.4).

    If you have a Visual Studio Sample project for me to integrate the code you have posted it will help me and others.

    Again, thank you for your help.

  • Cristovao 12 posts 33 karma points
    May 21, 2015 @ 20:31
    Cristovao
    0

    Hi Tom,

    Just a update. I have managed to make it to work. I have found the controller on the Bazzar project and included your code. It is working ok now, many thanks for your help.

  • Cristovao 12 posts 33 karma points
    Jun 11, 2015 @ 16:22
    Cristovao
    0

    Hi again,

    Now I have a question about the Return URL configuration. I have configured my receipt page: /checkout/receipt/?inv=%INVOICE% And Paypal plugin redirect correctly to this page with the inv variable filled in.

    My question here is: Should the corresponding order change the status to Paid, or to other status? I need to make some actions after the order is payed thru paypal, so I need to have absolutely sure that everything went ok on PayPal process.

    On my case I do not see any difference between the order before paypal process and after the Paypal redirection.

    Thanks in advance.

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jun 29, 2015 @ 12:55
    Biagio Paruolo
    0

    Is it support recurring payments?

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jul 07, 2015 @ 13:51
    Biagio Paruolo
    0

    Why don't appear the confirmation button?

  • Cristovao 12 posts 33 karma points
    Jul 07, 2015 @ 14:01
    Cristovao
    0

    Hi Biagio,

    You need to check the Tom Van Rompaey responses.

    You need to add the confirm Sale Button for PayPal on CheckoutConfirmationForm.cshtml partial view and add the ConfirmPayPalSale POST action on SalePreparationOperationsController on Bazzar Store.

    It is working OK with me.

    Note: Merchello 1.8.0 and PayPal plugin 1.0.4

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jul 07, 2015 @ 15:22
  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jul 16, 2015 @ 08:24
    Biagio Paruolo
    0

    Now works...but I think is better to create the code like Cash Payment or Braintree directly into their controllers.

    Which are the rights url to configure into Paypal gateway plugin?

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jul 19, 2015 @ 06:06
    Biagio Paruolo
    1

    @ianblak10: yuo find merchello bazaar info merchello repo on github. You download merchello repo and find bazaar project. The merchello repo is a vs2013 solution with already Umbraco installed.

  • Ian Black 54 posts 230 karma points
    Jul 19, 2015 @ 14:15
    Ian Black
    0

    Thanks Biagio, I got the Bazaar source from the github repo. I made Tom's changes there and copied the bazaar dll back to my project and now I have PayPal functioning!

    Thanks guys!

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Jul 19, 2015 @ 15:05
    Biagio Paruolo
    0

    Good. High Five, please, if all ok.

  • Jason 92 posts 175 karma points
    Jul 26, 2015 @ 20:32
    Jason
    0

    Hi guys, do we have a working sample project?

    I have Merchello installed, products, a basket and checkout process. At the moment the checkout process just saves the payment details.

    I have installed the PayPal plugin, but struggling to find solid documentation for the controller that 'talks' with paypal.

    thanks

  • Simon 692 posts 1068 karma points
    Aug 05, 2015 @ 15:02
    Simon
    0

    Hi Cristovao,

    How have you managed it to work?

    Currently, I have installed the Payapl Express Plugin and in CashPaymentMethodForm has the following:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<CheckoutConfirmationForm>
    @using System.Web.Mvc.Html
    @using Merchello.Bazaar.Controllers
    @using Merchello.Bazaar.Models
    @using Umbraco.Web
    
      <!-- Cash Payment Method -->
    @using (Html.BeginUmbracoForm<CashPaymentMethodController>("ConfirmSale", null, new { @id = "ConfirmSale" }))
    {
        @Html.AntiForgeryToken()
        @Html.HiddenFor(x => x.ShipMethodKey, new { @class = "selected-shipmethod-key" })
        @Html.HiddenFor(x => x.PaymentMethodKey, new { @class = "selected-paymentmethod-key" })
        @Html.HiddenFor(x => x.CustomerToken, new { @id = "customer-token" })
        @Html.HiddenFor(x => x.ReceiptPageId)
        <div class="control-group">
            <button type="submit" class="btn btn-primary">Confirm Sale</button>
        </div>
    }
    

    Now, as I mentioned, I have added the paypal provider from the CMS, but in the confirmation page, when I choose Paypal, the button Confirm Sale disappears.

    Do I need to do some changes to controllers and even to the CashPayment MethodForm Please?

    Thank you. Appreciate any help.

    Kind Regards.

  • Jason 92 posts 175 karma points
    Aug 09, 2015 @ 16:27
    Jason
    0

    Hi Simon, you need to add this snippet underneath you cash method of that view:

    <!-- PayPal Payment Method -->
    <div id="PayPalPayment" class="payment-method-form">
    @using (Html.BeginUmbracoForm<SalePreparationOperationsController>("ConfirmPayPalSale", null, new { @id = "ConfirmPayPalSale" }))
    {
        @Html.HiddenFor(x => x.ShipMethodKey, new { @class = "selected-shipmethod-key" })
        @Html.HiddenFor(x => x.PaymentMethodKey, new { @class = "selected-paymentmethod-key" })
        @Html.HiddenFor(x => x.CustomerToken, new { @id = "customer-token" })
        @Html.HiddenFor(x => x.ReceiptPageId)
        <div class="form-group">
            <button type="submit" class="btn btn-primary">Confirm Sale</button>
        </div>
    }
    

  • Jason 92 posts 175 karma points
    Aug 09, 2015 @ 16:36
    Jason
    0

    At the final stage of the PayPal payment, i'm getting this error. This occurs when you click 'Continue' on the Paypal page itself:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <Error>
    <Message>An error has occurred.</Message>
    <ExceptionMessage>
    Method not found: 'Void Merchello.Web.Workflow.IBasket.Empty()'.
    </ExceptionMessage>
    <ExceptionType>System.MissingMethodException</ExceptionType>
    <StackTrace>
    at Merchello.Plugin.Payments.PayPal.Controllers.PayPalApiController.SuccessPayment(Guid invoiceKey, Guid paymentKey, String token, String payerId) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4() at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)
    

  • Simon 692 posts 1068 karma points
    Aug 09, 2015 @ 17:18
    Simon
    0

    Hi Jason,

    I have done that,, but do you need to alter the controller?

    Thank you.

  • Jason 92 posts 175 karma points
    Aug 09, 2015 @ 17:27
    Jason
    0

    Hi yes you need to get the Bazaar source and add a httppost method. There's a post above describing it. Then build and add the dll to your project

  • Simon 692 posts 1068 karma points
    Aug 09, 2015 @ 17:29
    Simon
    0

    Have you solved the error that you have mentioned above?

    Thank you

  • Jason 92 posts 175 karma points
    Aug 09, 2015 @ 18:25
    Jason
    0

    Not as yet, probably won't get a chance until tomorrow. I suspect the method that's missing has been abstracted out within a later version of the package. I probably won't have time tonight.

    Are you now getting the same error?

  • Jason 92 posts 175 karma points
    Aug 09, 2015 @ 20:54
  • Graham Carr 277 posts 389 karma points
    Aug 26, 2015 @ 18:21
    Graham Carr
    0

    I have been trying to follow this thread but have got completely lost. Basically I am running the following versions of Umbraco and Merchello:

    Umbraco V7.2.6 Merchello V1.8.3

    I have installed the PayPal Express payment provider V1.0.4 and although it appears in my list of payment options in the checkout, when I select it and click Submit I am not redirected anywhere.

    I am plugging Merchello into an existing site so the use of the Bazaar package not an option so have been following the Samples outlined here:

    https://github.com/Merchello/Samples

    Does the PayPal plugin not work with the code samples that are given, if not what is the best way around my current dilemma?

  • Jason 92 posts 175 karma points
    Aug 26, 2015 @ 20:49
    Jason
    0

    Hi Graham, integrating Paypal into your site with or without the Bazaar build as a base, will require a small amount of work.

    Setting up your payment provider and gateway is done by the sounds of it.

    You next need to :

    Create a Paypal button - this button should call your payment handling controller, in particular the paypal handler

    <div id="PayPalPayment" class="payment-method-form">
    @using (Html.BeginUmbracoForm<SalePreparationOperationsController>("ConfirmPayPalSale", null, new { @id = "ConfirmPayPalSale" }))
    {
        @Html.HiddenFor(x => x.ShipMethodKey, new { @class = "selected-shipmethod-key" })
        @Html.HiddenFor(x => x.PaymentMethodKey, new { @class = "selected-paymentmethod-key" })
        @Html.HiddenFor(x => x.CustomerToken, new { @id = "customer-token" })
        @Html.HiddenFor(x => x.ReceiptPageId)
        <div class="form-group">
            <button type="submit" class="btn btn-primary">Confirm Sale</button>
        </div>
    }
    

    Your payment handling function should look something like this

    [HttpPost]
    public ActionResult ConfirmPayPalSale(CheckoutConfirmationForm model)
    {
    if (!ModelState.IsValid) return this.CurrentUmbracoPage();
    
    var preparation = Basket.SalePreparation();
    preparation.RaiseCustomerEvents = false;
    
    preparation.ClearShipmentRateQuotes();
    var shippingAddress = Basket.SalePreparation().GetShipToAddress();
    
    // Get the shipment again
    var shipment = Basket.PackageBasket(shippingAddress).FirstOrDefault();
    
    // get the quote using the "approved shipping method"
    var quote = shipment.ShipmentRateQuoteByShipMethod(model.ShipMethodKey);
    
    // save the quote
    Basket.SalePreparation().SaveShipmentRateQuote(quote);
    
    var paymentMethod = GatewayContext.Payment.GetPaymentGatewayMethodByKey(model.PaymentMethodKey).PaymentMethod;
    preparation.SavePaymentMethod(paymentMethod);
    
    // AuthorizePayment will save the invoice with an Invoice Number.
    var attempt = preparation.AuthorizePayment(paymentMethod.Key);
    
    if (!attempt.Payment.Success)
    {
        return this.CurrentUmbracoPage();
    }
    
    // Trigger the order confirmation notification
    var billingAddress = attempt.Invoice.GetBillingAddress();
    string contactEmail;
    if (string.IsNullOrEmpty(billingAddress.Email) && !CurrentCustomer.IsAnonymous)
    {
        contactEmail = ((ICustomer)CurrentCustomer).Email;
    }
    else
    {
        contactEmail = billingAddress.Email;
    }
    
    if (!string.IsNullOrEmpty(contactEmail))
    {
        Notification.Trigger("OrderConfirmation", attempt, new[] { contactEmail });
    }
    
    // store the invoice key in the CustomerContext for use on the receipt page.
    CustomerContext.SetValue("invoiceKey", attempt.Invoice.Key.ToString());
    
    string url = attempt.Payment.Result.ExtendedData.GetValue("RedirectUrl");
    return Redirect(url);
    }
    

    You will also need to change the Paypal Plugin dll. See this post here to either make the change yourself or download the modified dll. https://our.umbraco.org/projects/collaboration/merchello/merchello/70231-paypal-express-payment-provider-method-not-found-exception

    I can supply a working sample site using the bazaar store if this helps.

    Hope this helps

    Jason

    p.s. don't forget to add your paypal information into the provider

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Aug 26, 2015 @ 19:47
    Biagio Paruolo
    0

    Hi,

    Could you post Umbraco log?

  • Simon 692 posts 1068 karma points
    Oct 16, 2015 @ 13:03
    Simon
    0

    HI Guys,

    Unforetunately, I cannot make Paypal to work successfully.

    So, I had included the a new HttpPost action method in the SalePreparationOpertaionsConteller and also added the below code in the CheckoutConfirmationForm.cshtml

    <!-- PayPal Payment Method -->
            <div id="PayPalPayment" class="payment-method-form">
                @using (Html.BeginUmbracoForm<SalePreparationOperationsController>("ConfirmPayPalSale", null, new { @id = "ConfirmPayPalSale" }))
                {
                    @Html.HiddenFor(x => x.ShipMethodKey, new { @class = "selected-shipmethod-key" })
                    @Html.HiddenFor(x => x.PaymentMethodKey, new { @class = "selected-paymentmethod-key" })
                    @Html.HiddenFor(x => x.CustomerToken, new { @id = "customer-token" })
                    @Html.HiddenFor(x => x.ReceiptPageId)
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary">Confirm Sale</button>
                    </div>
                }
            </div>
    

    Now, when I click on the Paypal button to continue with paypal, I am not being redirected to the Paypal Page, but just a blank page as the following link:

    http://localhost/checkout/confirm-sale/?ShipMethodKey=47eb4b06-c3a4-45fa-87c1-3300f3a86b6a&ShipMethodKey=47eb4b06-c3a4-45fa-87c1-3300f3a86b6a&PaymentMethodKey=32cd87cb-5692-4f64-99be-0cc18a5dab89&CustomerToken=46C4A92E9CE03150DDA48ACFE783B2D937735D7F9A3AACDC465EFE44B93927B4D07408D3C54A53451858585786841BA4927529F9A658B1355D4A47B7EC808D4F1D489FFB3AEAF0D14750F15747F5CE5C3C7D667B120A43A56ABD2C0C11A06CD522421C0F10FF3C150AF607692FBE87DCFFA227F570928ADCFBE6ADF18381FD5F42736ADAB023E088B1EAAC79A869446C8DF69B603872220EFA544AB0C0E2A473&ReceiptPageId=1639&x=34&y=16&ufprt=1B02F9BAF27266C536373B4F150C090FE5C46604715370440A2F0C57FA32B4701ED2408D9F72C5FCA10E0AB8A4A598E997ABC0BCAAE05BA7810CA19C1A2149A2A0F4BF312AEDB057315E813661E58929E3DBA8EF90A16ABE05DBEA208459EC56B7750FE899523908B99416DC9C1779C9912F5090D2AF49416CAE378F2946B92F12A1E8B1F74168929811B7F53186A6B7ADB41820D3C1801A61A9303F62CA731E61C40548A4B70031DDDC2784B81E49CB2A1DAE569950E8D11DE14F36489C6231
    

    Also, I have configured the paypal plugin with a sandbox account.

    I am really lost about this.

    Does anybody have a solution please?

    Thank you in advance.

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Oct 16, 2015 @ 19:04
    Biagio Paruolo
    0

    I've not installed the 1.11 version. Have you recompiled the Paypal sources with Merchello 1.11?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies