Skip to main content

v3 Signature

v3 joins a fixed set of fields together with | and hashes the result. Which fields to use, and where to read them from, depends on which surface you're validating. For the reusable HMAC-SHA256 function in Java, C#, PHP, and Python, see Validating Payment Response with Signature.

Attributes for Creating the Signature - Transaction

The following attributes will be required to generate the signature on your server

AttributeDescription
signature_versionUse the signature_version in the transaction object returned by Nimbbl for the payment in the response
invoice_idUse the invoice_id of the order that is generated on your server, returned by Nimbbl in the response
transaction_idUse the transaction_id in the transaction object returned by Nimbbl for the payment in the response
access_secretThe access_secret is generated from the Command Center. Available on your server
transaction_amountUse the transaction_amount in the transaction object returned by Nimbbl in the response. Always use the transaction_amount with 2 decimal places.
transaction_currencyUse the transaction_currency in the transaction object returned by Nimbbl in the response
statusUse the status in the transaction object returned by Nimbbl in the response
transaction_typeUse the transaction_type in the transaction object returned by Nimbbl in the response
Transaction Amount Handling for Signature

Some JSON libraries convert the whole float numbers to integers (3.0 may be converted to 3). Hence, we recommend to always convert the transaction_amount field into float with 2 decimal places. However, if the transaction_amount has more than 2 decimal places, trim the transaction_amount to 2 decimal places.

For example

  1. If the transaction_amount is 3, use the transaction_amount value as 3.00 for signature creation.
  2. If the transaction_amount is 3.1, use the transaction_amount value as 3.10 for signature creation.
  3. If the transaction_amount is 3.12, use the transaction_amount value as 3.12 for signature creation.
  4. If the transaction_amount is 3.129, use the transaction_amount value as 3.12 for signature creation.

The following attributes will be required to generate the payment link signature on your server

AttributeDescription
signature_versionUse the signature_version returned by Nimbbl in the webhook/callback response
invoice_idUse the invoice_id of the payment link returned by Nimbbl in the response
payment_link_statusUse the payment link status returned by Nimbbl in the response
payment_link_currencyUse the payment link currency returned by Nimbbl in the response
payment_link_total_amountUse the payment link total_amount returned by Nimbbl in the response. Always use the amount with 2 decimal places.
payment_link_hashUse the payment_link_hash returned by Nimbbl in the response
access_secretThe access_secret is generated from the Command Center. Available on your server

This covers the server-side result delivered to your callback_url. For the full payload shapes, see Payment Callback.

Compare against transaction.signature (the same value also appears at the top level as nimbbl_signature). Take invoice_id from order.invoice_id; take the other five fields from transaction:

generated_signature = hmac_sha256(order.invoice_id + "|" + transaction.transaction_id + "|" + transaction.transaction_amount + "|" + transaction.transaction_currency + "|" + transaction.status + "|" + transaction.transaction_type, <your_access_secret>);

if (generated_signature == transaction.signature) {
payment is successful
}