Skip to main content

Signature Authorization

smilepayz teamsAbout 1 min

The following steps are used for Transactional which include Payin, Payout and Inquiry which include inquiry stats and inquiry balance:

1. Prepare signature data

The data are: timestamp, merchant secret, minify request body, merchant private key.
signature parameter

2. Minify the request body

The following are the example value before and after minify the request body:

Before Minify Json:

{
    "additionalParam": {},
    "area": 10,
    "callbackUrl": "https://docs.smilepayz.com/en/",
    "merchant": {
        "merchantId": "20019"
    },
    "money": {
        "amount": 10000,
        "currency": "IDR"
    },
    "orderNo": "20019c5b63c4b-e34a-4855-9b20-d4b",
    "paymentMethod": "QRIS",
    "purpose": "Purpose For Transaction from Java SDK"
}

After Minify Json:

{"paymentMethod":"QRIS","orderNo":"20019c5b63c4b-e34a-4855-9b20-d4b","purpose":"Purpose For Transaction from Java SDK","additionalParam":{},"money":{"currency":"IDR","amount":10000},"merchant":{"merchantId":"20019"},"callbackUrl":"https://docs.smilepayz.com/en/","area":10}

3. Compose the string to sign

X-TIMESTAMP + "|" + merchant_secret + "|"  + minify(requestBody)`

The following is the example:

2024-12-30T18:30:36Z|95b57c46b8c2e068982be23fb669a80612cad68e6ce6ba4f5af9ec20d23bb274|{"paymentMethod":"QRIS","orderNo":"20019c5b63c4b-e34a-4855-9b20-d4b","purpose":"Purpose For Transaction from Java SDK","additionalParam":{},"money":{"currency":"IDR","amount":10000},"merchant":{"merchantId":"20019"},"callbackUrl":"https://docs.smilepayz.com/en/","area":10}

4. Generated signature

The signature string is generated from string to sign above with applying hmacSHA512 encryption using merchantSecret , and then encode the result to base64.

Formula:
hmacSHA512(stringToSign, merchantSecret)

The example merchantSecret value:

95b57c46b8c2e068982be23fb669a80612cad68e6ce6ba4f5af9ec20d23bb274

The following is the result example value:

RvWeMDztovywfyarzFEUUDUo6F5f0weT+X2FTfjJ/KVxyDJJ4PHddsqHx0h98/ZOofCaADx8MaoG1rTaHd+5BkJPPlwrwG62oZygjNOV2gJ0rstTBWZOQgORkTjvBj91KQgzWRpT6yLJaeRaJRS2YfRPGA5MH7ieGWkocPXNRw+v0HolPMren+y69sZmVVXeRs9SXV9QpCZP8zNHPEQt75zgVKSr5/GmkfTCgFPNz/+23MpVMigwpOcifxEDwN+KzfdnQxjYi6n01qztb1skXOTlIRrhDkJSRhOzrDHQEwnp/6XEjyZaOV/XXSJtMsr85Yl97cF0daW1ALkuF7NHew==

5. Put the signature string into HTTP header

The following is the result example value:

X-SIGNATURE: RvWeMDztovywfyarzFEUUDUo6F5f0weT+X2FTfjJ/KVxyDJJ4PHddsqHx0h98/ZOofCaADx8MaoG1rTaHd+5BkJPPlwrwG62oZygjNOV2gJ0rstTBWZOQgORkTjvBj91KQgzWRpT6yLJaeRaJRS2YfRPGA5MH7ieGWkocPXNRw+v0HolPMren+y69sZmVVXeRs9SXV9QpCZP8zNHPEQt75zgVKSr5/GmkfTCgFPNz/+23MpVMigwpOcifxEDwN+KzfdnQxjYi6n01qztb1skXOTlIRrhDkJSRhOzrDHQEwnp/6XEjyZaOV/XXSJtMsr85Yl97cF0daW1ALkuF7NHew==

Tools

The following are the example tools which used to process the signature:

NoNameURLStep
1JSON Minifyhttps://jsonformatter.org/json-minifyopen in new windowSelect “Minify JSON”

Merchant Public Key

MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXfGWrq5PwNFgdV+wq1vkqrFTOL9mTBk3alhEDgCkMmPw2RJoEpu8IVDC2H6nisc8wHd5WR774sjv1fx7dovGsbYgObcg2uPOSIAcvozvVB8cyPvQkcZyGOY4wwKgIBL0WtB2RH2ByxpR9yEOANmu4PFpt8qp9qayK4GNtZzuPt9xrgUdKgqRsbYdJFe/0UnYVr9xX9c5G+8lGJ/c37moPbLS39Z8PlIu4Y1y/sRojUWLAwhzi8ysp2cZNXAX6sj2OWDEyI0IpOHCPmHzOATDfG5kwdct8/bHX2x1UyPzw/32w873yu0v1yb2Nm49U8DXmAh3HeQ8ejGIjtdq3wOVwIDAQAB

Merchant Private Key

MIIEvQIBADANBgkqhkiG9w0BAQEFAASC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