Pular para o conteúdo

Create quote to return payment

Requisição

Creates a collection of quotes that can be used to return a payment.

The receiver can make this request while the payment is in states EXECUTED, COMPLETED, or FAILED. When the returned payment is successfully moved to the COMPLETED state, the original payment is moved to the RETURNED state.

Note: Currently, when making a Return Payment to a RippleNet Cloud account on a RippleNet ledger, the RippleNet user must lock and complete the payment. This means that the RippleNet user takes all action on the return: Get and Accept Quote, Lock, Settle, and Complete payment.

Segurança
Bearer
Corpoapplication/jsonobrigatório
original_payment_idstring, (uuid)obrigatório

ID of the original payment to be returned.

Exemplo:"d485f100-2af7-4e48-9ab1-3c7e28775691"
return_reasonsobject

Object with key and value pairs that describe the reason the payment is being returned.

The fields should contain the following key values: reason, code, and type.

These values are included in a payment created from a quote in the response. They are included in the user_info.returned array for the node sending the return payment.

Exemplo:
{ "REASON": "Wrong receiving amount", "TYPE": "Account Error", "CODE": "A-999" }
return_amount_typestring

Amount type of the return payment.

To indicate that the sender of the return payment will send the amount it received, set to TOTAL_RECEIVED.

To indicate that the sender of the return payment will send the amount it received minus its receiving fees, set to TOTAL_RECEIVED_MINUS_FEES.

Padrão:"TOTAL_RECEIVED"
Enum:"TOTAL_RECEIVED""TOTAL_RECEIVED_MINUS_FEES"
Exemplo:"TOTAL_RECEIVED_MINUS_FEES"
custom_feenumber

Custom fee charged and collected by the sending account. Setting this field overrides all applicable fees configured on the sender's RippleNet instance.

custom_rateobject

Custom rate that the return payment quotes must use. The request returns only quotes that are able to provide this custom rate.

force_path_finding_and_liquidity_path_findingboolean

When true, this flag tells RippleNet to ignore cached value for path finding and liquidity path finding and perform new path finding and liquidity path finding.

Padrão:false
Exemplo:false
receiver_addressstring

The desired receiving account for the return payment as a RippleNet address. This account must be owned by the original payment's sender.

Exemplo:"sf@rn.us.ca.san_francisco"
curl -i -X POST \
  https://docs.ripple.com/_mock/pt-br/products/payments-odl/api-docs/ripplenet/ripplenet/quote_collections/return \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "original_payment_id": "d485f100-2af7-4e48-9ab1-3c7e28775691",
    "return_reasons": {
      "REASON": "Wrong receiving amount",
      "TYPE": "Account Error",
      "CODE": "A-999"
    },
    "return_amount_type": "TOTAL_RECEIVED_MINUS_FEES",
    "custom_fee": 0,
    "custom_rate": {
      "rate": 0,
      "base_currency": "string",
      "counter_currency": "string",
      "rate_type": "buy"
    },
    "force_path_finding_and_liquidity_path_finding": false,
    "receiver_address": "sf@rn.us.ca.san_francisco"
  }'

Respostas

Successfully returned a collection of quotes to return a payment.

Corpoapplication/json
quote_collection_idstring, (uuid)obrigatório

Unique identifier of the quote collection.

Exemplo:"4711728c-cd35-49ec-96a5-72732b4333ec"
quotesArray of objectsobrigatório

For more information on quote elements, see Create quote collections.

quote_errorsArray of objects
Resposta
{ "quote_collection_id": "4711728c-cd35-49ec-96a5-72732b4333ec", "quotes": [ { … } ], "quote_errors": [ { … } ] }