Skip to content
 
 

Repository files navigation

payrex-rust

Caution

This SDK is currently in early development. The foundation is complete, but API implementations are stubs. Not ready for production use yet!

Unofficial Rust SDK for PayRex

Roadmap

  • Foundations
  • APIs
    • Payment Intents
    • Customers
    • Billing Statements
    • Checkout Sessions
    • Webhooks
    • Events
    • Refunds
    • Payouts
  • Final
    • Integration tests
    • Documentation improvements
    • Publish to crates.io

Installation

For now, you can use it from git:

[dependencies]
payrex = { git = "https://github.com/mayspc/payrex-rust" }
tokio = { version = "1", features = ["full"] }

Quick Start

Note

These examples show the intended API design. Currently, all methods return stub/placeholder data.

use payrex::{Client, Currency};
use payrex::resources::payment_intents::{CreatePaymentIntent, CaptureMethod};

#[tokio::main]
async fn main() -> Result<(), payrex::Error> {
    // Initialize the client with your API key
    let client = Client::new("your_secret_key");

    // Create a payment intent (currently returns stub data)
    let params = CreatePaymentIntent::new(10000, Currency::PHP)
        .description("Order #12345")
        .capture_method(CaptureMethod::Automatic);

    let payment_intent = client.payment_intents().create(params).await?;

    println!("Created payment intent: {}", payment_intent.id);
    println!("Status: {:?}", payment_intent.status);

    Ok(())
}

Configuration

use payrex::{Client, Config};
use std::time::Duration;

let config = Config::builder()
    .api_key("your_secret_key")
    .timeout(Duration::from_secs(30))
    .max_retries(3)
    .test_mode(true)
    .build()?;

let client = Client::with_config(config)?;

Testing

The SDK will include comprehensive tests. Run them with:

cargo test

Examples

See the examples directory for more usage examples:

  • basic_usage.rs - Basic payment intent creation

Requirements

  • Rust 1.90 or later

Contributing

Contributions are welcome! This is an early-stage project, so there's plenty to do.

Feel free to open issues or submit PRs!


Built for the Rust and PayRex communities.

About

ange made a go repo so i will make a rust one

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages