Transactions in RinneJS represent the checkout amount and context used by wallet elements during authorization.
Create a new transaction whenever totals change so wallet sheets and backend charge requests stay aligned.
Create a Transaction
Use rinne.transaction.create() before mounting Apple Pay or Google Pay.
const transaction = await rinne.transaction.create({
amount: 5000,
currency: 'BRL',
country: 'BR',
lineItems: [
{ label: 'Subtotal', amount: 4500 },
{ label: 'Shipping', amount: 500 }
]
})
lineItems
Array<{ label: string; amount: number }>
Optional line item breakdown used by wallet UIs.
Behavior Notes
- The SDK initializes lazily on first transaction/element call.
currency defaults to BRL and country defaults to BR.
- Returned transactions are intended to be passed into wallet elements.
Create a new transaction whenever checkout totals change. Keep the transaction amount aligned with what you charge on your backend.
Example with Dynamic Cart
const total = cartItems.reduce((sum, item) => sum + item.amount, 0)
const transaction = await rinne.transaction.create({
amount: total,
lineItems: cartItems.map((item) => ({
label: item.label,
amount: item.amount
}))
})