EMI Calculator
  • 26 Feb 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light

EMI Calculator

  • Dark
    Light

Article summary

API Function: EMICalculationRequest

Description:

This function processes a request for calculating installment (EMI) details based on the provided parameters.


Request $request: HTTP request object containing parameters.

  • amount: The total amount for which the EMI is to be calculated.

  • type: Specifies whether the calculation is based on time or rate.

  • value: The value corresponding to the type, i.e., either the number of months or the desired installment rate.

use Stegback\Ratepay\Services\RatepayInstallmentApi;

{
   $object = new RatepayInstallmentApi;
   $response = $object->EMICalculationRequest($request);
}

Response for EMI Calculation

{
"attributes": {
"version": "1.0"
},
"head": {
"system-id": {
"value": "myshop"
},
"operation": {
"attributes": {
"subtype": "calculation-by-time"
},
"value": "CALCULATION_REQUEST"
},
"response-type": {
"value": "INSTALLMENT_PLAN"
},
"external": [],
"processing": {
"timestamp": {
"value": "2024-02-26T10:04:40.000"
},
"status": {
"attributes": {
"code": "OK"
},
"value": "Successfully"
},
"reason": {
"attributes": {
"code": "603"
},
"value": "Calculation reason: FULFILLED_CONDITION: The payment plan fulfilled the conditions."
},
"result": {
"attributes": {
"code": "502"
},
"value": "Calculation successful"
}
}
},
"content": {
"installment-calculation-result": {
"total-amount": {
"value": "1130.88"
},
"amount": {
"value": "1099"
},
"interest-amount": {
"value": "31.88"
},
"service-charge": [],
"interest-rate": {
"value": "13.5"
},
"annual-percentage-rate": {
"value": "13.7"
},
"monthly-debit-interest": {
"value": "1.06"
},
"number-of-rates": {
"value": "4"
},
"rate": {
"value": "282.73"
},
"last-rate": {
"value": "282.69"
},
"payment-firstday": {
"value": "2"
}
}
}
}For EMI Payment Request

Parameters:

  • $data: An array containing necessary data for processing the payment request.

    • method: The payment method, which could be "INSTALLMENT" for EMI or other methods.

    • device_token: Unique token representing the device.

    • Additional parameters specific to the payment request.

Additional Required Parameters for EMI Payment:

  • <payment>: XML segment containing payment details.

    • method: Payment method, which is "INSTALLMENT" for EMI.

    • amount: Total amount of the payment.

    • installment-number: Number of installments.

    • installment-amount: Amount of each installment.

    • last-installment-amount: Amount of the last installment (if different).

    • interest-rate: Interest rate for the EMI.

    • payment-firstday: First payment date.

      You need to send this extra details in same array which you define at the time of payment request previously.

      use Stegback\Ratepay\Services\RatepayApi;
      {
           $ratepay = new RatepayApi;
           $response = $object->paymentRequest($requestData);
      }


Was this article helpful?