Class X402AmountMapper
Converts a PaymentRequirement amount into an XRPL Currency value, handling both native XRP (drops) and IOU/token assets.
Inheritance
object
X402AmountMapper
Namespace: Xrpl.X402
Assembly: Xrpl.X402.dll
Syntax
public static class X402AmountMapper
Methods
| Edit this page View SourceIsXrp(PaymentRequirement)
Returns true when the requirement's asset is XRP (case-insensitive comparison).
Declaration
public static bool IsXrp(PaymentRequirement req)
Parameters
| Type | Name | Description |
|---|---|---|
| PaymentRequirement | req | The payment requirement to inspect. |
Returns
| Type | Description |
|---|---|
| bool |
|
ToCurrency(PaymentRequirement)
Converts the requirement's amount and asset to an XRPL Currency instance.
For XRP, the amount is expressed in drops. For IOU assets, extra.issuer must be present.
Declaration
public static Currency ToCurrency(PaymentRequirement req)
Parameters
| Type | Name | Description |
|---|---|---|
| PaymentRequirement | req | The payment requirement containing asset, amount, and extra fields. |
Returns
| Type | Description |
|---|---|
| Currency | An XRPL Currency ready to set as the |
Exceptions
| Type | Condition |
|---|---|
| X402PaymentException | Thrown when an IOU requirement is missing |