Skip to main content

One-Time Payments

Process Flow

Flow diagram

Onetime_flow

Explanation

  • Step 1: Customers check out order at your website and choose MoMo as payment method.
  • Step 2: Your server creates a payment session and sends payment request to MoMo.
  • Step 3: Switch to MoMo's payment page.
  • Step 4: Customers use MoMo app to scan QR code or log in to process payment.
  • Step 5: After payment, customers will be redirected back to your website.
  • Step 6: Your server authenticates transaction and updates the result for customers.

API configuration

HTTP Information

Payment method

At merchant website, after users choose products or services and make payment using Credit card, Merchant server needs to call MoMo API to retrieve the payment URL, then the merchant website redirects users to payment page.

API information to retrieve payment URL

POST /v2/gateway/api/create

requestType: Identify the type of the request

HTTP Request
AttributeTypeRequiredDescription
partnerCodeStringIntegration information
partnerNameStringPartner name
storeIdStringStore ID
requestIdString(50)Request ID, unique for each request,
MoMo's partner uses the requestId field for idempotency control
amountLongAmount needs to be paid
Min: 1.000 VND
Max: 10.000.000 VND
Currency: VND
Data type: Long
orderIdStringPartner Transaction ID
Regex: ^[0-9a-zA-Z]([-_.]*[0-9a-zA-Z]+)*$
orderInfoStringOrder's information
redirectUrlStringA partner's URL. This URL is used to redirect from MoMo page to partner's page after customer's payment.
Support: AppLink and WebLink
ipnUrlStringPartner API. Used by MoMo to submit payment results by IPN method (server-to-server) method
requestTypeStringpayWithCC
extraDataStringDefault value is empty ""
Encode base64 follow Jsonformat: {"key": "value"}
Example with data: {"username": "momo"}=> data of extraData: eyJ1c2VybmFtZSI6ICJtb21vIn0=
userInfoObjectInfo of the customer, in which email is required.
autoCaptureBooleanIf set to false, the payment will not be automatically captured.
langStringLanguage of returned message (vi or en)
signatureStringHMAC_SHA256accessKey=$accessKey&amount=$amount&extraData=
$extraData&ipnUrl=$ipnUrl&orderId=$orderId&orderInfo=
$orderInfo&partnerCode=$partnerCode&redirectUrl=$redirectUrl
&requestId=$requestId&requestType=$requestType,secretKey)
Details of userInfo content

If this is provided, customer as MoMo user will be receive a notification or email (by choices).

AttributeTypeRequiredDescription
nameStringName of the customer as registered on merchant site
phoneNumberStringPhone number of the customer as registered on merchant site
emailStringEmail address of the customer as registered on merchant site

Redirecting information (redirectUrl)

WebLink: Links to open website.

AppLink: Link to open mobile application.

Learn more about AppLink

Example request

{
"partnerCode": "MOMO",
"partnerName" : "Test",
"storeId" : "MomoTestStore",
"requestType": "payWithCC",
"userInfo": {

"email": "email_add@domain.com",
}
"ipnUrl": "http://www.example.com",
"redirectUrl": "http://www.example.com",
"orderId": "6d0a1b10-b382-11e9-8fda-91fa25841420",
"amount": 30000,
"lang": "vi",
"orderInfo": "pay with MoMo Credit card",
"requestId": "6d0a1b11-b382-11e9-8fda-91fa25841420",
"extraData": "eyJlbWFpbCI6ICJleGFtcGxlQGdtYWlsLmNvbSJ9",
"signature": "5344e1f4244173fe0ba2b4c865881aad79b86beff8154b4f74f3b92634ffa711"
}
HTTP Response

List of payment methods that MoMo provides:

AttributeTypeRequiredDescription
partnerCodeStringIntegration Information
requestIdStringSame as the original request
orderIdStringPartner Transaction ID
Regex: ^[0-9a-zA-Z]([-_.]*[0-9a-zA-Z]+)*$
amountLongSame as the original payment amount
responseTimeLongTime to respond payment results to partner
Format: timestamp
messageStringError description, error language is based on lang
resultCodeintError code
payUrlStringURL for switching from the partner's page to the MoMo payment page

Example response

{
"partnerCode": "MOMO",
"requestId": "6d0a1b11-b382-11e9-8fda-91fa25841420",
"orderId": "6d0a1b10-b382-11e9-8fda-91fa25841420",
"amount": 30000,
"responseTime": 14547523457,
"message": "Success",
"resultCode": 0,
"payUrl": "https://test-payment.momo.vn/v2/gateway/pay?t=TU9NT1NKSTEyMDE5MDgyM3wxNjEyODQwNTMyNDI3OjAxMjM0NTY3Nzg="
}

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
callbackTokenStringToken info used to get payment token
transIdLongMoMo's transaction ID
resultCodeIntegerOrder status
messageStringdescription of resultCode based on lang
payTypeStringcredit
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

HTTP Response (IPN)

Partner's response to MoMo after MoMo sends HTTP to the address ipnUrl

KeyValueDescription
HTTP HeaderContent-Type: application/json;charset=UTF-8
HTTP Status Code200

HTTP Payload:

Body of the Response

ParameterTypeRequiredDescription
partnerCodeStringIntegration Information
requestIdStringUnique ID of each request
orderIdStringPartner Transaction ID
Regex: ^[0-9a-zA-Z]([-_.]*[0-9a-zA-Z]+)*$
resultCodeintPartner's transaction status code of the order
messageStringPartner's transaction status description
responseTimeLongResponse time
Format: YYYY-MM-DD HH:mm:ss
Time zone: GMT +7
extraDataStringExtra Data
signatureStringHMAC_SHA256accessKey=$accessKey&extraData=$extraData
&message=$message&orderId=$orderId&partnerCode=$partnerCode
&requestId=$requestId&responseTime=$responseTime&resultCode=
$resultCode,secretKey)

For the resultCode and message fields, partner will handle. Refer to the error code of MoMo to return. MoMo will use these information to give feedback to customers if any error occurs in the payment process from partner side.

Result Codes & Messages

Kindly locate result codes and messages of One-time Payment of Credit Card Payments in the comprehensive list of result codes provided here.

See also