Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
We're building a custom payment provider for the Mollie environment. When entering a valid payment everything goes well: the order gets finalized, the email is sent and we return to our desired URL.
However when I cancel a payment the order still gets finalized!
In the ProcessCallback I collect the paymentdata of Mollie and I get the correct status. Then I make a new callbackinfo passing the amount of the payment, the Id of the payment and a PaymentState.Cancelled:
if (paymentHelper.GetPayment(testMode, paymentid) is MolliePayment molliePayment)
LoggingService.Instance.Warn<Mollie>("Mollie(" + order.CartNumber + ") - Paymentstatus: " + molliePayment.GetPaymentState().ToString());
callbackInfo = new CallbackInfo(molliePayment.GetAmount(), paymentid, molliePayment.GetPaymentState());
From then on TeaCommerce takes over, so I cannot see what goes wrong.
Oooh, I've been hoping someone would create a Mollie provider, it looks like a nice platform. Would love to see your code once it's complete.
In terms of what you are seeing, this is expected behavior. Any response from ProcessCallback that returns a CallbackInfo object will finalize the order, even if it's payment status is canceled. If you don't want the order to be converted to a finalized order, then you should return null.
Hope this helps
Thanks, that works!
About the code: the paymentprovider is not yet complete since our customer will do actions like cancelling and refunding from the Mollie dashboard. But I will see what I can do...
At the moment I still make a step outside the paymentprovider: I need to pass an API-key as a Bearer in the header of the request. Of course I don't want that to be in the paymentform, so I lead the submit of the paymentform to an action where I can get the API-key from the config-file and add that to a request to Mollie.
Would it be possible to do that inside the paymentprovider?
Absolutely, payment providers support settings which can be defined by the provider and set on the settings tab of the payment method configuration.
Take a look at some of the other payment providers to see how they use them, for example https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.PayPal/PayPal.cs#L27
The key things really are the DefaultSettings which define a kind of blue print for your settings, the GetLocalizedSettingsKey method that handles returning friendly labels / description for them, and then within any processing methods, you can then access their values from the settings object that is passed into them.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted