Copied to clipboard

Flag this post as spam?

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


  • Paw Gilkrog 4 posts 86 karma points
    Sep 22, 2022 @ 13:05
    Paw Gilkrog
    0

    Vendr SetPaymentMethod with SetPaymentCountryRegion fails.

    Hi

    When i use SetPaymentMethod(new Guid("some guid")) and SetPaymentCountryRegion(model.BillingAddress.Country, null) on an order, i get en error: "InvalidOperationException: Cannot generate a payment form for order fb61acec-f8e8-41a7-a619-0183652185e5 as it has no associated payment method".

    SetPaymentMethod works fine on its own, but when i add SetPaymentCountryRegion, it can no longer add the payment method. Even when the payment method is set to default on the chosen country, and the payment method is set to available to all countries. It changes the country on the order, but fails to add payment method.

    Any help is appreciated.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 23, 2022 @ 15:34
    Matt Brailsford
    0

    Are you using any add in packages like Vendr Checkout?

  • Paw Gilkrog 4 posts 86 karma points
    Sep 26, 2022 @ 12:17
    Paw Gilkrog
    0

    Hi Matt

    I tried both installing and uninstalling Vendr Checkout and still the same error.

    I got it working by doing the following:

    order.SetPaymentCountryRegion(model.BillingAddress.Country, null);

    _vendrApi.SaveOrder(order);

    order.SetPaymentMethod(new Guid(""));

    _vendrApi.SaveOrder(order);

    uow.Complete();

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 26, 2022 @ 14:16
    Matt Brailsford
    0

    Hey Paw,

    This is why I was asking bout Vendr Checkout as I know this does have default logic to clear the payment method when you change the payment country region as it's designed to work over a multi-screen checkout flow so what you are trying to do it have it run in one save.

    Uninstalling Vendr Checkout should make it work.

Please Sign in or register to post replies

Write your reply to:

Draft