pub struct CreateOrderParams {
pub amount: i64,
pub currency: String,
pub receipt: Option<String>,
pub notes: Option<Notes>,
pub payment_capture: Option<u8>,
pub method: Option<String>,
}Expand description
Parameters for OrdersClient::create.
Build with CreateOrderParams::new, which takes the two required fields.
Fields§
§amount: i64Amount in the smallest currency unit (paise for INR). Minimum is 100 (₹1).
currency: StringISO 4217 currency code, e.g. INR.
receipt: Option<String>Your own reference, typically an internal order id. Max 40 characters.
notes: Option<Notes>Metadata to attach; echoed back on the Order and in webhooks.
payment_capture: Option<u8>Whether to capture automatically (0) or require explicit capture (1).
Razorpay encodes this as an integer; see CreateOrderParams::manual_capture.
method: Option<String>Restrict this order to a single crate::resources::common::PaymentMethod.
Implementations§
Source§impl CreateOrderParams
impl CreateOrderParams
Sourcepub fn new(amount: i64, currency: impl Into<String>) -> Self
pub fn new(amount: i64, currency: impl Into<String>) -> Self
A new order for amount in the smallest unit of currency.
§Examples
use razorpay_api::resources::CreateOrderParams;
// ₹500.00 — amounts are in paise, never rupees.
let params = CreateOrderParams::new(50_000, "INR");
assert_eq!(params.amount, 50_000);Sourcepub fn receipt(self, receipt: impl Into<String>) -> Self
pub fn receipt(self, receipt: impl Into<String>) -> Self
Attach your own reference to this order.
Sourcepub fn manual_capture(self) -> Self
pub fn manual_capture(self) -> Self
Require an explicit capture
instead of capturing automatically.
Uncaptured payments are auto-refunded by Razorpay after a window, so only choose this if you really do capture later.