Rust
Introduction

Introduction

Learn how to cash your first crypto payment using the vxpay Rust SDK.

Prerequisites

1. Install

First, create a rust project with cargo and cd into it.

cargo init vxpay-rust-example
cd vxpay-rust-example

Next, add add the Rust vxpay SDK as well as Tokio (opens in a new tab):

cargo add vxpay-rs
cargo add tokio -F macros,rt-multi-thread

The Rust SDK is Async-first so Tokio is needed.

2. Accept onchain payment

main.rs
use vxpay_rs::{VXPAY, Result};
 
#[tokio::main]
async fn main() -> Result<()> {
  let vxpay = VXPAY::new("YOUR_API_KEY");
 
  ...
  
  Ok(())
}

3. Try it yourself