Ask a Question
Back to All

Async vs Sync when creating outgoing payments

The current assumption is that when creating an outgoing payment the provider will return immediately with a "201 Created" response.

It will then asynchronously:

  1. Query/create the receivingPayment at the receiving provider, and then
  2. Get rates estimates for the payment based on the payment details (ILP Address and Secret) it has received.

As these async processes are completed the outgoing payment object is updated and eventually its state moves to "prepared".

If the outgoing payment is created with a receivingAccount (and not a receivingPayment) then the provider will create an incoming payment at the receivingAccount and update the outgoing payment's receivingPayment property to the URL of that incoming payment.

There are use cases such as Web Monetization where the client creating the outgoing payment might want to get the URL of the receivingPayment as soon as it has been created and not have to poll the resource.

i.e. The first of the two steps above should be executed synchronously.

Should it be the default behaviour for a sending provider to synchronously create an incoming payment at the receiving provider or should we provide a flag for the client to request this behaviour?