Copied to clipboard

Flag this post as spam?

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


  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Apr 16, 2015 @ 23:15
    Andy Butland
    0

    Working with payment providers (specifically Authorize.Net)

    Would appreciate if someone could advise on the steps needed to integrate a payment provider.  Specifically I'm looking to use the Authorize.Net one that comes as a plugin with Merchello.

    I have a checkout process set up working fine with the "Cash" payment provider.

    So given I have a basket set up with a saved billing address, shipping address and shipment quote, I then have provided my customer a choice of payment methods, one of which is credit card based on Authorize.Net which has been configured with the key details in the back-office.  Posting that form calls this code:

        var basket = GetBasket();
        if (basket.IsEmpty)
        {
            return RedirectToBasketPage();
        }
    
        if (ModelState.IsValid)
        {
            // Associate the payment method with the order
            var paymentMethod = MerchelloContext.Current.Gateways.Payment.GetPaymentGatewayMethodByKey(vm.SelectedPaymentMethod).PaymentMethod;
            var preparation = basket.SalePreparation();
            preparation.SavePaymentMethod(paymentMethod);
    
            // Authorise the payment
            var attempt = preparation.AuthorizePayment(paymentMethod.Key);
    
            // Redirect to receipt page having saved invoice key in session
            if (attempt.Payment.Success)
            {
                Session["InvoiceKey"] = attempt.Invoice.Key.ToString();
                return RedirectToUmbracoPage(GetReceiptPageNode().Id);
            }
            else
            {
                throw new ApplicationException("Payment authorisation failed.");
            }
        }
    
        return CurrentUmbracoPage();

    As I say, works fine for the cash payment provider, but fails on the AuthorizePayment line with an error when I use the Authorize.Net one.  Looking into the source it's failing in the AuthorizeNetPaymentGatewayMethod.ProcessPayment method as no card details can be found.  That's expected really as I haven't provided any, so seems I'm missing a step somewhere as to where to hook in this extra part to the process.

    Thanks in advance

    Andy

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Apr 16, 2015 @ 23:19
    Andy Butland
    0

    Ah, posted too soon - ProcessorArgumentCollection seems to be what I'm after.  This thread looks useful.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Apr 17, 2015 @ 01:56
    Rusty Swayne
    0

    Hey Andy,

    Yes, you need to add the cc number and cvv into the process arguments collection for that one.

    I'm going to be working on that payment provider again in the next couple of days as well so that I have a working example in the Bazaar site. It'll also be extended to be able to void and refund payments through the back office as well as capture new payments in the event that someone wanted to change their payment method and phoned in for example.

    Anyway, I'll let you know when I have something more for you to look at.

  • Scott F 3 posts 73 karma points
    Mar 02, 2016 @ 15:51
    Scott F
    0

    Hi Rusty,

    I was wondering if you have a working example yet of using Authorize.net on a Bazaar site. I tried installing the Merchello AuthorizeNet Payment provider package (version 1.2.0) on my test site running Merchello and Bazaar (version 1.14.1) and Umbraco (version 7.3.8). I can configure the Authorize.net payment provider variables on the admin dashboard and I can see that payment option when I check out when I have Bazaar:ResolvePaymentForms set to false in my web.config. But I do not see the confirm sale button when this is selected.

    From what I understand, there needs to be extra code added to handle this on the Bazaar site. Could you provide what is needed to make payments using Authorize.net on the Bazaar site or if you have a working example.

    Thanks

    Scott

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 03, 2016 @ 00:00
    Rusty Swayne
    0

    Hey Scott,

    I won't have time to write one up before uWestFest - sort of in transit at the moment. You can look at the Merchello-dev branch on Github. Our next version will ship with PayPal and Braintree providers included in the core. In the Bazaar solution, you will find a Braintree standard transaction view which is very similar to Authorize.Net (except you'll pass the actual credit card number, expires etc back in a model so they can be added to the ProcessorArgumentCollection)

Please Sign in or register to post replies

Write your reply to:

Draft