This endpoint will let the Distributor create a transaction (to sell gold). This will return the tx_id, which has to be passed to the next endpoint to confirm the transaction.

### Sell Price Calculation Steps

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/-

Calculation steps:

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

Calculation steps:

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)

#### URL Params

ParametersValue
user_id[integer]
Example: user_id = 2

#### Request Parameters

FieldDescriptionData TypeLength
rate_idThe rate_id which was passed by SafeGold in the response of Life Sell Price API.NumericAuto-incremental ID generated by SafeGold system.
gold_amountGold Amount corresponding to the Sell Price.NumericDecimal(15,4)
sell_priceThe final amount which End Customer will receive corresponding to the Gold AmountNumericDecimal(15,4)

#### Success 200 Response Parameters

FieldDescription
tx_idUnique Transaction ID provided by SafeGold which will be passed to the next endpoint to confirm the transaction.
rateThe Sell Rate which SafeGold has published for the Distributor.
rate_idThe rate_id was passed by SafeGold in the response of Live Sell Price API.
gold_amountGold Amount corresponding to the Sell Price.
sell_priceThe final Amount which End Customer will receive corresponding to the Gold Amount.

#### Failure Parameters

Status CodeCodeCode Description
HTTP Status 400
1Missing required information
2Rate does not match current rate
3User not registered
4Insufficient Balance
5Gold Amount does not match
6Invalid Rate

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

1. The current_price from Sell Price API must be sent as a parameter as rate for this API.
2. 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.
3. 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.
4. 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!