Skip to main content
The 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:
If you received 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, call order_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
Pass amounts such as "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 the OrsunPay-Signature header. The verifier requires exactly one header value. It checks the signature and timestamp before returning the JSON event.
Deduplicate by the verified event ID before applying the payment change. During signing-secret rotation, pass both active secrets to the verifier. Webhook delivery