Skip to content
logo
  • Products
    • Amwal Checkout
    • Merchant App
    • Merchant Control Panel
  • Pricing
  • Developers
  • About us
  • Contact Us
Edit Content
  • Products
    • Amwal Checkout
    • Merchant App
    • Merchant Control Panel
  • Pricing
  • Developers
  • About us
  • Contact Us
Login
Get Started
Login
Get Started
BA Booking

BA Booking

2
  • BA Booking overview
  • BA Booking Installation
amwalpay woocommerce

Woocommerce

2
  • Overview
  • Woocommerce Installation
CS-Cart

CS Cart

2
  • CS-Cart Overview
  • CS CART Installation
Shopify

Shopify

2
  • Shopify Overview
  • Shopify Installation
odoo

Odoo

2
  • Odoo Overview
  • Odoo Installation
whmcs

WHMCS

2
  • WHMCS Overview
  • WHMCS Installation
Magento

Magento

2
  • Magento 2 Overview
  • Magento Installation
Opencart

Opencart

2
  • OpenCart Overview
  • Opencart Installtion
ZenCart

ZenCart

2
  • ZenCart Overview
  • Zencart Installation
Drupal

Drupal

2
  • Drupal Overview
  • Drupal Installation
PrestaShop

PrestaShop

2
  • PrestaShop Overview
  • PrestaShop Installation
Contact Form 7

Contact Form 7

2
  • Contact Form 7 Overview
  • Contact Form 7 Installation
Joomla

Joomla

2
  • Joomla Overview
  • Joomla Installation
AMWAL INTEGRATED PAYMENT LINK

Integrated Payment Link

1
  • Implementation
Android SDk

Native Android SDK

2
  • Pre Requisites
  • Implementation
ios SDk

Native iOS SDK

3
  • Apple Pay Specific Configuration
  • Pre Requisites
  • Implementation
React SDk

React Native SDK

1
  • Implementation

Laravel Package

2
  • Installation
  • Configuration

Flutter SDK

2
  • Implementation
  • Flutter SDK Overview

SMARTBOX

4
  • Express ApplePay Implementation
  • Offsite Implementation
  • Pre Requisites
  • Implementation

Merchant Cloud Notification

1
  • Merchant Cloud Notification Integration Guide

Secure Hash Calculation

1
  • Secure Hash Calculation

Wp Travel Engine

1
  • Installation

Webhooks

11
  • Get Transaction by Merchant Reference
  • Acquiring Session Token
  • Initialize Payment
  • Encryption and Decryption
  • Refund Payment
  • Void Payment
  • Get Transaction by ID
  • Transactions with Statistics
  • Transactions Summary
  • Delete Customer Token
  • Pay by Token
View Categories
  • Home
  • Amwal Pay Developer Portal
  • Webhooks
  • Initialize Payment

Initialize Payment

Create a payment session and generate a Smart Payment Link for your customer.


Endpoint #

Method: POST
Path: /MerchantOrder/InitializePayment

Environments #

EnvironmentBase URL
UAThttps://test.amwalpg.com:14443
Productionhttps://webhook.amwalpg.com

Full Endpoint URLs #

UAT

https://test.amwalpg.com:14443/MerchantOrder/InitializePayment

Production

https://webhook.amwalpg.com/MerchantOrder/InitializePayment


Overview #

The Initialize Payment API creates a new payment session for the merchant and returns a Smart Payment Link.

The merchant should:

  1. Prepare the payment request.
  2. Generate the secureHashValue.
  3. Send the request to the Initialize Payment endpoint.
  4. Receive the SmartBox payment URL.
  5. Redirect the customer to the returned URL.
  6. Track the payment result using the merchant reference and configured notifications/reconciliation mechanisms.

A successful Initialize Payment response only confirms that the payment URL was created. It does not mean that the customer has completed the payment.


Authentication & Credentials #

The following credentials and permissions are required.

ItemDescription
merchantIdAmwal merchant identifier
terminalIdE-commerce/digital terminal linked to the merchant
Merchant Secure Hash KeySecret key used to generate secureHashValue
Webhook accessMerchant must be enabled to use webhook APIs
InitializePayment APIMust be enabled for the merchant

Request #

Headers #

HeaderRequiredValue
Content-TypeYesapplication/json

Initialize Payment Request #

Request Body #

{
  "merchantId": 13593,
  "terminalId": 101311,
  "amount": 10.5,
  "currency": 512,
  "language": 0,
  "merchantReference": "ORD-20260824-001",
  "requestDateTime": "2026-08-24T08:00:00.000Z",
  "returnUrl": "https://merchant.example.com/pay/success",
  "cancelUrl": "https://merchant.example.com/pay/cancel",
  "returnUrlMethodType": "Get",
  "paymentViewType": 2,
  "sessionToken": "",
  "orderItems": [
    {
      "name": "Item 1",
      "price": "10.500",
      "descriptionOne": "Desc 1",
      "descriptionTwo": "Desc 2"
    }
  ],
  "askForContactInformationFieldsType": 1,
  "splitProfileId": "",
  "udf": "optional-merchant-data",
  "primaryColor": "#0B3D5C",
  "requestSource": 1016,
  "secureHashValue": "REPLACE_WITH_VALID_HASH"
}

Request Parameters #

FieldTypeRequiredDescription
merchantIdIntegerYesMerchant ID
terminalIdIntegerYesE-commerce/digital terminal ID
amountDecimalYesTransaction amount in major currency units
currencyIntegerYesISO 4217 numeric currency code
languageIntegerYes0 = English, 1 = Arabic
merchantReferenceStringYesUnique merchant-generated payment reference
requestDateTimeStringYesRequest timestamp in ISO 8601 UTC format
returnUrlStringRecommendedURL where the customer is redirected after payment
cancelUrlStringNoURL where the customer is redirected when payment is cancelled
returnUrlMethodTypeStringNoGet or Post. Default: Get
paymentViewTypeIntegerNo1 = PopUp, 2 = FullPage. Default: 2
sessionTokenStringNoOptional SmartBox customer session token
orderItemsArray / JSON StringNoItems displayed on the checkout
askForContactInformationFieldsTypeIntegerNo1 = All, 2 = Email Only, 3 = Mobile Only, 4 = None
splitProfileIdStringNoExisting split profile ID
udfStringNoMerchant-defined data passed through checkout
primaryColorStringNoCheckout brand color in hexadecimal format
requestSourceIntegerNoRequest source. Prefer 1016 for Webhook
secureHashValueStringYesHMAC-SHA256 hash of the request fields

Order Items #

When orderItems is provided, each item should use the following structure.

FieldTypeMaximum Length
nameString100
priceString30
descriptionOneString150
descriptionTwoString150

Example #

[
  {
    "name": "Item 1",
    "price": "10.500",
    "descriptionOne": "Product description",
    "descriptionTwo": "Additional information"
  }
]

For secure-hash compatibility with the webhook gateway, it is recommended to send orderItems as a JSON string or omit the field when it is not required.


Success Response #

{
  "success": true,
  "responseCode": "00",
  "message": "Success",
  "data": "https://smartbox.example.com/add-payment/Ab12Cd34Ef"
}

Response Parameters #

FieldTypeDescription
successBooleanIndicates whether the API request was successful
responseCodeStringAPI response code. 00 indicates success
messageStringHuman-readable response message
dataStringShort SmartBox payment URL
errorListArrayError details when the request fails

Payment URL #

The value returned in data is the customer’s SmartBox payment URL.

Redirect the customer to this URL to continue the payment process.

Important: Do not interpret success: true as a successful payment. It only means that the payment URL was successfully created.


Payment URL Lifecycle #

The payment URL has a limited lifetime.

StepProcess
1Merchant sends InitializePayment request
2Amwal creates a unique order key/token
3The full SmartBox URL is cached for approximately 30 minutes
4A Merchant Order is created and associated with the merchantReference
5API returns a short SmartBox URL
6Customer opens the short URL
7SmartBox resolves the token to the checkout URL
8Customer completes or cancels the payment

URL Expiration #

The short payment URL should not be reused after its expiration period.

If the URL expires, the order is already paid, or the cached payment information is unavailable, the customer may receive an order-not-found or already-paid error.

Create a new Initialize Payment request when a new payment URL is required.

Saved Card #

If you want to enable saved card / card tokenization functionality during the Initialize Payment flow, first obtain the required Acquiring Session Token.

For the complete process of generating and using the Acquiring Session Token, refer to:
Acquiring Session Token – Amwal Pay →
After obtaining the session token, use it in the Initialize Payment request when configuring the payment flow for saved-card functionality.


Secure Hash Generation #

secureHashValue is required for Initialize Payment requests.

The hash is generated using the merchant’s Secure Hash Key.

Hash Generation Steps #

  1. Collect all request body fields.
  2. Exclude secureHashValue.
  3. Exclude fields whose value is null.
  4. Sort the field names alphabetically.
  5. Convert each field into key=value.
  6. Join the fields using &.
  7. Calculate HMAC-SHA256 using the Merchant Secure Hash Key.
  8. Treat the configured secret as hexadecimal and convert it to bytes before HMAC.
  9. Convert the resulting digest to uppercase hexadecimal.
  10. Send the result as secureHashValue.

Example Hash Input #

amount=10.5&currency=512&language=0&merchantId=13593&merchantReference=ORD-20260824-001&requestDateTime=2026-08-24T08:00:00.000Z&requestSource=1016&returnUrl=https://merchant.example.com/pay/success&terminalId=101311

The exact hash input depends on the fields included in the request.

If primaryColor, orderItems, or another supported field is included in the request, it must also be included in the hash according to the gateway’s field serialization rules.

Node.js Example #

const crypto = require('crypto');

function calcWebhookHash(obj, secretHex) {
  const sorted = Object.keys(obj)
    .filter(
      (key) =>
        key !== 'secureHashValue' &&
        obj[key] !== null &&
        obj[key] !== undefined
    )
    .sort()
    .reduce((acc, key) => {
      acc[key] = obj[key];
      return acc;
    }, {});

  const payload = Object.entries(sorted)
    .map(([key, value]) => {
      const serializedValue =
        typeof value === 'object'
          ? JSON.stringify(value)
          : value;

      return `${key}=${serializedValue}`;
    })
    .join('&');

  return crypto
    .createHmac('sha256', Buffer.from(secretHex, 'hex'))
    .update(payload, 'utf8')
    .digest('hex')
    .toUpperCase();
}

cURL Example #

UAT #

curl -X POST 'https://test.amwalpg.com:14443/MerchantOrder/InitializePayment' \
  -H 'Content-Type: application/json' \
  -d '{
    "merchantId": 13593,
    "terminalId": 101311,
    "amount": 10.5,
    "currency": 512,
    "language": 0,
    "merchantReference": "ORD-20260824-001",
    "requestDateTime": "2026-08-24T08:00:00.000Z",
    "returnUrl": "https://merchant.example.com/pay/success",
    "cancelUrl": "https://merchant.example.com/pay/cancel",
    "returnUrlMethodType": "Get",
    "paymentViewType": 2,
    "sessionToken": "",
    "orderItems": [],
    "askForContactInformationFieldsType": 1,
    "splitProfileId": "",
    "udf": "optional-merchant-data",
    "primaryColor": "#0B3D5C",
    "requestSource": 1016,
    "secureHashValue": "REPLACE_WITH_VALID_HASH"
  }'

Production #

Use the Production Initialize Payment endpoint with the same request structure and a valid production merchant configuration.


Response Handling #

A successful Initialize Payment request means:

  • The merchant request was accepted.
  • The secure hash was valid.
  • The payment order was created.
  • A SmartBox payment URL was generated.

It does not mean:

  • The customer has opened the checkout.
  • The customer has entered card details.
  • The payment was authorized.
  • The payment was captured.
  • The payment was settled.

Payment completion should be handled separately through the configured payment return/notification and reconciliation mechanisms.

Use the merchantReference to correlate the payment with the merchant’s order.


Error Handling #

Error / SituationTypical CauseRecommended Action
SecureHashValueIsRequiredHash was not providedGenerate and send secureHashValue
InvalidHashingHash does not match the requestVerify field sorting, serialization, secret, and hash generation
MerchantIdIsRequiredMerchant ID is missingProvide a valid merchantId
MerchantNotFoundMerchant ID is invalid or unknownVerify the merchant configuration
MerchantNotAllowedToUseWebHookWebhook access is disabledAsk Amwal to enable webhook access
WebhookApiNotEnabledForMerchantInitialize Payment API is not enabledAsk Amwal to enable this Api webhook access
NotAllowedForEcommerceTerminal is not configured for e-commerceUse a valid e-commerce terminal
InvalidMerchantTransactionCurrencyCurrency is not supportedUse a currency enabled for the merchant
Order not found / already paidPayment URL expired, cache missing, or order already paidCreate a new Initialize Payment request

Common Integration Errors #

Invalid Secure Hash #

Check that:

  • secureHashValue itself is excluded from the hash.
  • null values are excluded.
  • Field names are sorted alphabetically.
  • Values are serialized consistently.
  • The Secure Hash Key is treated as hexadecimal.
  • HMAC-SHA256 is used.
  • The final hash is converted to uppercase hexadecimal.
  • Any field included in the request is also included in the hash.

Incorrect Currency #

Make sure the currency is supported by the merchant and that the numeric ISO 4217 code is used.

For OMR:

currency = 512

Expired Payment URL #

Do not store and reuse an old SmartBox URL indefinitely.

If the URL has expired, initialize a new payment and redirect the customer to the newly generated URL.


Integration Flow #

Merchant
   |
   | 1. Prepare payment
   |
   | 2. Generate secureHashValue
   |
   v
AMWAL InitializePayment API
   |
   | 3. Validate merchant + hash
   |
   | 4. Create payment order
   |
   | 5. Generate SmartBox URL
   |
   v
Merchant
   |
   | 6. Redirect customer
   v
SmartBox Checkout
   |
   | 7. Customer completes payment
   |
   v
Payment Result / Notification
   |
   | 8. Merchant reconciles transaction
   v
Merchant Order

Implementation Checklist #

Before going live, verify the following:

  • Merchant ID is correct.
  • E-commerce terminal ID is correct.
  • Merchant Secure Hash Key is configured securely.
  • Webhook access is enabled.
  • Initialize Payment API is enabled.
  • API type 23 is enabled for the merchant.
  • Content-Type: application/json is sent.
  • merchantReference is unique for every payment.
  • requestDateTime uses the recommended UTC ISO 8601 format.
  • currency is supported by the merchant.
  • secureHashValue is calculated before sending the request.
  • secureHashValue excludes itself from the hash input.
  • requestSource is included in the hash when it is included in the request.
  • primaryColor is included in the hash when it is included in the request.
  • The customer is redirected to the returned SmartBox URL.
  • Payment completion is handled separately from Initialize Payment success.
  • Expired payment URLs are not reused.
  • UAT testing is completed before switching to Production.

Important Notes #

Initialize Payment is a payment-session creation API.
A successful response indicates that AMWAL Pay successfully generated a SmartBox payment URL. It does not represent a successful card transaction.

Never expose the Merchant Secure Hash Key in frontend code, JavaScript, browser requests, logs, or publicly accessible configuration. The hash must be generated server-side.

Always use a unique merchantReference so that your system can reliably associate the payment with the corresponding merchant order.

Updated on August 24, 2026

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Acquiring Session TokenEncryption and Decryption
Table of Contents
  • Endpoint
    • Environments
    • Full Endpoint URLs
  • Overview
  • Authentication & Credentials
  • Request
    • Headers
  • Initialize Payment Request
    • Request Body
  • Request Parameters
  • Order Items
    • Example
  • Success Response
    • Response Parameters
    • Payment URL
  • Payment URL Lifecycle
    • URL Expiration
  • Saved Card
  • Secure Hash Generation
    • Hash Generation Steps
    • Example Hash Input
    • Node.js Example
  • cURL Example
    • UAT
    • Production
  • Response Handling
  • Error Handling
  • Common Integration Errors
    • Invalid Secure Hash
    • Incorrect Currency
    • Expired Payment URL
  • Integration Flow
  • Implementation Checklist
  • Important Notes

Secure. Seamless – Powering Payments for Every Business.

Sign Up
Support

4th Floor, Majan Tower Building
North Al Ghubrah, P.O. Box 233, P.C 118
Muscat, Sultanate of Oman

: support@amwal-pay.com

📞 : +96824121845

Resources
  • Developers
  • Careers
Company
  • About us
  • Contact Us
  • Contact Sales
  • Partners

2026 © AmwalPay. All Rights Reserved.

  • Terms & Conditions
  • Privacy Policy