Skip to main content

Overview

All API requests to Waypay payment endpoints must include a valid signature for security verification. This guide explains how to generate signatures correctly.

Quick Reference

Signature Generation Algorithm

Step-by-Step Process

  1. Collect all request parameters (excluding ‘signature’)
  2. Remove null values, empty strings, objects, and arrays
  3. Convert all parameter keys to LOWERCASE
  4. Sort parameters alphabetically by lowercase key name (ASCII order)
  5. Build query string: key1=value1&key2=value2&...
  6. Append your secret key directly (no & prefix)
  7. Compute MD5 hash of the combined string
  8. Convert to lowercase hexadecimal

Visual Example

Value Formatting Rules

Critical: Format Values CorrectlyDifferent data types require specific formatting rules to ensure signature consistency.

Important Notes

All parameter keys must be converted to lowercase before sorting and building the query string:
  • orderReforderref
  • callbackUrlcallbackurl
  • paymentMethodpaymentmethod
This prevents signature mismatches due to casing differences.
  • Integers (int, long): Plain number → 100, 1000, 20
  • Decimals (decimal, double, float): Use .NET ToString() → 1000.50, 99.99
  • Enums: Convert to integer value → WalletProvider.JazzCash (2) → "2"
✅ Correct: true, false❌ Incorrect: True, FALSE, TRUE
  • Most objects (like customerRef): Excluded from signature calculation
  • Required parameter objects (like orderRef): Serialized to JSON string and included
  • Arrays: Always excluded from signature calculation
Example:
The format will vary based on culture settings.Recommendation: Use ISO 8601 strings for consistency across different systems.

Code Examples

Testing Your Implementation

Test Endpoint

Use our signature testing API to verify your implementation:
Request:
Response:

Verify Endpoint

Request:
Response (Success):
Response (Failure):

Common Mistakes & Troubleshooting

Common Errors

Debugging Checklist

1

Is your signature 32 characters?

MD5 produces 32 hex characters. If shorter/longer, check your hash function.
2

Is your signature lowercase?

Must be abcdef123456... not ABCDEF123456...
3

Are all parameter keys converted to lowercase?

  • orderReforderref
  • callbackUrlcallbackurl
  • Amountamount
4

Are parameters sorted correctly?

Alphabetical (ASCII) order on lowercase keys. All keys must be lowercase before sorting.
5

Are numbers formatted correctly?

  • Integers: Plain number → 1000, 20, 5
  • Decimals: Use ToString() → 1000.50, 99.99
  • Enums: Integer value → 2, 5
6

Are you skipping objects and arrays?

  • customerRef: { name: "..." } → SKIP
  • orderRef: { orderRef: "..." } → INCLUDE (serialize to JSON string)
  • items: [...] → SKIP
7

Is the secret key appended correctly?

NO & before secret key. Directly append: ...orderId=123mer_sk_xxx

API Request Example

Complete Payment Request

Signature Calculation:

Security Best Practices

Protect Your Secret Key

Never expose your secret key in client-side code or commit it to version control.
Don’t include in JavaScript, mobile apps, or browser code. Generate signatures on your server only.
  • Use environment variables
  • Use secret management services (Azure Key Vault, AWS Secrets Manager)
  • Never commit to version control
Contact support to regenerate your secret key and update all integrations with the new key.
All API calls must use HTTPS. Never send signatures over HTTP.

Secret Key Format

Getting Help

Test Your Implementation

  1. Use /api/v1/signature/example to see a complete example
  2. Use /api/v1/signature/generate to generate signatures for testing
  3. Use /api/v1/signature/verify to debug signature mismatches

Contact Support

If you continue to have issues:
  • Email: support@waypay.com
  • Include: Your merchant ID, request payload (without signature), and the signature you generated

Migration from v1.1 to v2.0

Breaking Changes in v2.0If you have existing integrations, you must update your signature generation code.

Breaking Changes

Old: orderRef, callbackUrl, paymentMethodNew: orderref, callbackurl, paymentmethod
Old: 1000"1000.00"New: 1000"1000"
New: Enums are converted to integer valuesExample: WalletProvider.JazzCash (value: 2) → "2"
Old: ISO 8601 format "2024-01-15T10:30:00"New: .NET default ToString() (culture-dependent)

Migration Steps

1

Update your signature generation code

Convert all parameter keys to lowercase before sorting and building the query string.
2

Remove forced 2-decimal formatting for integers

Use plain numbers for integer values (e.g., 1000 instead of 1000.00).
3

Test your signatures

Use the /api/v1/signature/generate endpoint to verify your implementation.
4

Verify before deploying

Use /api/v1/signature/verify to validate signatures before deploying to production.

Changelog


Document Version: 2.0
Last Updated: 2026-01-26
API Version: v1