bash
cargo add pay_u
```rust
async fn usage() {
let clientid = ClientId::new(std::env::var("PAYUCLIENTID").unwrap());
let clientsecret = ClientSecret::new(std::env::var("PAYUCLIENTSECRET").unwrap());
let merchantid = std::env::var("PAYUCLIENTMERCHANTID").unwrap().parse::
let _res = client.create_order(
OrderCreateRequest::build(
Buyer::new("john.doe@example.com", "654111654", "John", "Doe", "pl"),
"127.0.0.1",
"PLN",
"Some description"
)
.expect("All required fields must be valid")
// Endpoint which will be requested by PayU with payment status update
.with_notify_url("https://your.eshop.com/notify")
// payment description (MANDATORY)
.with_description("RTV market")
// add list of products
.with_products(
[
Product::new("Wireless Mouse for Laptop", 15000, 1),
Product::new("HDMI cable", 6000, 1),
]
.into_iter(),
)
// add additional product
.with_product(Product::new("HDMI cable", 6000, 1)),
)
.await;
// partial refund
let _res = client
.refund(
OrderId::new("H9LL64F37H160126GUEST000P01"),
RefundRequest::new("Refund", Some(1000)),
)
.await;
// Full refund
let _res = client
.refund(
OrderId::new("H9LL64F37H160126GUEST000P01"),
RefundRequest::new("Refund", None),
)
.await;
// Order details
let _res = client.order_details(OrderId::new("H9LL64F37H160126GUEST000P01")).await;
// Transactions
let _res = client.order_transactions(OrderId::new("H9LL64F37H160126GUEST000P01")).await;
} ```
```rust use actix_web::{, web::};
async fn checkout(session: Data
async fn handlenotification(path: Path
0.1.7 - Added credit and more create order request options like additional description, visible description.
Please report bugs here: https://todo.sr.ht/~tsumanu/payu-rs