List Strict Receive Payment Paths
The strict receive payment path endpoint lists the paths a payment can take based on the amount of an asset you want the recipient to receive. The destination asset amount stays constant, and the type and amount of an asset sent varies based on offers in the order books.
For this search, Horizon loads a list of assets available to the sender (based on source_account or source_assets) and displays the possible paths from the different source assets to the destination asset. Only paths that satisfy the destination_amount are returned.
curl https://horizon-testnet.stellar.org/paths/strict-receive?\
source_assets=CNY:GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX&\
destination_asset_type=credit_alphanum4&\
destination_asset_code=BB1&\
destination_asset_issuer=GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN&\
destination_amount=5
var StellarSdk = require("stellar-sdk");
var server = new StellarSdk.Horizon.Server(
"https://horizon-testnet.stellar.org",
);
server
.strictReceivePaths(
[
new StellarSdk.Asset(
"CNY",
"GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
),
],
new StellarSdk.Asset(
"BB1",
"GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
),
"5",
)
.call()
.then(function (resp) {
console.log(resp);
})
.catch(function (err) {
console.error(err);
});
from stellar_sdk import Server, Asset
server = Server("https://horizon-testnet.stellar.org")
response = server.strict_receive_paths(
source=[
Asset("CNY", "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX")
],
destination_asset=Asset(
"BB1",
"GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN"
),
destination_amount="5"
).call()
print(response)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://horizon-testnet.stellar.org/paths/strict-receive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://horizon-testnet.stellar.org/paths/strict-receive"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://horizon-testnet.stellar.org/paths/strict-receive")
.asString();require 'uri'
require 'net/http'
url = URI("https://horizon-testnet.stellar.org/paths/strict-receive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"_embedded": {
"records": [
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "28.9871131",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "XCN",
"asset_issuer": "GCNY5OXYSY4FKHOPT2SPOQZAOEIGXB5LBYW3HVU3OWSTQITS65M5RCNY"
},
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "29.0722784",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "ULT",
"asset_issuer": "GC76RMFNNXBFDSJRBXCABWLHXDK4ITVQSMI56DC2ZJVC3YOLLPCKKULT"
},
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "29.4000002",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "31.8955888",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "USD",
"asset_issuer": "GBUYUAI75XXWDZEKLY66CFYKQPET5JR4EENXZBUZ3YXZ7DS56Z4OKOFU"
},
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "34.7086084",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "USD",
"asset_issuer": "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX"
},
{
"asset_type": "native"
}
]
}
]
}
}Query Parameters
A comma-separated list of assets available to the sender. Any returned path must start with an asset in this list. Each asset is formatted as CODE:ISSUER_ACCOUNT. For example: USD:GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX. Strict receive path payments require exactly one of source_account or source_assets.
"CNY:GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX"
curl https://horizon-testnet.stellar.org/paths/strict-receive?\
source_assets=CNY:GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX&\
destination_asset_type=credit_alphanum4&\
destination_asset_code=BB1&\
destination_asset_issuer=GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN&\
destination_amount=5
var StellarSdk = require("stellar-sdk");
var server = new StellarSdk.Horizon.Server(
"https://horizon-testnet.stellar.org",
);
server
.strictReceivePaths(
[
new StellarSdk.Asset(
"CNY",
"GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
),
],
new StellarSdk.Asset(
"BB1",
"GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
),
"5",
)
.call()
.then(function (resp) {
console.log(resp);
})
.catch(function (err) {
console.error(err);
});
from stellar_sdk import Server, Asset
server = Server("https://horizon-testnet.stellar.org")
response = server.strict_receive_paths(
source=[
Asset("CNY", "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX")
],
destination_asset=Asset(
"BB1",
"GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN"
),
destination_amount="5"
).call()
print(response)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://horizon-testnet.stellar.org/paths/strict-receive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://horizon-testnet.stellar.org/paths/strict-receive"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://horizon-testnet.stellar.org/paths/strict-receive")
.asString();require 'uri'
require 'net/http'
url = URI("https://horizon-testnet.stellar.org/paths/strict-receive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"_embedded": {
"records": [
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "28.9871131",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "XCN",
"asset_issuer": "GCNY5OXYSY4FKHOPT2SPOQZAOEIGXB5LBYW3HVU3OWSTQITS65M5RCNY"
},
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "29.0722784",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "ULT",
"asset_issuer": "GC76RMFNNXBFDSJRBXCABWLHXDK4ITVQSMI56DC2ZJVC3YOLLPCKKULT"
},
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "29.4000002",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "31.8955888",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "USD",
"asset_issuer": "GBUYUAI75XXWDZEKLY66CFYKQPET5JR4EENXZBUZ3YXZ7DS56Z4OKOFU"
},
{
"asset_type": "native"
}
]
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "CNY",
"source_asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX",
"source_amount": "34.7086084",
"destination_asset_type": "credit_alphanum4",
"destination_asset_code": "BB1",
"destination_asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN",
"destination_amount": "5.0000000",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "USD",
"asset_issuer": "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX"
},
{
"asset_type": "native"
}
]
}
]
}
}