Copied to clipboard

Flag this post as spam?

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


  • Paul Wright (suedeapple) 264 posts 666 karma points
    Aug 19, 2015 @ 12:42
    Paul Wright (suedeapple)
    0

    Programmatically Refund Order Amount

    I'm using Sage Pay Gateway.

    Is it possible to programmatically carry out an Order Refund, without having to log into the TeaCommerce backoffice.

    I'm hoping I can just pass a transaction ID to a TC refund method.

  • Paul Wright (suedeapple) 264 posts 666 karma points
    Aug 19, 2015 @ 13:00
    Paul Wright (suedeapple)
    0

    Im guessing something like this might just do it.....

       var order = TC.GetOrder(1, new Guid("f58bb604-db18-43eb-8222-d014b3be94e9"));
    
       var gateway = new TeaCommerce.PaymentProviders.Classic.SagePay();
    
       if (gateway.SupportsRefundOfPayment)
       {
           gateway.RefundPayment(order, gateway.DefaultSettings);
       }
    
  • Anders Burla Johansen 2560 posts 8256 karma points
    Aug 20, 2015 @ 06:25
    Anders Burla Johansen
    100

    You should use the PaymentMethodService.Instance.Get to get the payment method. Then has a using TeaCommerce.Api.Web.PaymentProviders and then you can do paymentMethod.RefundPayment( order );

    Kind regards

    Anders

  • Paul Wright (suedeapple) 264 posts 666 karma points
    Aug 26, 2015 @ 08:20
    Paul Wright (suedeapple)
    0

    Woo! worked - thanks Anders

  • 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