orsunpay crate supports Rust 1.90 or later and uses Tokio for async HTTP requests. Copy the supplied rust/src directory into your application, keeping the crate manifest at rust/src/Cargo.toml. Add the path to your application’s Cargo.toml:
orsunpay-0.1.0.crate, unpack it with tar -xzf orsunpay-0.1.0.crate and use the resulting orsunpay-0.1.0 directory as the dependency path.
Read the payment for an order
Create a client once per merchant and environment. In your Tokio application, callorder_status(&client, order_id).await with the original order ID.
Create a sale
Save the order ID and idempotency key before sending the request. Replace the example URLs with your application’s URLs. An accepted sale can still be pending or declined. Payment states"12.30" as JSON strings. Persist a distinct idempotency key for each intended sale, payout, payment link or refund before sending it. After an uncertain outcome, reconcile the original operation. Reuse its key and request body if you retry. Idempotency
Verify a webhook
Pass the original request bytes and all values of theOrsunPay-Signature header. The verifier requires exactly one header value. It checks the signature and timestamp before returning the JSON event.