Integrating API in to WordPress

this line IS your php inlcude path:

require_once(dirname(__FILE__) . 'path_to ChargeBee.php');

you need to change it to something specific to your coding. ie: are you putting this into a theme or a plugin? ( would suggest a plugin)

If that were the case you would use something like this:

require_once( CHARGEBEEPLUGIN_DIR . ‘/lib/chargebee.php’ );

this would include the file that it finds at wp-content/plugins/chargebeeapi/lib/chargebee.php

the chargbee.php is what you’re getting from github.

Do you have experience with api’s though? It’s not as simple as just putting the github folder on your system and you’re off to the races unfortunately.

The link you referenced is the library to for the chargbee api. You now need to create your side of the tool to utilize the library. I suggested a plugin as that is how I do it. You’re not going to just put it in the plugin folder though: you need to create a folder within the plugin directory with your new plugin folders.

for instance:
In the wp-content/plugins folder you create a new folder, “chargebeeapi”

then in that folder you add your library (the lib folder you downloaded from gitub)

wp-content/plugins/chargebeeapi/lib

now in the chargbeeapi folder you create your main plugin php file that will reference the library by using the above include path.

In this php file you’ll need to create form and submission button (this will vary depending upon how you need to interact with chargbee.) As well as a response container to get the response back after your request/push to their system. Lastly you’ll need to tell wordpress this is a plugin and identify where the form / interaction will occur in wordpress.

tech