PGPrints API Documentation
  • 😎Welcome to PGPrints API
  • πŸ”Authentication
  • Reference
    • βš™οΈAPI Reference
      • πŸ‡ΈπŸ‡¨Create Order
      • πŸ‡ΈπŸ‡¨Create Order Label
      • 🧁Update Order
      • 🧁Update Order Label
      • 🧁Cancel Order
      • πŸ“–Search Order
      • πŸ“–Search Product Tiktok
      • πŸ“–Search Product Normal
Powered by GitBook
On this page
  • Generator Secret Key:
  • Generator X-PGPrints-Hmac-Sha256:

Authentication

PreviousWelcome to PGPrints APINextAPI Reference

Last updated 11 months ago

Authorization is an important step to using Open API. To be able to authenticate the store, you must generate a X-PGPrints-Hmac-Sha256. first of all you must have Secret Key.

Generator Secret Key:

Back in the Key Management section in the app, click the Generate Key button to get the secret key and copy the key

Generate Key

Generator X-PGPrints-Hmac-Sha256:

Make X-PGPrints-Hmac-Sha256 very simple by following steps:

  1. Converts body value to a JSON string

  2. Use the newly obtained secret key to make the key code

  3. Use Json String body to the plain text

  4. Use Sha256 to algorithm

  5. Generator X-PGPrints-Hmac-Sha256

This is my code in some language:

const crypto = require('crypto');
const generatePGPrintHmac = (content) => {
    const { body, secretKey } = content;
    // your body and your secrect key
    const sign = crypto
        .createHmac("sha256", secretKey )
        .update(JSON.stringify(body))
        .digest("hex");
    return sign;
}

  1. Open the website, press the F12 key and then select the Console section to convert body value to a JSON string:

  1. Copy the above JSON into the Enter Plain Text to Compute Hash field of the website:

  1. Enter the secret key generated above in the Enter the Secret Key field:

  1. Select Cryptographic Hash Function: SHA-256, Output Text Format: Base 64 and click the Computer Hash button to get the Hash for the API:

Other: Use the website to generator Sha256:

πŸ”
https://www.devglan.com/online-tools/hmac-sha256-online
Generate JSON
Enter JSON in the Enter Plain Text to Compute Hash box
Enter the secret key in the Enter the Secret Key field
Generator X-PGPrints-Hmac-Sha256