Get an incoming payment
Last reviewed: Nov 10, 2026
The Get an Incoming Payment API lets you get the latest state of an incoming payment resource.
Using the ID of the payment resource, a client can determine whether the payment is active, pending payment, or complete, and get the value of the amount received.
The code snippets below let an authorized client retrieve the state and details of a specific incoming payment resource.
Before you begin
Section titled “Before you begin”We recommend you create an account on the Interledger test network. Creating an account allows you to test your client against the Open Payments APIs by using an ILP-enabled wallet funded with play money.
Get the state of an incoming payment
Section titled “Get the state of an incoming payment”Prerequisites(opens in a new tab)
Initial configuration
If you’re using JavaScript, only do the first step.
-
Add
"type": "module"topackage.json. -
Add the following to
tsconfig.json{"compilerOptions": {"target": "ES2022","module": "ES2022"}}
Get with authentication
Section titled “Get with authentication”// Import dependenciesimport { createAuthenticatedClient } from '@interledger/open-payments'
// Initialize clientconst client = await createAuthenticatedClient({ walletAddressUrl: CLIENT_WALLET_ADDRESS, privateKey: PRIVATE_KEY_PATH, keyId: KEY_ID})
// Get incoming paymentconst incomingPayment = await client.incomingPayment.get({ url: INCOMING_PAYMENT_URL, accessToken: INCOMING_PAYMENT_ACCESS_TOKEN})
// Outputconsole.log('INCOMING PAYMENT:', incomingPayment)Get without authentication
Section titled “Get without authentication”// Import dependenciesimport { createAuthenticatedClient } from '@interledger/open-payments'
// Initialize clientconst client = await createAuthenticatedClient({ walletAddressUrl: CLIENT_WALLET_ADDRESS, privateKey: PRIVATE_KEY_PATH, keyId: KEY_ID})
// Get incoming paymentconst incomingPayment = await client.incomingPayment.get({ url: INCOMING_PAYMENT_URL})
// Outputconsole.log('INCOMING PAYMENT:', incomingPayment)Prerequisites(opens in a new tab)
Get with authentication
Section titled “Get with authentication”// Import dependenciesuse open_payments::client::api::AuthenticatedResources;
// Initialize clientlet client = create_authenticated_client()?;
// Get incoming paymentlet access_token = get_env_var("INCOMING_PAYMENT_ACCESS_TOKEN")?;let incoming_payment_url = get_env_var("INCOMING_PAYMENT_URL")?;
let payment = client .incoming_payments() .get(&incoming_payment_url, Some(&access_token)) .await?;
// Outputprintln!("Incoming payment: {payment:#?}");Get without authentication
Section titled “Get without authentication”// Import dependenciesuse open_payments::client::api::AuthenticatedResources;
// Initialize clientlet client = create_authenticated_client()?;
// Get incoming paymentlet incoming_payment_url = get_env_var("INCOMING_PAYMENT_URL")?;
let payment = client .public_incoming_payments() .get(&incoming_payment_url) .await?;
// Outputprintln!("Public incoming payment: {payment:#?}");Prerequisites(opens in a new tab)
Get with authentication
Section titled “Get with authentication”// Import dependenciesuse OpenPayments\AuthClient;use OpenPayments\Config\Config;
// Initialize client$config = new Config( $WALLET_ADDRESS, $PRIVATE_KEY, $KEY_ID);$opClient = new AuthClient($config);
// Get incoming payment$incomingPayment = $opClient->incomingPayment()->get( [ 'access_token' => $INCOMING_PAYMENT_GRANT_ACCESS_TOKEN, 'url' => $INCOMING_PAYMENT_URL ]);
// Outputecho 'INCOMING PAYMENT: ' . PHP_EOL . print_r($incomingPayment, true);Get without authentication
Section titled “Get without authentication”// Import dependenciesuse OpenPayments\AuthClient;use OpenPayments\Config\Config;
// Initialize client$config = new Config( $WALLET_ADDRESS, $PRIVATE_KEY, $KEY_ID);$opClient = new AuthClient($config);
// Get incoming payment$incomingPayment = $opClient->incomingPayment()->getPublic( [ 'url' => $INCOMING_PAYMENT_URL ]);
// Outputecho 'INCOMING PAYMENT: ' . PHP_EOL . print_r($incomingPayment, true);Prerequisites(opens in a new tab)
package main
// Import dependenciesimport ( "context" "encoding/json" "fmt" "log"
op "github.com/interledger/open-payments-go")
func main() { // Initialize client client, err := op.NewAuthenticatedClient(WALLET_ADDRESS_URL, PRIVATE_KEY_BASE_64, KEY_ID) if err != nil { log.Fatalf("Error creating authenticated client: %v\n", err) }
// Get incoming payment incomingPayment, err := client.IncomingPayment.Get(context.TODO(), op.IncomingPaymentGetParams{ URL: INCOMING_PAYMENT_URL, AccessToken: ACCESS_TOKEN, })
// Or, get public incoming payment without authenticating // incomingPayment, err := client.IncomingPayment.GetPublic(context.TODO(), op.IncomingPaymentGetPublicParams{ // URL: INCOMING_PAYMENT_URL, // })
if err != nil { log.Fatalf("Error fetching incoming payment: %v\n", err) }
// Output incomingPaymentJSON, err := json.MarshalIndent(incomingPayment, "", " ") if err != nil { log.Fatalf("Error marshaling incoming payment: %v\n", err) } fmt.Println("INCOMING PAYMENT:", string(incomingPaymentJSON))}Prerequisites(opens in a new tab)
// Import dependenciesimport org.interledger.openpayments.httpclient.OpenPaymentsHttpClient;import org.interledger.openpayments.IOpenPaymentsClient;
// Initialize clientIOpenPaymentsClient client = OpenPaymentsHttpClient.defaultClient("WalletAddress","PrivateKeyPEM","KeyId");
// Retrieve the walletvar receiverWallet = client.walletAddress().get("https://cloudninebank.example.com/customer");
// Grant for incoming payment (default)var grantRequest = client.auth().grant().incomingPayment(receiverWallet);
// Create the incoming paymentvar incomingPayment = client.payment().createIncoming(receiverWallet, grantRequest, BigDecimal.valueOf(11.25));
// Get the newly created incoming payment (fetch by ID)var incomingPaymentFetched = client.payment().getIncoming(incomingPayment.getId(), grantRequest);
// Outputlog.info("INCOMING_PAYMENT: {}", incomingPaymentFetched);Prerequisites(opens in a new tab)
Get with authentication
Section titled “Get with authentication”// Import dependenciesusing Microsoft.Extensions.DependencyInjection;using Newtonsoft.Json;using OpenPayments.Sdk.Clients;using OpenPayments.Sdk.Extensions;using OpenPayments.Sdk.HttpSignatureUtils;
// Initialize clientvar client = new ServiceCollection() .UseOpenPayments(opts => { opts.UseAuthenticatedClient = true; opts.KeyId = CLIENT_ID; opts.PrivateKey = KeyUtils.LoadPem(CLIENT_SECRET); opts.ClientUrl = new Uri(CLIENT_WALLET_ADDRESS); }) .BuildServiceProvider() .GetRequiredService<IAuthenticatedClient>();
// Get incoming paymentvar incomingPayment = await client.GetIncomingPaymentAsync( new AuthRequestArgs() { Url = new Uri(INCOMING_PAYMENT_URL), AccessToken = INCOMING_PAYMENT_ACCESS_TOKEN, });
// OutputConsole.WriteLine($"INCOMING PAYMENT: {JsonConvert.SerializeObject(incomingPayment, Formatting.Indented)}");Get without authentication
Section titled “Get without authentication”// Import dependenciesusing Microsoft.Extensions.DependencyInjection;using Newtonsoft.Json;using OpenPayments.Sdk.Clients;using OpenPayments.Sdk.Extensions;
// Initialize clientvar client = new ServiceCollection() .UseOpenPayments(opts => { opts.UseUnauthenticatedClient = true; }) .BuildServiceProvider() .GetRequiredService<IUnauthenticatedClient>();
// Get incoming paymentvar incomingPayment = await client.GetIncomingPaymentAsync(INCOMING_PAYMENT_URL);
// OutputConsole.WriteLine($"INCOMING PAYMENT: {JsonConvert.SerializeObject(incomingPayment, Formatting.Indented)}");