This documentation is only for developers. If you are not a developer with good PHP coding skills then you have no need to read this.
It is very hard to troubleshoot another coder’s code. So if you use this documentation and do a custom integration yourself then please note that we cannot offer you any support in terms of what is wrong with your code. You will need to hire us to take a look at your code and correct any mistakes you made.
It is possible to integrate a 3rd party software with the WP PDF Stamper using the HTTP GET method. All you need to do is construct the GET values then add it to the URL of the API and execute it.
GET Values
WP PDF Stamper expects a certain set of variables to be sent to it via HTTP GET method. These variables are:
Mandatory Variables
- Secret Key: A Secret API key (you can find this value in the settings menu of this plugin)
- Source File URL: The URL of the source file that needs to be stamped (a copy of the source file will be stamped to keep the source file intact)
Optional Variables
- Customer Name: The name of the customer
- Customer Email: The email address of the customer
- Customer Address: The customer’s address
- Customer Phone: The customer’s phone number
Return Value
Upon successful processing, WP PDF Stamper will return a plain text message that will have two lines similar to the following:
Success!
http://examle.com/wp-content/plugins/wp-pdf-stamper/stamped-files/test-ebook_4c05fffce4de3.pdf
or
Error!
Secret key is invalid
- The first line is an indication of success or error
- The second line is the result. In the event of success, it will contain the URL of the stamped file (this is a copy of the source file but stamped with the appropriate information)
Sample Code Example
Construct the GET values
The following is an example of name/value pair that can be used in a HTTP GET Request (each name/value pair is separated by an “&” character):
secret_key=4bc671656782.45045137&source_file=http://www.example.com/wp-content/uploads/my-ebook.pdf&customer_name=jon doe&[email protected]&customer_address=123 Some Street, San Jose, CA - 95130, U.S.A
Creating the full URL
Once you have the GET name/value pair data ready you simply have to join it with the API/POST URL with a “?” character. The API/POST URL for your site can be found on the “Integration help” menu of the plugin. It will look similar to the following:
http://www.example.com/wp-content/plugins/wp-pdf-stamper/api/stamp_api.php
So the full URL should look similar to the following:
http://www.example.com/wp-content/plugins/wp-pdf-stamper/api/stamp_api.php?secret_key=4bc671656782.45045137&source_file=http://www.example.com/wp-content/uploads/my-ebook.pdf&customer_name=jon doe&[email protected]&customer_address=123 Some Street, San Jose, CA - 95130, U.S.A
You should be able to paste the recently created URL in the browser’s address bar and test how it works.