Software License Keys

Selling license keys is very easy using Payhip.

You simply setup a digital product as usual, then scroll down to the advanced options section. Finally check the "Generate unique license keys for each sale" checkbox.

License key enforcement is completely up to you. As the seller, you can decide how many uses each key gets. We have two simple API calls for you to achieve this.

License Key Verification

To verify a license key in your application simply call the verify API method.

Example Request

curl "https://payhip.com/api/v1/license/verify?product_link=mVT0&license_key=WTKP4-66NL5-HMKQW-GFSCZ" -X GET --header "payhip-api-key: YOUR_API_KEY_HERE"

Example Response

{
 "data": {
 "enabled": true,
 "product_link": "mVT0",
 "license_key": "WTKP4-66NL5-HMKQW-GFSCZ",
 "buyer_email": "contact@payhip.com",
 "uses": 0,
 "date": "2018-02-22T11:23:05+00:00"
 }
}

If verification fails, you will receive an empty response.

Enable or Disable a License Key

To enable a license key you can use the endpoint "license/enable" or to disable, use the endpoint "license/disable". You might want to disable a license key if a customer breaks your terms of service for example. We automatically disable the license key if the transaction has been refunded.

Example Request

curl https://payhip.com/api/v1/license/disable -d "product_link=mVT0" -d "license_key=WTKP4-66NL5-HMKQW-GFSCZ" -X PUT --header "payhip-api-key: YOUR_API_KEY_HERE"

Example Response

{
 "data": {
 "enabled": false,
 "product_link": "mVT0",
 "license_key": "WTKP4-66NL5-HMKQW-GFSCZ",
 "buyer_email": "contact@payhip.com",
 "uses": 1,
 "date": "2018-02-22T11:23:05+00:00"
 }
}

License Key Usage

To increase the license keys usage, simply call the usage endpoint

Example Increase License Request

curl https://payhip.com/api/v1/license/usage -d "product_link=mVT0" -d "license_key=WTKP4-66NL5-HMKQW-GFSCZ" -X PUT --header "payhip-api-key: YOUR_API_KEY_HERE"

Example Increase License Response

{
 "data": {
 "enabled": true,
 "product_link": "mVT0",
 "license_key": "WTKP4-66NL5-HMKQW-GFSCZ",
 "buyer_email": "contact@payhip.com",
 "uses": 1,
 "date": "2018-02-22T11:23:05+00:00"
 }
}

To decrease the license keys usage, simply call the usage endpoint

Example Decrease License Request

curl https://payhip.com/api/v1/license/decrease -d "product_link=mVT0" -d "license_key=WTKP4-66NL5-HMKQW-GFSCZ" -X PUT --header "payhip-api-key: YOUR_API_KEY_HERE"

Example Decrease License Response

{  
 "data": {  
 "enabled": true,  
 "product_link": "mVT0",  
 "license_key": "WTKP4-66NL5-HMKQW-GFSCZ",  
 "buyer_email": "contact@payhip.com",  
 "uses": 0,  
 "date": "2018-02-22T11:23:05+00:00"  
 } 
}

If usage update fails, you will receive an empty response.

Key note

To find your API key, visit your "Settings" page and click on the "Developer" tab. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.