Have been looking through the documentation and I can't seem to find it. We are integrating Vendr with a 3 party fulfillment service. We know that we can defer payments when using the Stripe integration so that is great, but we would like to automate the process of processing the payment when we receive the fulfillment response (via a custom web hook) from the 3rd party.
Does anyone know where i could find any documentation for that if its possible, even general purpose docs would do.
This kind of depends what you mean by "processing the payment". Are you using the OOTB Stripe payment provider and you are "authorizing" the payment and you want to "capture" it in response to fulfilment updates? Or are you doing something custom with your payment processing?
If the later, can you share some code on how you are doing this?
we are at the planning stage at the moment of this, currently we are using the OOTB provider to authorize but not take the payment. Once we know the order is fulfilled we then want to capture the payment.
Essentially the process is:
Order is taken and payment authorized
Order details are sent to 3rd party fulfillment service
3rd party service will notify us (via a webhook) that the order is fulfilled
At that point we want to capture the payment automatically
Step 4 I believe is manual in the OOTB solution (please correct me if I am wrong) so we may have to attach some sort of Vendr event to achieve this if that is the case which is fine, but just wanted to make sure we are not re-inventing anything here.
Ok, cool, then in that case, this is the code you would need to "capture" the authorized payment from within your webhook
var order = _vendrApi.GetOrder(orderId);
var result = await _vendrApi.CaptureOrderPaymentAsync(order);
if (result.Success)
{
using (var uow = _vendrApi.Uow.Create())
{
var writableOrder = order.AsWritable(uow)
.ApplyPaymentChanges(result);
_vendrApi.SaveOrder(writableOrder);
uow.Complete();
}
}
Then it would suggest the payment provider failed to capture the payment.
You'll need to check the payment gateway to see if an attempt to capture was made and if there was any errors. Also, a capture can only take place on an Authorized payment status so is the payment in this state?
What does the payment method settings look like for your payment provider (Specifically the Features panel)? Have you allowed capturing payments?
For capture to succeed it needs the payment to be authorized, but the payment provider needs to be both capable of capturing and you need to have allowed the option of capturing in the payment method settings.
For capture to succeed it needs the payment to be authorized, but the payment provider needs to be both capable of capturing and you need to have allowed the option of capturing in the payment method settings.
Capture Payment on order completion
Hi Again,
Have been looking through the documentation and I can't seem to find it. We are integrating Vendr with a 3 party fulfillment service. We know that we can defer payments when using the Stripe integration so that is great, but we would like to automate the process of processing the payment when we receive the fulfillment response (via a custom web hook) from the 3rd party.
Does anyone know where i could find any documentation for that if its possible, even general purpose docs would do.
Thanks,
Rob
Hi Rob,
This kind of depends what you mean by "processing the payment". Are you using the OOTB Stripe payment provider and you are "authorizing" the payment and you want to "capture" it in response to fulfilment updates? Or are you doing something custom with your payment processing?
If the later, can you share some code on how you are doing this?
Matt
Hi Matt,
we are at the planning stage at the moment of this, currently we are using the OOTB provider to authorize but not take the payment. Once we know the order is fulfilled we then want to capture the payment.
Essentially the process is:
Step 4 I believe is manual in the OOTB solution (please correct me if I am wrong) so we may have to attach some sort of Vendr event to achieve this if that is the case which is fine, but just wanted to make sure we are not re-inventing anything here.
Does that make more sense?
Ok, cool, then in that case, this is the code you would need to "capture" the authorized payment from within your webhook
We have implemented the logic as suggested in our local IIS development site yet the following is always false.
This is the case whether we are using Stripe CLI or ngrok tunnel. Not entirely sure what else to check at this point.
Then it would suggest the payment provider failed to capture the payment.
You'll need to check the payment gateway to see if an attempt to capture was made and if there was any errors. Also, a capture can only take place on an
Authorized
payment status so is the payment in this state?Payment status is showing as
Authorized
on the Vendr orders dashboard and before the call toCaptureOrderPaymentAsync
when debugging.Checking the subsequent
PaymentResult
I am seeing the followingHi Sean,
What does the payment method settings look like for your payment provider (Specifically the Features panel)? Have you allowed capturing payments?
For capture to succeed it needs the payment to be authorized, but the payment provider needs to be both capable of capturing and you need to have allowed the option of capturing in the payment method settings.
Matt
Spot on. Appreciate your help with this.
is working on a reply...