Create, sign, and submit a payment

Create and a payment transaction, and submit it to the XAG Ledger network. The sending account must match an account address and secret the XAG-API server is configured with.

Warning: XAG-API is early alpha software. API methods and data formats are likely to change frequently in ways that break backwards compatibility.

Request Format

POST /payments

{
    "payment": {
        "source_tag": 123,
        "destination_tag": 456,
        "source_amount": {
            "value": "5000000",
            "currency": "drops"
        },
        "source_address": "rBEXjfD3MuXKATePRwrk4AqgqzuD9JjQqv",
        "destination_address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
        "destination_amount": {
            "value": "5000000",
            "currency": "drops"
        }
    },
    "submit": true
}

A transaction object and instructions.

Media type: application/json

Formatted as a Payment object and instructions

The request uses the following fields:

Field Type Required? Description
payment Object (Payment Object) May be omitted A payment object (specification).
instructions Object (Transaction Instructions) May be omitted Indicates how to execute a transaction. Complements the transaction specification.
submit Boolean May be omitted If false, the server will not submit the transaction to the network. Instead, it will only return the following additional fields in the response: tx_json, tx_blob, and id (hash).

Response Formats

400 Bad Request

The request was not properly formatted.

Media type: application/json

Formatted as a RippleAPIError

The response uses the following fields:

Field Type Required? Description
errors Array of ErrorItem May be omitted A list of errors that occurred when processing this request.
message String May be omitted A human-readable error message summarizing the problem(s) that occurred.

200 OK

A successful response provides the native XAG Ledger format for the transaction, the transaction's identifying hash, and the preliminary result of processing the transaction.

Media type: application/json

Formatted as a TransactionStatus

The response uses the following fields:

Field Type Required? Description
open_ledger_cost String May be omitted The current open ledger cost before processing this transaction. Transactions with a lower cost are likely to be queued.
accepted Boolean May be omitted The value true indicates that the transaction was applied, queued, broadcast, or kept for later. The value false indicates that none of those happened, so the transaction cannot possibly succeed as long as you do not submit it again and have not already submitted it another time. (Requires rippled v1.5.0+)
queued Boolean May be omitted The value true indicates the transaction was put in the Transaction Queue, which means it is likely to be included in a future ledger version.
account_sequence_next Number May be omitted The next Sequence Number for the sending account after all transactions that have been provisionally applied, but not transactions in the queue.
engine_result_code Integer May be omitted Numeric code indicating the preliminary result of the transaction, directly correlated to engine_result.
engine_result String May be omitted Code indicating the preliminary result of the transaction, for example tesSUCCESS. Not final until included in a fully validated TransactionResult.
tx_json Object (Transaction Common Fields) May be omitted The fields that are common to all transactions.
tx_blob String May be omitted The complete transaction in hex string format.
applied Boolean May be omitted The value true indicates that this transaction was applied to the open ledger. In this case, the transaction is likely, but not guaranteed, to be validated in the next ledger version.
broadcast Boolean May be omitted The value true indicates that this transaction was applied to the open ledger. In this case, the transaction is likely, but not guaranteed, to be validated in the next ledger version.
kept Boolean May be omitted The value true indicates that the transaction was kept to be retried later.
account_sequence_available Number May be omitted The next Sequence Number available for the sending account after all pending and queued transactions.
engine_result_message String May be omitted Human-readable explanation of the transaction's preliminary result.
validated_ledger_index Integer May be omitted The ledger index of the newest validated ledger at the time of submission. This provides a lower bound on the ledger versions that the transaction can appear in as a result of this request. (The transaction could only have been validated in this ledger version or earlier if it had already been submitted before.)