Subscription
Subscription payments are applicable for products or services that are consumed on an ongoing basis and follow a recurring payment model. When making the first purchase, your customers are requested to give pre-authorization for their future payments, which enables the available data for recurring and repeat transactions. Payments will be done at fixed intervals without any specific payment action from the consumer follow a subscription model.
Process Flow
Flow diagram
API Configuration
Initiate Subscription Method
HTTP RequestPOST /v2/gateway/api/create
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String(20) | Merchant ID Integration information | |
partnerName | String | Partner name | |
storeId | String | Store ID | |
requestId | String(50) | Request ID, unique for each request, MoMo's partner uses the requestId field for idempotency control | |
amount | Long | Order amount in VND (0 or greater) | |
orderId | String(50) | Partner Transaction ID Regex: ^[0-9a-zA-Z]([-_.]*[0-9a-zA-Z]+)*$ This is the Bill Id of a subscription, which is unique and will be regarded as the Initial OrderId used for later subsequent payments | |
orderInfo | String(200) | Order info from merchant | |
orderGroupId | Long | The orderGroupId will be provided by MoMo to classify groups of orders for further operational activities. Please contact MoMo to use this field. | |
redirectUrl | String(200) | MoMo Payment will redirect end-user back to Merchant using this URL, to notify result for end-user using HTTP GET request type | |
ipnUrl | String(200) | MoMo Payment will notify this URL. Merchant server needs to build this URL to receive results sent from MoMo, using HTTP POST request type with header application/json. | |
partnerClientId | String | Merchant’s unique identifier for each user (e.g.: user ID or email). This ID will be linked with end-user’s MoMo account. | |
extraData | String | Default value is empty "" Encode base64 follow Json Format: {"key": "value"} Example with data: {"username": "momo"} => data of extraData : eyJ1c2VybmFtZSI6ICJtb21vIn0= | |
requestType | String(20) | subscription | |
subscriptionInfo | Object | Short information | |
lang | String(20) | Language return: vi or en | |
signature | String(65) | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format: a String sort all key name of data field from a-z: accessKey=$accessKey&amount=$amount&extraData=$extraData &ipnUrl=$ipnUrl&orderId=$orderId&orderInfo=$orderInfo &partnerClientId=$partnerClientId&partnerCode= $partnerCode&redirectUrl=$redirectUrl&requestId= $requestId&requestType=$requestType |
Data of subscription Info
Attribute | Type | Required | Description |
---|---|---|---|
name | String | The name of this subscription | |
partnerSubsId | String | The Id of this subscription, which is equivalent to its name above | |
subsOwner | String | This is the user account (Phone number/Email/ Bill ID,..). In case customer authorizes Merchant to automatically charge for the same subscriptions with different user accounts, it should be displayed for customer recognition. | |
type | String | The amount to be charged in each frequency cycle can be fixed or capped to max amount. FIXED: Amount charged in each frequency cycle will be the same as recurringAmount VARIABLE: Amount charged in each frequency cycle can be variable | |
recurringAmount | Long | Amount to be charged to the customer in each frequency cycle. If type is FIXED , it is the fixed amount that can be charged to the customer in each frequency cycle. If type is VARIABLE , it is the maximum amount that can be charged to the customer in each frequency cycle. | |
frequency | String | The frequency of recurring payments DAILY, WEEKLY, BI_WEEKLY, MONTHLY, BI_MONTHLY, QUARTERLY, SEMI_ANNUALLY | |
nextPaymentDate | String | This is the following payment date on which merchant will request to charge the customer via by token. - In case subscription will start later or it has a free trial period (amount informed above = 0), nextPaymentDate is required, to inform customers the first date to be charged - In case subscription starts instantly without a free trial period (amount informed above > 0), nextPaymentDate is optional. If not provided, nextPaymentDate will be calculated via MoMo based on attribute frequency Format of date is YYYY-MM-DD | |
expiryDate | String | Date when subscription will expire. Payment collection request will not be allowed since the expiry date. Format of date is YYYY-MM-DD |
Example Request
{
"partnerCode": "MOMO_PARTNER_A",
"requestType": "subscription",
"ipnUrl": "https://webhook.site/d946f723-129c-46dd-ab20-7c370375a05c",
"redirectUrl": "https://webhook.site/d946f723-129c-46dd-ab20-7c370375a05c",
"orderId": "0123456789",
"amount": "0",
"lang": "en",
"orderInfo": "Test 1234556",
"requestId": "1234567891",
"partnerClientId": "user123456",
"extraData": "eyJyZXN1bHRfbmFtZXNwYWNlIjoidW1hcmtldCIsImVycm9yIjoiIiwic3RhdGUiOjZ9",
"signature": "96fb584f7da1a81022911f4b6aff9bd5f159653f4f7d46d172e869fb8876a5be",
"subscriptionInfo": {
"partnerSubsId": "SubId-1645170503079",
"name": "Goi ABC Premium 1645170503079",
"subsOwner": "Owner A",
"type": "VARIABLE",
"recurringAmount": 60000,
"nextPaymentDate": "2022-02-22",
"expiryDate": "2023-02-22",
"frequency": "MONTHLY"
}
}
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
requestId | String | Same as the original request | |
orderId | String | Initial OrderId | |
amount | Long | Order amount in VND (0 or greater) | |
payUrl | String | URL for switching from the partner's page to the MoMo payment page | |
deeplink | String | URL to open MoMo application directly (Customers must install MoMo app first) and payment confirmation screen. | |
qrCodeUrl | String | Data to generate QR code if you want customers to scan the QR code directly on your purchase page or to print it on the invoice. Note : This URL is NOT containing the image of the QR code, you need to use an external library to generate the QR code. | |
deeplinkMiniApp | String | URL to open the MoMo app's payment confirmation screen. Apply when partner's website is embedded into MoMo app. | |
resultCode | int | Error code | |
message | String | Error description, error language is based on lang | |
responseTime | Long | Time to respond payment results to partner Format: timestamp | |
partnerClientId | String | Merchant’s unique identifier for each user (e.g.: user ID or email). This ID will be linked with end-user’s MoMo account. |
On the production environment: You need to request permission to use qrCodeUrl
, deeplink
,deeplinkMiniApp
fields.
Example Response
{
"partnerCode": "MOMO_PARTNER_A",
"orderId": "0123456789",
"requestId": "1234567891",
"amount": 0,
"responseTime": 1645170502966,
"message": "Successful.",
"resultCode": 0,
"payUrl": "https://test-payment.momo.vn/v2/gateway/pay?t=TU9NT0lPTEQyMDE5MDEyOXwwMTIzNDU2Nzg5MDEyMzQ1MTY0NTE3MDUwMzA3OQ==",
"deeplink": "momo://?action=subscription&isScanQR=false&sid=TU9NT0lPTEQyMDE5MDEyOXwwMTIzNDU2Nzg5MDEyMzQ1MTY0NTE3MDUwMzA3OQ==&v=2.1",
"qrCodeUrl": "https://test-payment.momo.vn/v2/gateway/app?isScanQr=true&t=TU9NT0lPTEQyMDE5MDEyOXwwMTIzNDU2Nzg5MDEyMzQ1MTY0NTE3MDUwMzA3OQ==",
"partnerClientId": "user123456"
}
Process Payment Result
For more information, see Payment Notification.
Parameter description
Description for parameters which are used by MoMo in the URL redirectUrl
and the body content of ipnUrl
.
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
requestId | String | Each Request’s Identification | |
amount | Long | Amount to pay | |
orderId | String | Initial OrderId | |
partnerUserId | String | MoMo's unique identifier for each MoMo eWallet account. | |
orderType | String | momo_wallet | |
orderInfo | String | Order info | |
partnerClientId | String | Identifier of user | |
callbackToken | String | Token info used to get payment token | |
transId | Long | MoMo's transaction ID | |
resultCode | Integer | Order status | |
message | String | description of resultCode based on lang | |
payType | String | Payment Type: webApp , app ,qr or miniapp | |
responseTime | Long | Time to return payment result in miliseconds | |
extraData | String | Additional info | |
signature | String | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format: a String sort all key name of data field from a-z: accessKey=$accessKey&amount=$amount&callbackToken= $callbackToken&extraData=$extraData&message=$message &orderId=$orderId&orderInfo=$orderInfo&orderType= $orderType&partnerClientId=$partnerClientId &partnerCode=$partnerCode&payType=$payType&requestId= $requestId&responseTime=$responseTime&resultCode= $resultCode&transId=$transId |
The signature is encrypted using secretKey and accessKey, so you must keep it secret, not expose to any chat channels, or in source code, git, etc.
Receive Subscription Token
After receiving callbackToken
from transaction result, merchant will send a request to MoMo to get user's token info
POST /v2/gateway/api/subscription/create
Parameter | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
callbackToken | String | callbackToken as access token, received from payment result | |
requestId | String(50) | Request ID, unique for each request, MoMo's partner uses the requestId field for idempotency control | |
orderId | String | Initial OrderId | |
partnerClientId | String(50) | Identifier of transaction with saved token | |
lang | String | Language¸ of returned message (vi or en ) | |
signature | String | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format: a String sort all key name of data field from a-z: accessKey=$accessKey&callbackToken=$callbackToken&orderId= $orderId&partnerClientId=$partnerClientId&partnerCode= $partnerCode&requestId=$requestId |
Example request
{
"partnerCode": "MOMO_PARTNER_A",
"requestId": "2f10f50d933d",
"callbackToken": "v2/qml0PbOlrBYjFlZv…8StiawfZPiKoUGvywNHV",
"orderId": "0123456789",
"partnerClientId": "user123456",
"signature": "fa8b66df31cc7045783323f1e4492d7b71c1de4c9e1b71002f95a1aa869e885a",
"lang": "vi"
}
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
requestId | String | Each Request’s Identification | |
orderId | String | Initial OrderId | |
aesToken | String | subscription object json encrypted using AES | |
resultCode | Integer | Order status | |
partnerClientId | String | Merchant’s unique identifier for each user (e.g.: user ID or email). This ID will be linked with end-user’s MoMo account | |
responseTime | Long | Time to respond payment results to partner Format: timestamp | |
message | String | Result description based on lang |
Data of token after decrypted
Attribute | Type | Required | Description |
---|---|---|---|
value | String | subscription Value as recurring subscription | |
initialOrderId | String | Initial OrderId (regarded as the orderId of this subscription) | |
userAlias | String | MoMo masked wallet ID (only show last 4 digits) | |
profileId | String | MoMo hash wallet ID |
Example response
{
"timestamp": 1600678154664,
"partnerCode": "MOMO_PARTNER_A",
"requestId": "2f10f50d933d",
"orderId": "0123456789",
"partnerClientId": "user123456",
"resultCode": 0,
"responseTime": 145784525,
"message": "Success",
"aesToken": "NplHKEhGuFoo5o5vbMeJwrsk7wXEPnCjSZv6DgivW1a8JKw1gdXq2WS7UsPwoJv0yf6rbGiVV6nOKAxU8kTNg4SZraqJnf7GAq9OSE2LiNs="
}
Pay using Subscription
When the subscription reaches the payment date, Merchant can make the payment request without user confirmation, according to the authorization from users before.
HTTP RequestPOST /v2/gateway/api/subscription/pay
Parameter | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
partnerName | String | Partner name | |
orderId | String | Partner Transaction ID Regex: ^[0-9a-zA-Z]([-_.]*[0-9a-zA-Z]+)*$ | |
amount | Long | Payment amount Min: 1000 VND Max: equal to the value of recurringAmount informed before Currency: VND . | |
requestId | String(50) | Request ID, unique for each request, MoMo's partner uses the requestId field for idempotency control | |
token | String | Encrypt a object json by RSA using public Key RSA Encryption | |
partnerClientId | String(50) | Merchant's unique user info | |
orderInfo | String | Short information | |
orderGroupId | Long | The orderGroupId will be provided by MoMo to classify groups of orders for further operational activities. Please contact MoMo to use this field. | |
extraData | String | Default value is empty "" Encode base64 follow Json Format: {"key": "value"} Example with data: {"username": "momo"} => data of extraData : eyJ1c2VybmFtZSI6ICJtb21vIn0= | |
nextPaymentDate | String | This is the following payment date on which merchant will request to charge customers via token, which will be used to raise customer awareness of the upcoming charge: - If not provided, nextPaymentDate will be calculated via MoMo based on attribute frequency and lastPaymentDate - If nextPaymentDate is provided but not rational (> +- 2 days compared with the nextPaymentDate calaculated by MoMo), MoMo will use the calculated ones. Format of date is YYYY-MM-DD | |
lang | String | Language of returned message (vi or en ) | |
signature | String | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format: a String sort all key name of data field from a-z: accessKey=$accessKey&amount=$amount&extraData=$extraData &orderId=$orderId&orderInfo=$orderInfo&partnerClientId= $partnerClientId&partnerCode=$partnerCode&requestId= $requestId&token=$token |
Data of token before encrypted
Attribute | Type | Required | Description |
---|---|---|---|
value | String | subscription Value as recurring subscription | |
initialOrderId | String | Initial OrderId (regarded as the orderId of this subscription) |
{
"value": "2d6c6f28cead966d1f53fb61bc4ad45f018a26f21e5e6917b5f7c3408a13f1de",
"initialOrderId": "0123456789"
}
Example request
{
"token": "YH69iNB6DNGkRDV+5dy65BdJLZflqvTQ0z5I3k5FE2u...",
"partnerCode": "MOMO_PARTNER_A",
"orderId": "12345678911",
"amount": "20000",
"lang": "vi",
"orderInfo": "Thanh toan goi subs aaa",
"requestId": "12345678911",
"extraData": "",
"partnerClientId": "user123456",
"nextPaymentDate": "2022-03-22",
"signature": "2512s1d2s1ds21d2s1d1ce5d1a251#@"
}
HTTP Response
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
orderId | String | Partner Transaction ID Regex: ^[0-9a-zA-Z]([-_.]*[0-9a-zA-Z]+)*$ entification | |
requestId | String | Each Request’s Identification | |
amount | Long | Amount to pay | |
transId | Long | MoMo's transaction ID | |
responseTime | Long | Time to respond payment results to partner Format: timestamp | |
partnerClientId | String | Merchant’s unique identifier for each user (e.g.: user ID or email). This ID will be linked with end-user’s MoMo account. | |
resultCode | Integer | Order status | |
message | String | Result description, language is based on lang |
Example response
{
"partnerCode": "MOMO_PARTNER_A",
"requestId": "12345678911",
"orderId": "12345678911",
"amount": 60000,
"responseTime": 145758545,
"partnerClientId": "user123456",
"resultCode": 0,
"message": "Success"
}
If transaction is failed 2 times due to insufficient funds, MoMo will deactivate the subsToken (pause this authorization), which means we temporarily stop accepting payment requests from merchant until the authorization is reactivated by customer.
Pause/cancel an authorization
In case automatic payments could not be made, Merchant will stop offering the products or services, which means the subscription is not re-newed. Merchant can request to pause/cancel this subsToken (the authorization), due to this subscription is no longer available.
HTTP RequestPOST /v2/gateway/api/subscription/manage
Parameter | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
requestId | String(50) | Request ID, unique for each request, MoMo's partner uses the requestId field for idempotency control | |
orderId | String(50) | OrderId of partner, unique for each request | |
token | String | Encrypt a object json by RSA using public Key RSA Encryption | |
partnerClientId | String(50) | Merchant's unique user info | |
lang | String(20) | Language of returned message (vi or en ) | |
action | String(20) | - pause : to temporarily stop processing payment requests until the subsToken is reactivated (usable when current subsToken status is active). - cancel : to permanently stop processing payment requests (usable when current subsToken status is active/paused) | |
signature | String(65) | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format: a String sort all key name of data field from a-z: accessKey=$accessKey&orderId=$orderId&partnerClientId= $partnerClientId&partnerCode=$partnerCode&requestId= $requestId&token=$token |
Data of token before encrypted
Attribute | Type | Required | Description |
---|---|---|---|
value | String | subscription Value as recurring subscription | |
initialOrderId | String | Initial OrderId (regarded as the orderId of this subscription) |
{
"value": "2d6c6f28cead966d1f53fb61bc4ad45f018a26f21e5e6917b5f7c3408a13f1de",
"initialOrderId": "0123456789"
}
Example request
{
"partnerCode": "MOMO_PARTNER_A",
"requestId": "12345678912",
"orderId": "12345678912",
"partnerClientId": "user123456",
"token": "Vqy3A3kGm8kkZZjBKHoQCgs779rSbm4TppXVCCxtEmNpGJo+bYRiZ0Vj...",
"lang": "vi",
"signature": "dc4e7186deb1455b1af460d1dc6e9ae2e6fb568107abd517ee1147a5bf37572c",
"action": "pause"
}
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
requestId | String | Each Request’s Identification | |
orderId | String(50) | OrderId of partner, unique for each request | |
message | String | Result description, language is based on lang | |
resultCode | Integer | Order status | |
partnerClientId | String | Merchant's unique user info | |
responseTime | Long | Time to respond payment results to partner Format: timestamp |
Example response
{
"partnerCode": "MOMO_PARTNER_A",
"orderId": "12345678912",
"requestId": "12345678912",
"resultCode": 0,
"message": "Success",
"partnerClientId": "user123456",
"responseTime": 14548754653232
}
Reactivate an authorization
After an authorization is paused, customer can request to reactivate it, as long as the authorization does not pass its expiration date. This reactivation should be requested by merchant (after customer confirmation), to ensure that merchant is informed of this action. MoMo will accept payment requests after successful reactivation.
HTTP RequestPOST /v2/gateway/api/subscription/manage
Parameter | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
requestId | String(50) | Request ID, unique for each request, MoMo's partner uses the requestId field for idempotency control | |
orderId | String(50) | OrderId of partner, unique for each request | |
token | String | Encrypt a object json by RSA using public Key RSA Encryption | |
partnerClientId | String(50) | Merchant's unique user info | |
lang | String(20) | Language of returned message (vi or en ) | |
action | String(20) | reactivate : current subsToken status is paused. | |
redirectUrl | String(200) | MoMo Payment will redirect end-user back to Merchant using this URL, to notify result for end-user using HTTP GET request type | |
ipnUrl | String(200) | MoMo Payment will notify this URL. Merchant server needs to build this URL to receive results sent from MoMo, using HTTP POST request type with header application/json. | |
signature | String(65) | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format: a String sort all key name of data field from a-z: accessKey=$accessKey&orderId=$orderId&partnerClientId= $partnerClientId&partnerCode=$partnerCode&requestId= $requestId&token=$token |
Data of token before encrypted
Attribute | Type | Required | Description |
---|---|---|---|
value | String | subscription Value as recurring subscription | |
initialOrderId | String | Initial OrderId (regarded as the orderId of this subscription) |
{
"value": "2d6c6f28cead966d1f53fb61bc4ad45f018a26f21e5e6917b5f7c3408a13f1de",
"initialOrderId": "0123456789"
}
Example request
{
"partnerCode": "MOMO_PARTNER_A",
"requestId": "12345678913",
"orderId": "12345678913",
"partnerClientId": "user123456",
"token": "Vqy3A3kGm8kkZZjBKHoQCgs779rSbm4TppXVCCxtEmNpGJo+bYRiZ0Vj...",
"lang": "vi",
"signature": "dc4e7186deb1455b1af460d1dc6e9ae2e6fb568107abd517ee1147a5bf37572c",
"action": "reactivate",
"ipnUrl": "https://webhook.site/d946f723-129c-46dd-ab20-7c370375a05c",
"redirectUrl": "https://webhook.site/d946f723-129c-46dd-ab20-7c370375a05c"
}
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String | Integration information | |
requestId | String | Each Request’s Identification | |
orderId | String | Initial OrderId | |
message | String | Result description, language is based on lang | |
resultCode | Integer | Order status | |
partnerClientId | String | Merchant's unique user info | |
responseTime | Long | Time to respond payment results to partner Format: timestamp | |
payUrl | String | URL for switching from the partner's page to the MoMo payment page | |
deeplink | String | URL to open MoMo application directly (Customers must install MoMo app first) and payment confirmation screen. | |
qrCodeUrl | String | Data to generate QR code if you want customers to scan the QR code directly on your purchase page or to print it on the invoice. Note : This URL is NOT containing the image of the QR code, you need to use an external library to generate the QR code. | |
deeplinkMiniApp | String | URL to open the MoMo app's payment confirmation screen. Apply when partner's website is embedded into MoMo app. |
Example response
{
"partnerCode": "MOMO_PARTNER_A",
"orderId": "123456789123",
"requestId": "123456789123",
"resultCode": 0,
"message": "Success",
"responseTime": 14548754653232,
"partnerClientId": "user123456",
"payUrl": "http://localhost:9999/v2/gateway/pay?t=TU9NT0lPTEQyMDE5MDEyOXwxNjQ5MTI3NjI5MzYyOjAxMjM0NTY3Nzg=",
"deeplink": "momo://?action=updateSubscription&isScanQR=false&sid=TU9NT0lPTEQyMDE5MDEyOXwxNjQ5MTI3NjI5MzYyOjAxMjM0NTY3Nzg=&v=2.1",
"qrCodeUrl": "http://localhost:9999/v2/gateway/app?isScanQr=true&t=TU9NT0lPTEQyMDE5MDEyOXwxNjQ5MTI3NjI5MzYyOjAxMjM0NTY3Nzg=",
"deeplinkMiniApp": "momo://?action=updateSubscription&isScanQR=false&sid=TU9NT0lPTEQyMDE5MDEyOXwxNjQ5MTI3NjI5MzYyOjAxMjM0NTY3Nzg=&v=2.1"
}
Process reactivate result
Same with Process Payment Result.
Action from MoMo's side
Request header:
application/json - Response header:
application/json
Some actions from MoMo's side can make token become invalid, such as customers want to cancel/pause the authorization from MoMo App, or MoMo automatically updates status when the authorization passes its expiry date.
Merchant has to provide the endpoint to receive notify of these actions sent from MoMo, using HTTP POST.
HTTP RequestAttribute | Type | Required | Description |
---|---|---|---|
partnerCode | String | Merchant ID | |
requestId | String | Unique ID for each request | |
orderId | String | OrderId of transaction initialized with requestType subscription | |
requestType | String | - pause : User chose to pause this subs authorization. User can reactivate it anytime. - cancel : User chose to cancel this subs authorization. - lock : MoMo temporarily locked the subs authorization due to exceed maximum failed payment requests. User can reactivate it anytime. - expire : The subs authorization can not be used anymore because it passed its expiry date. | |
partnerClientId | String | Vendor’s unique identifier of each user (e.g.: user ID or email) that linked with MoMo wallet | |
tokenType | String | subscription | |
signature | String | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format accessKey=$accessKey&orderId=$orderId&partnerClientId=$partnerClientId &partnerCode=$partnerCode&requestId=$requestId &requestType=$requestType&tokenType=$tokenType |
Example
{
"partnerCode": "MOMOIQA420180417",
"requestId": "0e0ceb2a-ea06-4ca7-b63a-e5c8948a5bfc",
"orderId": "012457855:231454545",
"partnerClientId": "sangle@mservice.com.vn",
"requestType": "lock",
"tokenType": "subscription",
"signature": "bd4df3f3bad6815a9a7be1f1f5c8576f3f97eab25327247425f12a3fb4a78873"
}
You need to respond with HTTP code 204 (No Content)!
CallbackToken Inquiry
If merchant system can not receive or record callbackToken, Merchant can request MoMo Payment to query callbackToken. Note that callbackToken has a default expire date of 10 minutes, counting from the time it is generated.
Request header:
application/json - Response header:
application/json
POST /v2/gateway/api/subscription/cbQuery
Attribute | Type | Required | Description |
---|---|---|---|
partnerCode | String(20) | Merchant ID | |
requestId | String(50) | Request ID, unique for each request | |
orderId | String(50) | It must be matched with orderId used in subscription | |
partnerClientId | String(50) | It must be matched with partnerClientId used in subscription | |
lang | String(20) | vi or en | |
signature | String(65) | Signature to confirm information. Secure transaction in Hmac_SHA256 algorithm with format: a String sort all key name of data field from a-z: accessKey=$accessKey&orderId=$orderId &partnerClientId=$partnerClientId&partnerCode=$partnerCode &requestId=$requestId |
Example
{
"partnerCode": "MOMO_PARTNER_A",
"requestId": "1527246504579",
"orderId": "1527246478428",
"partnerClientId": "user123456",
"lang": "vi",
"signature": "13be80957a5ee32107198920fa26aa85a4ca238a29f46e292e8c33dd9186142a"
}
Attribute | Type | Description |
---|---|---|
partnerCode | String | Merchant ID |
requestId | String | Request ID, unique for each request |
orderId | String | Partner Transaction ID Regex: ^[0-9a-zA-Z]([-_.]*[0-9a-zA-Z]+)*$ , stored on MoMo payment system |
callbackToken | String | The callback token generated by MoMo. |
resultCode | int | Result code |
message | String | Description regarding result code, based on lang |
responseTime | long | Response time |
Example
{
"partnerCode": "MOMO_PARTNER_A",
"requestId": "1527246504579",
"orderId": "1527246478428",
"callbackToken ": "u7YYQZnAbLQivB0p5SHT9LIhjshqarXyobE_WzCCa4vDt58r",
"resultCode": 0,
"message": "Success",
"responseTime": 127264428
}
Result Codes & Messages
These result codes and messages are exclusively assigned for the Subscription flow in Tokenization Payments. Additionally, kindly locate other result codes and messages in the comprehensive list of result codes provided here.
Result code | Description | Final Status | Recommended actions | Type |
---|---|---|---|---|
0 | Successful. | Yes | ||
2001 | Transaction failed due to invalid token. | Yes | The token has been deleted, please update accordingly. | Merchant error |
2007 | Transaction failed due to inactive token. | Yes | The token is inactive due to user decided to temporary lock the binding. | User error |
2012 | Request rejected due to invalid token. | Yes | The token does not exist or has been deleted. Token status can not be updated. | Merchant error |
2015 | Payment cannot be made until next payment period. | Yes | Please check the payment period and resend the request later. | Merchant error |
2016 | Transaction rejected because the payment period has expired/passed. | Yes | Merchant error |