orderCode, then confirm the outcome through webhooks or an order lookup. These operations live under vivawallet.payments.
All monetary amounts are expressed in the smallest currency unit. For EUR that means cents: pass
1000 for EUR 10.00.Create a Payment Order
CallcreateOrder(orderData) to register a new payment intent with VivaWallet. On success, result.data.orderCode contains the code you need to build the checkout URL.
createOrder() fields:
Redirect to SmartCheckout
Once you have anorderCode, use the getSmartCheckout helper to build the hosted checkout URL and redirect your customer to it.
getSmartCheckout() is a standalone helper exported from the package root. Its dev flag only affects the checkout URL it builds. API calls use demo endpoints when the client itself was constructed with dev: true.
Retrieve an Order
After the customer completes or abandons checkout, retrieve the order to inspect its current state. The SDK method takes theorderCode directly, not an options object.
Cancel a Payment Order
Cancel an unpaid order to prevent the customer from completing it. This is useful when your session expires or the cart contents change.Update a Payment Order
You can update certain fields on an existing unpaid order, such as amount or customer-facing text, usingupdateOrder(orderCode, options).
Retrieve Payment Fees
Usevivawallet.fees.retrieveFees(options) when you need Viva’s fee calculation for a payment order amount. This method uses the legacy Basic Auth fee endpoint, so the client must be initialized with merchantId and apikey.
VivaFeesReturn mirrors Viva’s response fields, including Fee, BillFee, ServiceFee, ResellerFee, CollectionFee, and TotalConversionFee when returned by the API.
Create a Legacy Payment Order
For older integrations that use VivaWallet’s Basic Auth payment API, usecreateLegacyOrder(orderData). This method targets the legacy endpoint and requires merchantId and apikey credentials on your client.
createOrder() for new integrations. It uses the OAuth-based Checkout v2 order endpoint and returns the SDK’s normalized { orderCode } response.