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:
- 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) - 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:
- 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) - 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)
Method Type | POST |
---|---|
Staging URL | https://partners-staging.safegold.com/v4/users/{user_id}/buy-gold-verify |
Production URL | https://partners.safegold.com/v4/users/{user_id}/buy-gold-verify |
URL Params
Parameter | Value |
---|---|
user_id | [integer] Example: user_id = 2 |
Request Parameters
Field | Description | Data Type | Length |
---|---|---|---|
rate_id | The rate_id which was passed by SafeGold in the response of Live Buy Price API. | Numeric | Auto-incremental ID generated By SafeGold system |
gold_amount | Gold Amount corresponding to the Buy Price (Pre-GST Buy Price). | Numeric | Decimal(15,4) |
buy_price | The final Amount which End Customer has to pay (Post - GST Buy Price). | Numeric | Decimal(15,2) |
Success 200 Response Parameters
Field | Description |
---|---|
tx_id | Unique Transaction ID provided by SafeGold which will be passed to the next endpoint to confirm the transaction. |
rate_id | The rate_id was passed by SafeGold in the response of Live Buy Price API. |
sg_rate | The Buy Rate which SafeGold has published for the Distributor after adding the final Markup |
gold_amount | Gold Amount corresponding to the Buy Price (Pre-GST Buy Price). |
buy_price | The final Amount which Customer has to pay (Post - GST Buy Price). |
pre_gst_buy_price | The Price is exclusive of GST corresponds to the gold_amount provided to the customer. |
gst_amount | The GST amount corresponding to 3% on the buy_price. |
user_id | Customer’s User ID |
Failure Parameters
Status Code | Code | Code Description |
---|---|---|
HTTP Status 400 | ||
1 | Missing required information | |
2 | SG rate does not match current rate | |
4 | Gold Amount does not match | |
6 | Balance above KYC identity limit | |
7 | Balance above PAN limit | |
8 | Invalid 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
- 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.
- 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.