Nhảy tới nội dung

Non-hosted payments

To have complete control of the customer experience, non-hosted payment page will be applied to allow customers enter their payment information directly on your website. In this case, follow these APIs to make payments.

Process Flow

atm_flow

API Configuration

HTTP Information

Initiate transaction with non-hosted payment page

First, it is required to create a transaction request for non-hosted payments. Access Initiate Transaction to learn more.

Process Transaction

It is used to process the transaction with respect to requestType (payWithATM) provided by merchant in the request. We will return bank form for user to make authentication.

HTTP Request

POST /v2/gateway/api/pay

Header
AttributeTypeRequiredDescription
mTokenStringThe recieved mToken from Initiate API
partnerCodeStringIntegration information
orderIdStringOrderId of partner, it must match with which has been initiated from Initiate API
requestIdString(50)Request ID, unique for each request,
MoMo's partner uses the requestId field for idempotency control
Body
AttributeTypeRequiredDescription
cardInfoObjectThe cardholder's infomation
requestTypeStringpayWithATM
generateCardTokenBooleantrue or false. If set to true, callbackToken will be sent to merchant using the IPN and redirect mechanism after user completes the payment. Merchant could use this callbackToken to get the recurring token for specific user (partnerClient).
amountLongAmount needs to be paid
Min: 10.000 VND
Max: 50.000.000 VND
Currency: VND
Data type: Long
Note: this field must match with which has been initiated in Initiate API
langStringLanguage of returned message (vi or en)
Details of cardInfo content
AttributeTypeRequiredDescription
cardFullNameStringFull name displayed on the card
cardIssueDateStringDate can be found on the card, written as MM/YY (month and year). Use Card issue date in case both Card issue date and Card expiration date are available
cardNumberStringCard Number

Example cardInfo

{
"cardFullName": "Nguyen Van A",
"cardNumber":"0704 0000 0000 0018",
"cardIssueDate":"03/07"
}

Example Request body

{
"cardInfo":{
"cardNumber":"0704 0000 0000 0018",
"cardFullName":"NGUYEN VAN A",
"cardIssueDate":"03/07",
},
"amount":100000,
"requestType": "payWithATM",
"generateCardToken": true,
"lang":"en"
}

Try yourself

HTTP Response
AttributeTypeRequiredDescription
partnerCodeStringIntegration information
orderIdStringPartner Transaction ID
requestIdStringSame as the original request
amountLongSame as the original payment amount
responseTimeLongTime to respond payment results to partner
Format: timestamp
messageStringError description, error language is based on lang
resultCodeintResult Code
payUrlStringURL to open authentication page

Example response

{
"partnerCode": "MOMOIOLD20190129",
"orderId": "1666005197362:0123456778",
"requestId": "1666756292133id",
"amount": 100000,
"resultCode": 0,
"message": "Thành công.",
"responseTime": 1666005325735,
"payUrl": "https://test-payment.momo.vn/service-napas-cashin-app-bank/napas/build_data_form?orderId=2735570207"
}

Processing 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.

AttributeTypeRequiredDescription
partnerCodeStringIntegration information
requestIdStringEach Request’s Identification
amountLongAmount to pay
orderIdStringOrderId of partner, unique for each request
orderTypeStringmomo_wallet
orderInfoStringOrder info
partnerUserIdStringMoMo's unique identifier for each MoMo eWallet account.
partnerClientIdStringIdentifier of user. partnerClientId is required only when generateCardToken = true
callbackTokenStringToken info used to get payment token, received only when generateCardToken = true and partnerClientId has been provided
transIdLongMoMo's transaction ID
resultCodeIntegerOrder status
messageStringdescription of resultCode based on lang
payTypeStringnapas
responseTimeLongTime to return payment result in miliseconds
extraDataStringAdditional info
signatureStringSignature 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

In case generateCardToken is true, process with API Receive recurring token after this successful payment.

Result Codes & Messages

These result codes and messages are exclusively assigned for Non-hosted payments flow within the context of Local ATM Card Payments. Additionally, kindly locate other result codes and messages in the comprehensive list of result codes provided here.

Result codeDescriptionFinal StatusRecommended actionsType
0Successful.Yes
21Request is rejected due to invalid transaction amount.NoMake sure that the initiated amount in both Initate Transaction and Process Transaction is the same.Merchant error
72Card number is in bad format.NoValidate that the card number entered from user must match with first 6 number from bankcodes and its length must in 16 - 19 number.Merchant error
73Cardholder's name is in bad format.NoValidate that the cardholder's name entered by user must be in alphabet format.Merchant error
74Card issuance date is in bad format.NoValidate that the issuance date entered by user must be in MM/YY format.Merchant error
75Card expired date is in bad format.NoValidate that the expired date entered by user must be in MM/YY format.Merchant error
1001Transaction failed due to insufficient funds.YesNotify user the insufficient funds issue and request them to use another card or top up this card.User error
1002Transaction rejected by the issuers of the payment accounts.YesPlease choose other payment methods.User error
1004Transaction value exceeds maximum limit set by bank.YesNotify user the maximum limitation and request them to try with less payment or use another cards.User error
1006Transaction failed because user has denied to confirm the payment.YesPlease send another payment request.User error
1007Card is locked.YesNotify user the locked card issue and request them to use another cards or payment methods.User error
1702Card number is invalid.YesPlease make sure the card number is correct.User error
1703Cardholder's name is incorrect.YesPlease make sure the cardholder's name is correct.User error
1704Card issuance date is incorrect.YesPlease make sure the card issuance date is correct.User error
1705Card expired date is incorrect.YesPlease make sure the card expired date is correct.User error
1711Card is expiredYesPlease make sure the card is still available to use.User error
1713Card is restrictedYesPlease make sure the card is unrestricted.User error
2001Transaction failed due to invalid token.YesMake sure that the mToken has not been used before, while partnerCode and orderId is correct.Merchant error
4010OTP verification failed.YesUser authentication failed. Please request another authentication.User error
7002Transaction is being processed by the provider of the payment instrument selected.YesPlease wait for the transaction to be processed. The transaction status will be notified once it's done processing.Pending

Pay using token

In case user would like to pay with a card saved before, call API Pay using token retrieved from Receive recurring token.

See also