Rust integration
Call the SpicePay API from a server-side Rust application.
How it works
Call the SpicePay API from a server-side Rust application. Standard HTTP clients can create the payment without a branded SDK dependency.
Implementation
Read the secret from SPICEPAY_API_KEY, construct an explicit shop-scoped request, send api-key and Content-Type headers, and deserialize the response. Save payment_id before sending the customer to checkout. Use test_mode only after validating sandbox credentials. A SpicePay SDK registry package has not been confirmed; the examples below therefore use a native HTTP client.
In this area
- Install
- Create a payment
- Client options
- Webhook-only build
Related guides
Create a test payment
// Uses reqwest with its json feature, serde_json and an async runtime.
let key = std::env::var("SPICEPAY_API_KEY")?;
let response = reqwest::Client::new()
.post("https://api.spicepay.net/payments")
.header("api-key", key)
.json(&serde_json::json!({
"amount": 4900, "currency": "EUR",
"profile_id": "YOUR_SHOP_ID", "payment_link": true,
"test_mode": true,
"return_url": "https://your-shop.example/return"
}))
.send().await?
.error_for_status()?;
let payment: serde_json::Value = response.json().await?;
// Persist payment["payment_id"] and reconcile through signed webhooks.The snippet is a server-side request example. Supply your own merchant key and shop ID and configure the processor sandbox before running it.
Fragen zu deiner Integration? SpicePay kontaktieren ↗