Scenario 1: The customer enters the gold to be sold in Rupees
Eg: Buy Price through API: Rs.2953.63/- (Exclusive of GST of 3%)
Let’s say the customer enters Rs.1000/-
Calculate the Gold Weight from the Entered Price by the Customer and the Sell Rate and round to four decimals. I.e 1000/2953.63 = 0.3385664419714047 = 0.3385 grams (Rounded down to 4 decimals)
Scenario 2: The customer enters the gold to be sold in Grams
Eg: Seek Price through API: Rs.2953.63/- (Exclusive of GST of 3%)
Let’s say the customer enters 0.2345 grams
Calculate the Amount from the Entered Grams by the Customer and the Sell Rate and round to 2 decimals. i.e 0.2345*2953.63 = 692.626235 = Rs.692.63 (Rounded up to 2 decimals)
Example: user_id = 2
|rate_id||The rate_id which was passed by SafeGold in the response of Life Sell Price API.||Numeric||Auto-incremental ID generated by SafeGold system.|
|gold_amount||Gold Amount corresponding to the Sell Price.||Numeric||Decimal(15,4)|
|sell_price||The final amount which End Customer will receive corresponding to the Gold Amount||Numeric||Decimal(15,4)|
|tx_id||Unique Transaction ID provided by SafeGold which will be passed to the next endpoint to confirm the transaction.|
|rate||The Sell Rate which SafeGold has published for the Distributor.|
|rate_id||The rate_id was passed by SafeGold in the response of Live Sell Price API.|
|gold_amount||Gold Amount corresponding to the Sell Price.|
|sell_price||The final Amount which End Customer will receive corresponding to the Gold Amount.|
|Status Code||Code||Code Description|
|HTTP Status 400|
|1||Missing required information|
|2||Rate does not match current rate|
|3||User not registered|
|5||Gold Amount does not match|
SafeGold will validate the Sell Rate, Gold Amount, Sell Price sent by the Distributor. SafeGold will also validate whether the User has sufficient Gold Balance. If all the validations match, SafeGold will create a transaction ID and send it as a response to the Distributor as mentioned in the API above and the Customer would be redirected to Confirmation Page.
Post the Success of the Sell Verify API, the Distributor will call the Sell 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 Sell Verify API.
Points to remember
- The current_price from Sell Price API must be sent as a parameter as rate for this API.
- 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 Sell Flow.
- This API is the starting point of a sell transaction. The rate of this API must be same as current_price of Sell Price API's response.
- 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.