Initiate Transaction API
Flow diagram
Flow diagram for payment processing via API
Use Case
This API will be used to create a transaction
Request
POST /v2/payments
| Parameter | Type | Required | Description | 
|---|---|---|---|
| merchantId | Fundiin provides MID as a unique identifier to each merchant. | ||
| referenceId | Unique identifier generated by the merchant for this charge transaction REGEX: ^[0-9a-zA-Z_:-]60$ | ||
| storeId | The store Id that is processing the payment | ||
| platformId | The platform Id that is processing the payment (platform including any third party that provide order/payment services to Merchant) | ||
| requestType | installment | ||
| lang | Language of returned message(vioren), If not included, the default isen. | ||
| extraData | Additional data, defined by Merchant | ||
| paymentMethod | APP,POS,WEB. | ||
| terminalType | The terminal type of which the merchant service applies to. DESKTOP_BROWSER,MOBILE_BROWSER,MOBILE_APP | ||
| description | Description for the order. | ||
| successRedirectUrl | Redirect to this url after successful | ||
| unSuccessRedirectUrl | Redirect to this url after unsuccessful | ||
| amount.value | The amount of the transaction | ||
| amount.currency | VND | ||
| installment | InstallmentInfo | ||
| items | Maximum: 200 items. Items | ||
| customer | User information contains user details like email, phone number etc. Customer Info | ||
| seller | Seller information contains seller details like email, phone number etc. Seller Info | ||
| shipping | This contain the shipping info for an order. Shipping Info | ||
| transExpiredTime | The maximum time for user to complete payment, in millisecond | ||
| sendSms | Flag whether SMS to be sent to customer by Fundiin. | ||
| sendEmail | Flag whether Email to be sent to customer by Fundiin. | 
Data of installment
| Attribute | Type | Required | Description | 
|---|---|---|---|
| packageId | 
Data of each items
| Attribute | Type | Required | Description | 
|---|---|---|---|
| productId | The Id of item. | ||
| productName | The name of item. | ||
| description | The description of item. | ||
| category | The type of item. | ||
| currency | VND | ||
| quantity | Quantity number of each item. It must be greater than 0 | ||
| price | Price of single unit item | ||
| totalAmount | pricexquantity | ||
| imageUrl | Link image of product. | 
Data of customer
| Attribute | Type | Required | Description | 
|---|---|---|---|
| phoneNumber | Mobile number of user. number must have size equals 10 or 11. 096, 0164 | ||
| rank | Customer segmentation. | ||
| description | Description of the customer. | ||
| Valid email of the user. | |||
| firstName | The first name. | ||
| lastName | The last name. | ||
| gender | The following values are permitted: M: Male,F: Female,U: UNKNOWN. | ||
| dateOfBirth | The customer's date of birth. Format ISO-8601: DD-MM-YYYY | 
Data of seller
| Attribute | Type | Required | Description | 
|---|---|---|---|
| id | Seller Id, Unique identifier generated by the merchant for this seller | ||
| Valid email of the user. | |||
| name | Seller Name. | ||
| address | Address of seller | 
Data of shipping
| Attribute | Type | Required | Description | 
|---|---|---|---|
| city | The city of address Shipping. | ||
| zipCode | The zipCode of address Shipping. | ||
| district | The district of address Shipping. | ||
| ward | The ward of address Shipping. | ||
| street | The street of address Shipping. | ||
| streetNumber | The streetNumber of address Shipping. | ||
| houseNumber | The houseNumber of address Shipping. | ||
| houseExtension | The houseExtension of address Shipping. | ||
| country | The country of address Shipping. | 
Example Request
{
    "merchantId": "Your merchant code",
    "referenceId": "Your order number",
    "storeId": "Your store id",
    "requestType": "onetime",
    "patmentMethod": "paymentMethod",
    "lang": "vi",
    "extraData": "jsonstring", 
    "description": "description", 
    "successRedirectUrl": "domain.com",
    "unSuccessRedirectUrl": "domain.com",
    "installment": {
        "packageId": "packageId"
    },
    "amount": {
        "currency": "VND",
        "value": 400000
    },
    "items": [
        {
            "productId": "170594",
            "productName": "clothes",
            "description": "Red",
            "quantity": 2,
            "price": 200000,
            "currency": "VND",
            "totalAmount": 400000
        }
    ],
    "customer": {
        "phoneNumber": "0912345678",
        "email": "youremail@email.com",
        "firstName": "Doe",
        "lastName": "Test",
        "gender": "F",
        "dateOfBirth": "17-04-1999"
    },
    "shipping": {
        "city": "Ho Chi Minh",
        "zipCode": "00700",
        "district": "5",
        "ward": "",
        "street": "Tran Nhan Ton",
        "streetNumber": "Apt 214",
        "houseNumber": null,
        "houseExtension": null,
        "country": "VN"
    }
}
Response
| Parameter | Type | Required | Description | 
|---|---|---|---|
| merchantId | Identification of the merchant that was issued when registering with Fundiin. | ||
| referenceId | Order number for the charge transaction. | ||
| responseTime | Date & Time of response: Format: YYYY-MM-DD hh:mm:ss | ||
| resultStatus | Result status | ||
| resultMsg | The result message which contains information about the result. | ||
| paymentUrl | Payment URL | ||
| qrData | Qr Code Data | 
By default expiry time for the order created is 30 minutes from order creation time stamp. If this needs to be extended for more than 30 minutes please contact Fundiin.
{
    "merchantId": "FundiinVN",
    "referenceId": "Your order number",
    "responseTime": "2023-07-24 09:33:55",
    "resultMsg": "Thành công",
    "resultStatus": "APPROVED",
    "paymentUrl": "https://fundiin.vn/v2/payment",
    "qrData": "https://fundiin.vn/v2/payment"
}
Result Status & Messages
| Status code | Description | Action to take | 
|---|---|---|
| APPROVED | The transaction was successfully initialized. | Proceed with the transaction as normal. | 
| ACCESS_DENIED | Access denied. | Please check your settings in the merchant portal or contact Fundiin for configurations. | 
| INVALID_REQUEST | Invalid request. e.g., Invalid currency, invalid amount, etc. | Ensure that the request parameters are correct and meet the API requirements. | 
| INVALID_REFERENCE_ID | The referenceId is invalid. | Please retry with a different referenceId. | 
| INVALID_STORE_ID | The storeId is invalid. | Please retry with a correct storeId. | 
| DUPLICATE_REFERENCE_ID | The referenceId is duplicated. | You can inquire about this referenceId in transaction status, or retry with a different referenceId. | 
| INVALID_CLIENT_ID | The clientId is not registered. | Make sure to use a valid and registered clientId for the request. | 
| INVALID_SIGNATURE | The signature is invalid. | Double-check the signature generation process to ensure its correctness. | 
| INVALID_MERCHANT_ID | The merchant is not registered. | Ensure that the merchant ID is correct and registered with Fundiin. | 
| INVALID_HTTP_METHOD | The server does not implement the requested HTTPS method. | Use the correct HTTP method (e.g., GET, POST, etc.) when making the request. | 
| INVALID_API | API is not defined. | Check whether the request URL is correct. Ensure that the endpoint of the called API is correct. | 
| INVALID_AMOUNT | Payment amount is invalid. | Verify the payment amount and provide a valid amount. | 
| PHONE_NUMBER_UNAVAILABLE | Phone number is unavailable. | Make sure the length of the phone number equals 10 or 11. | 
| PHONE_NUMBER_INVALID | Phone number is invalid. | Provide a valid phone number. | 
| AMOUNT_EXCEEDED_UPPER_LIMIT | The payment amount exceeds the limit at the merchant level or account level. | Adjust the payment amount to be within the specified limit. | 
| AMOUNT_BELOW_MINIMUM_LIMIT | The payment amount is below the minimum limit. | Increase the payment amount to meet the minimum limit. | 
| REQUEST_PROCESSING | The request has already been processed or is in progress. | Monitor the transaction status or take appropriate action based on the current progress. | 
| DOWNSTREAM_ERROR | Partner downstream timeout. (Retriable) | Retry the request later, as the error might be temporary due to partner-related issues. | 
| ERROR_GENERAL | Declined due to general reasons other than the specific decline error codes provided. | Contact Fundiin support for assistance in identifying and resolving the general issue. |