Stellar PHP SDK API Documentation

SEP08PostTransactionResponse

AbstractYes

Abstract base class for all approval server transaction responses.

After submitting a transaction to an approval server via POST /tx_approve, the server responds with one of five possible statuses defined by SEP-0008:

  • success: Transaction approved and signed without revision (SEP08PostTransactionSuccess)
  • revised: Transaction modified for compliance and signed (SEP08PostTransactionRevised)
  • pending: Approval decision delayed, retry later (SEP08PostTransactionPending)
  • action_required: User action needed before approval (SEP08PostTransactionActionRequired)
  • rejected: Transaction cannot be made compliant (SEP08PostTransactionRejected)

This class provides a factory method to parse JSON responses and instantiate the appropriate concrete response class based on the status field. Wallets should use instanceof checks to determine the response type and handle accordingly.

HTTP Status Codes:

  • 200: success, revised, pending, action_required
  • 400: rejected
Tags
see
https://github.com/stellar/stellar-protocol/blob/v1.7.4/ecosystem/sep-0008.md#responses

SEP-0008 v1.7.4 Responses

Table of Contents

Methods

fromJson()  : SEP08PostTransactionResponse
Factory method to construct a transaction response object from JSON data.

Methods

fromJson()

Factory method to construct a transaction response object from JSON data.

public static fromJson(array<string|int, mixed> $json) : SEP08PostTransactionResponse

Parses the JSON response from an approval server and instantiates the appropriate concrete response class based on the 'status' field value.

Status Mapping:

  • "success" -> SEP08PostTransactionSuccess
  • "revised" -> SEP08PostTransactionRevised
  • "pending" -> SEP08PostTransactionPending
  • "action_required" -> SEP08PostTransactionActionRequired
  • "rejected" -> SEP08PostTransactionRejected
Parameters
$json : array<string|int, mixed>

Decoded JSON response from approval server

Tags
throws
SEP08InvalidPostTransactionResponse

If status field is missing, unknown, or required fields for the given status are missing

Return values
SEP08PostTransactionResponse

Concrete subclass instance based on status field


        
On this page

Search results