Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let payment gateways prefer webhook URLs without query parameters #1530

Closed
Mosnar opened this issue Jun 22, 2020 · 1 comment
Closed

Let payment gateways prefer webhook URLs without query parameters #1530

Mosnar opened this issue Jun 22, 2020 · 1 comment
Labels

Comments

@Mosnar
Copy link
Contributor

Mosnar commented Jun 22, 2020

What are you trying to do?
I built a payment gateway for Authorize.Net when Commerce 2 first came out. I want to add webhook support now; however, for some ridiculous reason, I am not allowed to enter a webhook URL into Authorize.Net with query parameters.

What's your proposed solution?
It would be nice if I could set a property to tell Craft to use a routed webhook URL instead (displaying the appropriate URL in the gateway UI).
The current URL looks like this:
mysite.com/index.php?p=actions/commerce/webhooks/process-webhook&gateway=3

Perhaps an alternative could be:
mysite.com/commerce/webhooks/gateway-handle/process-webhook

image

@Mosnar Mosnar added New 💡 enhancement Ideas and suggestions labels Jun 22, 2020
@lukeholder
Copy link
Member

We just added support for a non parameterised URL to process webhooks for the next release of Commerce.

In your gateway class you need to override the base gateway getWebhookUrl() to return a URL in this format:

http://craft-commerce3.test/commerce/webhooks/process-webhook/gateway/4 -
With the 4 being replaced by the current Gateway ID.

You would do something like this in your method:

UrlHelper::baseSiteUrl('commerce/webhooks/process-webhook/gateway/'.$this->id);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants