Skip to main content

Balance Information

Overview

This service is used to manage and display Paydia Bisnis and Paydia app's balance via merchant. For detail information will be describe in the next part.

Paydia's API spec will contain 1 main endpoints which is:

NoAPI NameDescription
1Balance InquiryThis API is used to query Paydia Bisnis and Paydia app's balance via merchant

Signature Generation and Validation

The below will explain about signature generation & validation.

Symmetric with B2B Access Token (HMAC_SHA512)

The following steps will explain about Symmetric with B2B Access Token (HMAC_SHA512).

Digital Signature Generation

Apply Token B2B Signature
  1. Compose the string to sign:
  2. X-CLIENT-KEY + "|" + X-TIMESTAMP
  3. The signature string is generated from string to sign above with applying SHA-256 with RSA-2048 encryption using pkcs8 private key, and then encode the result to base64.
  4. Put the signature string into HTTP header “X-SIGNATURE“ when call API for applying B2B access token.
Transaction Signature
  1. Compose the string to sign:
  2. HTTP METHOD + ”:” + RELATIVE PATH URL + “:“ + B2B ACCESS TOKEN + “:“ + LowerCase(HexEncode(SHA-256(Minify(HTTP BODY)))) + “:“ + X-TIMESTAMP
  3. The signature string is generated from string to sign above with applying HMAC_SHA512 hashing using secret key which given by Paydia, and then encode the result to base64.
  4. Put the signature string into HTTP header “X-SIGNATURE“ when call Paydia's API.

Digital Signature Validation

Apply Token B2B Signature

The below are steps of digital signature generation:

  1. Take the signature from HTTP header “X-SIGNATURE“.
  2. Decrypt the signature using public key which is pair with private key that used to generate the signature.
  3. Verify the correctness of the signature based on SHA-256 with RSA-2048 encryption signing against the string to sign.
  4. If the verification is correct, then consume the message.
Transaction Signature
  1. Compose the string to sign:
  2. HTTP METHOD + ”:” + RELATIVE PATH URL + “:“ + B2B ACCESS TOKEN + “:“ + LowerCase(HexEncode(SHA-256(Minify(HTTP BODY)))) + “:“ + X-TIMESTAMP
  3. Generate the signature from string to sign above with applying HMAC_SHA512 hashing using secret key which given by Paydia, and then encode the result to base64.
  4. Take the signature from HTTP header “X-SIGNATURE“.
  5. Compare the value between X-SIGNATURE and the generated signature, if those value are the same, then consume the message.

Asymmetric without Access Token (SHA256withRSA)

The following steps will explain about Asymmetric without Access Token (SHA256withRSA).

Asymmetric Key Generation

The below will explain about asymmetric key generation:

  • Create Private Key
  • openssl genrsa -out rsa_private_key.pem 2048
  • Export Public Key
  • openssl rsa -in rsa_private_key.pem -out rsa_public_key.pem -pubout
  • Private Key to PKCS#8 Encode
  • openssl pkcs8 -topk8 -in rsa_private_key.pem -out pkcs8_rsa_private_key.pem -nocrypt

Partner should generate the signature with pkcs8_rsa_private_key.pem and Paydia will use rsa_public_key.pem to validate the signature and vice versa.

Digital Signature Generation

The below are steps of digital signature generation:

  1. Compose the string to sign:
    • Apply token:
    • X-CLIENT-KEY + "|" + X-TIMESTAMP
    • Transactional:
    • HTTP METHOD + ”:” + RELATIVE PATH URL + “:“ + LowerCase(HexEncode(SHA-256(Minify(HTTP BODY)))) + “:“ + X-TIMESTAMP
  2. The signature string is generated from string to sign above with applying SHA-256 with RSA-2048 encryption using pkcs8 private key, and then encode the result to base64.
  3. Put the signature string into HTTP header “X-SIGNATURE“.

example:

X-SIGNATURE: k0DJhMxlfb6ILcDVXvaDr1i00RK4oH5OdPtBFaCpe86CcWaI85rUi6iFOEHXDT2/Gg5QALLOPzqgOnw8XaH8ZXzC0mSRz0D9SkMi0CEAeDFVVHwPuDX9/s35NGgbQJQ0uAPDKKgBC1IAJ1pE7P4+E4jyPbEH8tC1Hm7IhTf+klDgDOmBEM1VCCGhf1MWb8O6MF09osImYkiR+NWvaZu6AnQ26wOf7BtvnICcCGhrbVLm4RfPNgFhWpVqpZMlWo4p/EvsW5xGBuXZvEnNzsFKOBa+88uqXjizl7BfDLLh7DWuqOwXjgtBdGFQ2C1R4b9YcymRoudb1O9L0ZQEbJbNNQ==

Digital Signature Validation

The below are steps of digital signature validation:

  1. Take the signature from HTTP header “X-SIGNATURE“.
  2. Decrypt the signature using public key which is pair with private key that used to generate the signature.
  3. Verify the correctness of the signature based on SHA-256 with RSA-2048 encryption signing against the string to sign.
  4. If the verification is correct, then consume the message.

Document Version

The following table is used to show versioning of this document:

NoDateVersionRemarksPage
1May 10, 20231.2.2
  • Removed B2B ACCESS TOKEN in Digital Signature Generation
2Apr 26, 20231.1.1
  • Updated the detail of the service and API
  • Removed General Response Code section
3Nov 4, 20221.1.0Initial ReleaseEverything related to PayConnect