const payload = {}
payload['version'] = '1.0'
payload['autoRedirect'] = false
payload['transactionId'] = ORDER_ID_IN_YOUR_SYSTEM
payload['transactionType'] = 'pay'
payload['transactionExpirationTime'] = 14400
payload['appId'] = YOUR_APP_ID
payload['amount'] = 1234
payload['currency'] = 'USD'
payload['terminalType'] = 'WEB'
const userInfo = {
userId: USER_ID_IN_YOUR_SYSTEM,
phoneNo: USER'S_PHONE_NO,
email: USER'S_EMAIL,
ip: USER'S_IP
}
payload['userInfo'] = JSON.stringify(userInfo)
const payerInfo = {
paymentMethod: 'credit_card',
authorizationMethod: 'cvv'
}
const billingAddress = {}
billingAddress['houseNo'] = CUSTOMER'S_HOUSE_NO
billingAddress['email'] = CUSTOMER'S_EMAIL
billingAddress['phoneNo'] = CUSTOMER'S_PHONE_NO
billingAddress['firstName'] = CUSTOMER'S_FIRST_NAME
billingAddress['lastName'] = CUSTOMER'S_LAST_NAME
billingAddress['street'] = CUSTOMER'S_STREET
billingAddress['postalCode'] = CUSTOMER'S_POSTAL_CODE
billingAddress['city'] = CUSTOMER'S_CITY
billingAddress['state'] = CUSTOMER'S_STATE
billingAddress['country'] = CUSTOMER'S_COUNTRY // ISO 3166-1-alpha-2
payerInfo['billingAddress'] = billingAddress
payload['payerInfo'] = JSON.stringify(payerInfo)
const orderInfo = {
subject: ORDER_SUBJECT_IN_YOUR_SYSTEM,
}
const goodsInfo = Array()
goodsInfo.push(
{
id: SKU_ID_IN_YOUR_SYSTEM,
name: PRODUCT_NAME,
price: PRICE,
quantity: QUANTITY,
url: PRODUCT_LINK,
image: IMAGE_OF_PRODUCT
},
{
id: SKU_ID_IN_YOUR_SYSTEM,
name: PRODUCT_NAME,
price: PRICE,
quantity: QUANTITY,
url: PRODUCT_LINK,
image: IMAGE_OF_PRODUCT
},
)
const shippingAddress = {}
shippingAddress['houseNo'] = CUSTOMER'S_HOUSE_NO
shippingAddress['email'] = CUSTOMER'S_EMAIL
shippingAddress['phoneNo'] = CUSTOMER'S_PHONE_NO
shippingAddress['firstName'] = CUSTOMER'S_FIRST_NAME
shippingAddress['lastName'] = CUSTOMER'S_LAST_NAME
shippingAddress['street'] = CUSTOMER'S_STREET
shippingAddress['postalCode'] = CUSTOMER'S_POSTAL_CODE
shippingAddress['city'] = CUSTOMER'S_CITY
shippingAddress['state'] = CUSTOMER'S_STATE
shippingAddress['country'] = CUSTOMER'S_COUNTRY // ISO 3166-1-alpha-2
orderInfo['goodsInfo'] = goodsInfo
orderInfo['shippingAddress'] = shippingAddress
payload['orderInfo'] = JSON.stringify(orderInfo)
payload['signType'] = YOUR_CHOOSED_SIGN_TYPE
payload['merchantNo'] = YOUR_MERCHANT_NO
payload['notifyUrl'] = ASYNC_NOTIFY_URL
payload['echoParam'] = ECHO_PARAM
payload['sign'] = SIGN_VALUE