Creating order details
Stay organized with collections
Save and categorize content based on your preferences.
After defining the fields required for the PaymentRequest
object, provide the
order amount for a specific transaction.
To provide the order amount, define the am
and cu
fields in the payment request.
Because the am
and cu
fields are calculated based on the defined order values,
they’ll vary for every order.
The contents of the total
parameter should contain a label
parameter
and an amount
parameter consisting of a currency and value.
Defining order value
The following code snippet illustrates how to add an order amount based on the
order. In this example, the static number ‘10.01’ is provided as a value for the
amount
variable.
const details = {
total: {
label: 'Total',
amount: {
currency: 'INR',
value: '10.01', // sample amount
},
},
displayItems: [{
label: 'Original Amount',
amount: {
currency: 'INR',
value: '10.01',
},
}],
};
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-16 UTC."],[[["Define the `am` and `cu` fields in the payment request to provide the order amount, which will vary for each transaction."],["The `total` parameter should include a `label` and an `amount` parameter with currency and value."],["The provided code snippet demonstrates adding an order amount using a static value for illustration purposes."]]],[]]