Receiving Payments#

The following diagram presents an overview of how Supply-Side Platform receives payments from corresponding Demand-Side Platforms:

skinparam monochrome true

actor       "Publisher"                 as publisher
participant "Ad Select\nModule"         as ASM
participant "Supply-Side\nPlatform"     as SSP
participant "ADS Blockchain"            as blockchain
collections "Demand-Side\nPlatforms"    as DSP

loop periodically
    SSP -> blockchain: Fetch transactions
    blockchain --> SSP: List of transactions
    SSP -> SSP: Analyze transactions

    SSP -> DSP: Fetch Payment Report
    DSP --> SSP: Payment Report
    SSP -> ASM: Analyze\nPayment Report
end
SSP -> publisher: Collect funds

Supply-Side Platform is expected to scan ADS Blockchain for incoming ADS transfers.

If an incoming payment is detected, Supply-Side Platform calls the appropriate Demand-Side Platform to receive the corresponding Payment Report.

The received Payment Report allows Supply-Side Platform to observe which Demand-Side Platforms, which Impression Events and which Conversion Events are generating the most income.

This incentivizes a given Supply-Side Platform (and its Ad Select Module) to continue choosing the same Demand-Side Platform in the future.

Also, it’s important to note that Ad Select Module needs to be kept updated about payments received by Supply-Side Platform from various Demand-Side Platforms, as this information might affect its future decisions on choosing Creatives from a particular Demand-Side Platform.

Scan the blockchain for payments#

Scanning is done by retrieving an account’s log with the get_log command.

In the log, extract inbound payments by searching for entries with type (send_many || send_one) and inout equal in.

Take note of the following fields:

  • $transactionId = $logEntry[‘id’]

  • $amount = $logEntry[‘amount’]

  • $address = $logEntry[‘address’]

Note

It’s recommended to store the timestamp of the last event in order to limit the log size during a subsequent call.

Validate transaction#

Retrieve blockchain data using the get_block command.

Fetch valid transaction data using the get_transaction command.

Extract type - it should match (send_many || send_one).

For more details, refer to this section of the documentation: How to check incoming transactions