This endpoint will let the Distributor create a transaction (to buy gold). This will return the tx_id, which has to be passed to the next endpoint to confirm the transaction. Post the success of the Buy Verify Method, the customer will proceed to complete the payment for the particular Buy transaction.


Buy Calculation Steps

Scenario 1: The customer enters the gold to be bought in Rupees

Eg: Buy Price through API: Rs.2953.63/- (Exclusive of GST of 3%)
Let’s say the customer enters Rs.1000/-

Calculation steps:

  1. First Calculate the Rate including GST and round to two decimals.
    i.e 2953.63*1.03 = 3,042.2389 = 3042.24 (Rate including GST, Rounded up to 2 decimals)
  2. Calculate the Gold Weight from the Entered Price by the Customer and the Buy Rate (inclusive of GST) and round to four decimals. I.e 1000/3042.24 = 0.32870516461 = 0.3287 gms (Rounded down to 4 decimals)

Scenario 2: The customer enters the gold to be bought in Grams

Eg : Buy Price through API : Rs.2953.63/- (Exclusive of GST of 3%)
Let’s say customer enters 0.2345 grams

Calculation steps:

  1. First Calculate the Rate including GST and round to two decimals
    i.e 2953.63*1.03 = 3,042.2389 = 3042.24 (Rate including GST, Rounded up to 2 decimals)
  2. Calculate the Amount from the Entered Grams by the Customer and the Buy Rate (inclusive of GST) and round to 2 decimals. i.e 0.2345*3042.24 = 713.40528 = Rs. 713.41 (Rounded up to 2 decimals)


URL Params

ParameterValue
user_id[integer]
Example: user_id = 2

Request Parameters

FieldDescriptionData TypeLength
rate_idThe rate_id which was passed by SafeGold in the response of Live Buy Price API.NumericAuto-incremental ID generated By SafeGold system
gold_amountGold Amount corresponding to the Buy Price (Pre-GST Buy Price).NumericDecimal(15,4)
buy_priceThe final Amount which End Customer has to pay (Post - GST Buy Price).NumericDecimal(15,2)

Success 200 Response Parameters

FieldDescription
tx_idUnique Transaction ID provided by SafeGold which will be passed to the next endpoint to confirm the transaction.
rate_idThe rate_id was passed by SafeGold in the response of Live Buy Price API.
sg_rateThe Buy Rate which SafeGold has published for the Distributor after adding the final Markup
gold_amountGold Amount corresponding to the Buy Price (Pre-GST Buy Price).
buy_priceThe final Amount which Customer has to pay (Post - GST Buy Price).
pre_gst_buy_priceThe Price is exclusive of GST corresponds to the gold_amount provided to the customer.
gst_amountThe GST amount corresponding to 3% on the buy_price.
user_idCustomer’s User ID

Failure Parameters

Status CodeCodeCode Description
HTTP Status 400
1Missing required information
2SG rate does not match current rate
4Gold Amount does not match
6Balance above KYC identity limit
7Balance above PAN limit
8Invalid Rate

Post the success of the Buy Verify API, the Distributor will call the Buy Confirm API bypassing the User ID in the URL and by sending the transaction ID as a request which was given by SafeGold in the Buy Verify API.


📘

Points to Remember

  1. After successfully request a transaction ID (tx_id) will be generated and the user must copy this tx_id as it will be needed for the rest of the APIs in the Buy Flow.
  2. A default user is provided for performing the Buy Flow but a different user can be used for the same by changing the user_id. New user can also be added using the Registration API.
Language
Click Try It! to start a request and see the response here!