💸Setting up the tebex api

To begin with the integration of Tebex payments, you will need to have an account. Remember, using Discord is more advisable for the software. Once you have your Tebex services, look for and enter 'Integrations' > 'API Keys'.


You will need to have a 'Public Token' which you should copy and paste into.

define('TEBEX_PUBLIC_KEY', 'PUT_PUBLIC_TOKEN');

Once you've pasted the public token, enable the option for tebex_payment, which will enable purchases in your software and allow the Tebex API-related tabs like 'basket and product' to be enabled and function correctly. In case it's enabled and the public token doesn't work, it will cause issues in the software. Before making it public, verify that it works.

define('TEBEX_PAYMENT', true);

What is 'TEBEX_PAYMENT_RETURN' and how does it work or what functions does it contain? This function simply returns the user to a designated site, in this case, your site, once they complete the purchase. It specifically returns them to the completed purchase section where they will be congratulated for the purchase. Also, if it is disabled, the user can return by clicking on a button called 'Return to Site', which will take them to the designated URL. You can decide whether to enable it ('true') or simply disable it ('false').

define('TEBEX_PAYMENT_RETURN', true);

Let's proceed to have Tebex send responses upon completing a purchase. To do this, we'll utilize the webhook feature offered by Tebex.

First, let's locate:

Now, simply click on 'Setup webhooks'

Copy the secret key and navigate to your config.php file. Search for:

define('TEBEX_WEBHOOK_SECRET', 'PUT_YOUR_SECRET');

And paste the secret into 'PUT_YOUR_SECRET'

Now, return to Tebex and click on the 'Add EndPoint' button. In the endpoint URL, simply place our site URL and append '/parent/tebex/webhook.php'

Example:

https://your-site.com/parent/tebex/webhook.php

Click on the 'Payment Completed' checkbox and then the 'Add' button.


Are you having trouble?

  • Is it indicating that you need to validate?

For example:

The problems can be several:

  1. The secret key in config.php is incorrect. (Verify it correctly.)

  2. The endpoint URL was not found.

  3. Your website is blocking external requests.

Have you addressed all three options? Click on validate, and if everything is correct, you simply won't see anything other than 'Edit, Delete' buttons.


Done.

Regards, Vuhp 📀

Last updated