We have a requirement where we want to setup 2 payment methods. Currently the store has credit card payment via Stripe and that is all fine. Now the customer wants to introduce invoice payments but only for a specific customer type, and all other customers would still use the existing checkout.
We want to make that seamless, so essentially when logged in the customer will automatically be redirected to the correct payment screen. Is there a built in way to do this? if not, is there anywhere i should look first to custom build it?
There isn't anything specific built in, other than a single default payment method settings on the country settings.
I guess in it's simplest form though from a custom code perspective, when someone logs in you could set the session managers default payment method and any open orders payment methods to invoice, and when they log out, perform the opposite.
var store = VendrApi.Instance.GetStore("myStore");
var invoicePaymentMethod = VendrApi.Instance.GetPaymentMethod(store.id, "Invoicing");
VendrApi.Instance.SetDefaultPaymentMethod(invoicePaymentMethod.Id);
var currentOrder = VendrApi.Instance.GetCurrentOrder(store.Id);
if (currentOrder != null) {
using(var uow = VendrApi.Instance.Uow.Create()) {
var writableOrder = currentOrder.AsWritable(uow)
.SetPaymentMethod(invoicePaymentMethod.Id);
VendrApi.Instance.SaveOrder(writableOrder);
uow.Complete();
}
}
Show payment type based on type of customer
Hi There,
We have a requirement where we want to setup 2 payment methods. Currently the store has credit card payment via Stripe and that is all fine. Now the customer wants to introduce invoice payments but only for a specific customer type, and all other customers would still use the existing checkout.
We want to make that seamless, so essentially when logged in the customer will automatically be redirected to the correct payment screen. Is there a built in way to do this? if not, is there anywhere i should look first to custom build it?
Thanks!
Hi Roberto
There isn't anything specific built in, other than a single default payment method settings on the country settings.
I guess in it's simplest form though from a custom code perspective, when someone logs in you could set the session managers default payment method and any open orders payment methods to invoice, and when they log out, perform the opposite.
is working on a reply...