Skip to main content
A path payment is where the asset sent can be different from the asset received. There are two possible path payment operations: 1) path_payment_strict_send, which allows the user to specify the amount of the asset to send, and 2) path_payment_strict_receive, which allows the user to specify the amount of the asset received. Read more in the Path Payments Guide.

User experience

With BasicPay, the user sends a path payment by navigating to the Payments page, where they can either select a user from their contacts or input the public key of a destination address. They then select the Send and Receive Different Assets toggle and determine whether they want to specify the asset sent or received. Finally they select the asset sent and the asset received and the amounts and select the Preview Transaction button. path payment The user will then preview the transaction, input their pincode, and select the Confirm button to sign and submit the transaction to the network.

Code implementation

The /dashboard/send page

Most of this page has been discussed in the Payment section. Below, we’re highlighting the unique pieces that are added to BasicPay to allow for the path payment feature.
/src/routes/dashboard/send/+page.svelte
Source: https://github.com/stellar/basic-payment-app/blob/main/src/routes/dashboard/send/+page.svelte

The transaction functions

In the above section, we used the createPathPaymentStrictReceiveTransaction and createPathPaymentStrictSendTransaction functions. These are used to create transactions that contain the actual path payment operation.
/src/lib/stellar/transactions.js
Source: https://github.com/stellar/basic-payment-app/blob/main/src/lib/stellar/transactions.js