One time purchases w/ Old APIs

Facilitate lumpsum investments for your investor

Ensure the following before placing a purchase order
  1. Your investor is kyc compliant
  2. You have an investment account created for your investor

Once you have the investor and investment account created, follow the below steps to place a purchase order.

  1. Create a purchase order
  2. Make payment
  3. Check the order status

1. Create a purchase order

Some funds are not allowed for purchases and some might temporarily stop accepting purchase orders. Make sure you check the purchase_allowed field is true for the fund scheme(s) you are placing the order for, using the Get fund scheme .

The order creation varies slightly depending on how will the payment be made for that.

For payment modes: Internet Banking, UPI
Call the Create order with the following json. Use the id of the bank account from which the investor will make the payment for this purchase. You would have got the bank_account_id from the create investor api call earlier.

{
  "bank_account_id": 1,
  "orders": [
    {
      "isin": "INF109K01VQ1",
      "amount": 500
    }
  ]
}

For payment modes: NACH auto debit
Call the Create order with the following json. Use the id of the mandate authorised by the investor using which the payment for this purchase will be pulled. Learn how to setup nach mandates.

{
  "mandate_id": 1,
  "orders": [
    {
      "isin": "INF109K01VQ1",
      "amount": 500
    }
  ]
}

A purchase order gets created for which you need to make a payment. Keep a note of the order id; that is an identifier to use for making payments and checking the status of the order later on.

{
  "orders": [
    {
      "id": 167,
      "isin": "INF109K01VQ1",
      "isin_no": "INF109K01VQ1",
      "source_ref_id": null,
      "user_ip": "10.240.0.7",
      "server_ip": "127.0.0.1"
    }
  ]
}

2. Make payment

To make a payment using internet banking or upi, make a request to create payment with the following json. Use the order id from the previous api response.

{
  "amc_order_ids": [167]
}

Look for token_url in the response and redirect your investor to it to complete his payment. After your investor finishes the payment, FP redirects him to the postback URL configured on your account or to the payment_postback_url provided in the request. You'll receive success or failure in the status param. As a good security practice, do not completely rely on the status received in the postback call. Instead check the status of the payment from your server before giving a final confirmation to your investor.
Learn more about payment states.

3. Check the order status

Call the get order to check the status of the order.
When the payment is successful, the order status becomes PAYMENT_CONFIRMED. Learn more about the order states

In live environment, orders in "PAYMENTCONFIRMED" state will be submitted to AMCs eventually and will be marked as "SUBMITTED". In staging environment, you can use the simulation APIs to mark a "PAYMENTCONFIRMED" order as "SUBMITTED". Distributors will get mailback reports from RTAs for the orders placed. When these transaction feeds(aka reverse feeds) are uploaded, orders will get marked as SUCCESSFUL or FAILED depending upon the transaction status present in transaction feed files. For more details please refer Transactions doc. However, in staging environments you can mimic this behavior using simulation apis as shown below.

Testing

You can use the simulation to simulate successful and failed orders to help you during the integration process. Use the following json to simulate the order to successful state.

{
  "status": "SUCCESSFUL"
}