Jump to content
  • 0
Sign in to follow this  
lamjed001

Add route for provisioning module

Question

Hello,

I need to know how to add route for provisioning module

Add route already exists in WHMCS it's already used in Stripe Gateway https://domain.com/stripe/payment/intent or https://domain.com/index.php?rp=/stripe/payment/intent

Is there any ready-made code that does the same job?

Thanks

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

In WHMCS, you can add a custom route for a provisioning module by modifying the module's configuration file. The configuration file is a PHP script that is located in the modules/servers/ directory in your WHMCS installation.

To add a route for a provisioning module, you will need to specify a $_ADDONLANG['route'] variable in the module's configuration file. This variable should contain an array of route definitions, where each definition consists of a key-value pair. The key represents the name of the route, and the value represents the route pattern.

Here's an example of how you can define a route in a provisioning module's configuration file:

$_ADDONLANG['route'] = array(
  'payment/intent' => '/stripe/payment/intent',
);


This route definition would allow you to access the route at https://domain.com/index.php?rp=/stripe/payment/intent.

In addition to defining the route, you will also need to implement the code that handles the request when the route is accessed. This can be done by creating a function in the module's PHP code and registering it as a hook.

For example:

function stripe_payment_intent($vars) {
  // your code here
}
add_hook('ModuleRoutes', 1, 'stripe_payment_intent');


The stripe_payment_intent function will be called whenever the route /stripe/payment/intent is accessed, and it will receive an array of variables as its argument. You can use these variables to perform any necessary actions or operations in response to the request.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated