Before proceeding with this example, ensure you have met the necessary prerequisites.
- Request a Grant for an Incoming Payment
cargo run --features snippets --bin grant-incoming-paymentThe script will output an INCOMING_PAYMENT_ACCESS_TOKEN. Copy its value and fill the corresponding variable in your
.env file.
# Output example
INCOMING_PAYMENT_ACCESS_TOKEN = 123456ABD...- Create an Incoming Payment
cargo run --features snippets --bin incoming-payment-createCopy the INCOMING_PAYMENT_URL value and update the corresponding variable in your .env file.
- Request a Grant for Quoting
cargo run --features snippets --bin grant-quoteCopy the QUOTE_ACCESS_TOKEN value and update the corresponding variable in your .env file.
- Create a quote
cargo run --features snippets --bin quote-createCopy the QUOTE_URL value and update the corresponding variable in your .env file.
- Request a Grant for an Outgoing Payment
cargo run --features snippets --bin grant-outgoing-paymentThis will output three values: The interaction URL, CONTINUE_ACCESS_TOKEN, and CONTINUE_URI. Update the CONTINUE_*
variables in your .env file with these values (only CONTINUE_ACCESS_TOKEN and CONTINUE_URI).
Note: In Rafiki, this is the only grant that requires user interaction, necessitating two steps to retrieve an access token with permission to create an outgoing payment.
- Accepting the Grant
- Click on the interaction URL outputted in the previous step;
- Accept or decline the grant on Rafiki Money;
- After accepting, click the Finish button in the dialog that appears;
- Copy the redirected URL, it should look something like this:
http://localhost/?hash=...&interact_ref=.... - Update the
INTERACT_REFvariable in your.envfile with theinteract_refvalue in this URL
- Continuation request (notify Rafiki that the user has interacted with the grant)
cargo run --features snippets --bin grant-continuationCopy the OUTGOING_PAYMENT_ACCESS_TOKEN value and update the corresponding variable in your .env file.
- Create the Outgoing Payment
cargo run --features snippets --bin outgoing-payment-createCopy the OUTGOING_PAYMENT_URL value and update the corresponding variable in your .env file.
- Retrieve Outgoing Payment Information (Optional)
cargo run --features snippets --bin outgoing-payment-get