tpay Notifications

tpay sends notifications to your Notification URL whenever there is a subscription payment or one-time transaction update. These notifications help keep your platform updated with the latest statuses.

Merchant Responsibilities

After receiving and processing a notification successfully, your system should return an HTTP 200-OK response. Any other response means the notification was not received successfully, and tpay may resend it. This helps ensure no payment updates are missed.

tpay notification types

There are five notification kinds below. You only receive the ones that match your product/service and what happened for them — not every callback on every integration.

SubscriptionOptInNotification

Sent when someone completes subscription signup outside your own checkout — for example via tpay Checkout, a mobile operator (MO) flow, or an operator app.

ParameterTypeMandatoryDescription
action
StringYes
Always set to "SubscriptionOptInNotification" for this notification.
subscriptionContractId
IntYes
The ID of the subscription contract that opted in.
operatorCode
IntYes
Operator code (MCC + MNC). Refer to your operator / coverage documentation for valid values.
msisdn
StringYes
Customer MSISDN. This parameter may be encrypted depending on operator policy.
renewalFrequency
StringYes
Subscription plan frequency (for example daily, weekly, or monthly).
trialPeriod
IntYes
Free trial length in days before the first charge. Use 0 or omit when there is no trial.
nextPaymentDate
StringYes
Date/time of the next recurring payment (URL-encoded timestamp as sent in the callback).
initialPaymentTranId
IntNo
Initial payment transaction ID in the tpay system, when applicable.
initialPaymentAmount
IntNo
Initial payment amount when the product uses an upfront charge.
productCatalogName
StringYes
Catalog name created in the tpay dashboard and used for the subscription.
productId
StringYes
Product SKU / id created in the tpay dashboard and used for the subscription.
recurringAmount
IntYes
Amount charged on each billing cycle after signup.
customerAccountNumber
StringYes
Partner-side account identifier for the subscribed contract (unique per your integration).
digest
StringYes
A secret way to encrypt parameters.

How to build the digest string

Signature = PublicKey + ":" + HexString(HMACSHA256(PrivateKey, message))

message = action + subscriptionContractId + operatorCode + msisdn + renewalFrequency + trialPeriod + nextPaymentDate + initialPaymentTranId + initialPaymentAmount + productCatalogName + productId + recurringAmount + customerAccountNumber

Use the same field names and order as in the callback when you verify the digest.

Subscription charging notifications

tpay performs charging on your behalf. You receive a notification for every attempt, successful or failed. There are two actions:

  • SubscriptionInitialChargingNotification — first charge (initial payment plan).
  • SubscriptionChargingNotification — recurring renewals after the first successful charge.
ParameterTypeMandatoryDescription
action
StringYes
SubscriptionInitialChargingNotification or SubscriptionChargingNotification, depending on whether this is the first charge or a renewal.
subscriptionContractId
IntYes
The subscription contract that was charged.
customerAccountNumber
StringYes
Unique partner-side identifier for the subscriber.
paymentTransactionStatusCode
StringYes
Charging outcome (for example PaymentCompletedSuccessfully or NotEnoughCredit).
transactionId
IntYes
The charging transaction ID in tpay.
amountCharged
IntYes
Amount deducted from them in this attempt.
currencyCode
StringYes
ISO currency code of the charge.
billAmount
IntYes
Total bill amount or the charging limit applied for this bill.
collectedAmount
IntYes
Total collected on the same bill (after partial collection rules).
paymentDate
StringYes
Date/time of the charging attempt.
errorMessage
StringNo
Error description when the charge did not complete successfully.
nextPaymentDate
StringYes
Date/time of the next recurring payment when applicable.
productCatalogName
StringYes
Catalog name created in the tpay dashboard and used for the subscription.
productId
StringYes
Product name / id created in the tpay dashboard and used for the subscription.
billNumber
IntYes
Charging cycle / bill sequence number.
billAction
StringYes
Bill type: • RecurringPayment — periodic balance charge per plan. • RetrailPayment — operator spelling in callbacks: retrial after a failed recurring charge. • Other values may appear for specialized flows (for example on-demand charging).
msisdn
StringYes
Customer MSISDN; may be encrypted for some operators.
digest
StringYes
A secret way to encrypt parameters.

How to build the digest string

Signature = PublicKey + ":" + HexString(HMACSHA256(PrivateKey, message))

message =  Action + SubscriptionContractId + CustomerAccountNumber + PaymentTransactionStatusCode + TransactionId + AmountCharged + CurrencyCode + PaymentDate + NextPaymentDate + ProductCatalogName + ProductId

SubscriptionContractStatusChanged

Sent when a subscription contract changes state — activation, suspension, cancellation, and similar transitions. Use it to sync entitlement in your product and support tooling.

ParameterTypeMandatoryDescription
action
StringYes
Always "SubscriptionContractStatusChanged".
subscriptionContractId
IntYes
The subscription contract whose status changed.
customerAccountNumber
StringYes
Customer identifier shared between you and tpay; unique on the partner side (any stable format you define).
status
StringYes
New contract status, for example Active or Canceled. • Active — after successful verification. • Cancelled — cancellation through API or mobile operator (MO). Note: partners are typically not notified while the contract is still New if they may not finish verification.
reason
StringNo
Why the status changed (for example "Activated", "Canceled By Merchant", or operator-specific text when canceled via MO).
digest
StringYes
A secret way to encrypt parameters.

How to build the digest string

digest = merchantPublicKey + ":" + HexString(HMACSHA256(merchantPrivateKey, message))

message = action + subscriptionContractId + customerAccountNumber + status + reason

TransactionStatusUpdate

Covers one-time payments. You will see whether the charge worked, plus amounts and references. Some fields (such as messagebody) may be blank depending on how they paid.

ParameterTypeMandatoryDescription
action
StringYes
Always TransactionStatusUpdate for one-time payment callbacks.
paymentTransactionStatusCode
StringYes
Outcome of the one-time payment attempt.
transactionId
StringYes
tpay transaction id for the payment.
msisdn
StringYes
Payer MSISDN when applicable.
amount
StringYes
Charged amount.
currencyCode
StringYes
ISO 4217 currency code.
paymentDate
StringYes
When the payment completed or failed.
productCatalogName
StringYes
Product catalog name.
productId
StringYes
Product id within the catalog.
messagebody
StringNo
Optional channel payload; may be empty depending on payment path.
orderInfo
StringNo
Merchant order or reference metadata.
paymentProviderCode
StringYes
Wallet or payment provider code.
smsID
StringNo
SMS or session correlation id when present.
digest
StringYes
A secret way to encrypt parameters.

How to build the digest string

message = action + paymentTransactionStatusCode + transactionId + msisdn + amount + currencyCode + paymentDate + productCatalogName + productId + moMessageBody + orderInfo + paymentProviderCode

SubscriptionOnDemandChargingNotification

Only for merchants who use the on-demand charging feature. It looks like a normal charge notification, but it applies to subscribers who are already active. When it applies, you may see billAction=OnDemandCharging.

ParameterTypeMandatoryDescription
action
StringYes
Always SubscriptionOnDemandChargingNotification for on-demand charges against active subscribers.
subscriptionContractId
IntYes
The subscription contract that was charged.
customerAccountNumber
StringYes
Unique partner-side identifier for the subscriber.
paymentTransactionStatusCode
StringYes
Charging outcome (for example PaymentCompletedSuccessfully or NotEnoughCredit).
transactionId
IntYes
The charging transaction ID in tpay.
amountCharged
IntYes
Amount deducted from them in this attempt.
currencyCode
StringYes
ISO currency code of the charge.
billAmount
IntYes
Total bill amount or the charging limit applied for this bill.
collectedAmount
IntYes
Total collected on the same bill (after partial collection rules).
paymentDate
StringYes
Date/time of the charging attempt.
errorMessage
StringNo
Error description when the charge did not complete successfully.
nextPaymentDate
StringYes
Date/time of the next recurring payment when applicable.
productCatalogName
StringYes
Catalog name created in the tpay dashboard and used for the subscription.
productId
StringYes
Product name / id created in the tpay dashboard and used for the subscription.
billNumber
IntYes
Charging cycle / bill sequence number.
billAction
StringYes
Often OnDemandCharging when the charge is triggered on demand (see your product configuration).
msisdn
StringYes
Customer MSISDN; may be encrypted for some operators.
digest
StringYes
A secret way to encrypt parameters.

How to build the digest string

Signature = PublicKey + ":" + HexString(HMACSHA256(PrivateKey, message))

message = subscriptionContractId + customerAccountNumber + paymentTransactionStatusCode + transactionId + amountCharged + currencyCode + paymentDate + errorMessage + nextPaymentDate + productCatalogName + productId + billNumber + billAction + msisdn + billAmount + collectedAmount