Skip to content

Latest commit

 

History

History
83 lines (55 loc) · 2.49 KB

File metadata and controls

83 lines (55 loc) · 2.49 KB

Payment flow

Before proceeding with this example, ensure you have met the necessary prerequisites.

  1. Request a Grant for an Incoming Payment
cargo run --features snippets --bin grant-incoming-payment

The 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...
  1. Create an Incoming Payment
cargo run --features snippets --bin incoming-payment-create

Copy the INCOMING_PAYMENT_URL value and update the corresponding variable in your .env file.

  1. Request a Grant for Quoting
cargo run --features snippets --bin grant-quote

Copy the QUOTE_ACCESS_TOKEN value and update the corresponding variable in your .env file.

  1. Create a quote
cargo run --features snippets --bin quote-create

Copy the QUOTE_URL value and update the corresponding variable in your .env file.

  1. Request a Grant for an Outgoing Payment
cargo run --features snippets --bin grant-outgoing-payment

This 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.

  1. 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_REF variable in your .env file with the interact_ref value in this URL
  1. Continuation request (notify Rafiki that the user has interacted with the grant)
cargo run --features snippets --bin grant-continuation

Copy the OUTGOING_PAYMENT_ACCESS_TOKEN value and update the corresponding variable in your .env file.

  1. Create the Outgoing Payment
cargo run --features snippets --bin outgoing-payment-create

Copy the OUTGOING_PAYMENT_URL value and update the corresponding variable in your .env file.

  1. Retrieve Outgoing Payment Information (Optional)
cargo run --features snippets --bin outgoing-payment-get