how to start a payment from a browser on an android mobile device to the vivawallet app (app to app payment) on the same device?

To trigger an app-to-app payment directly from a web browser on an Android device to the Viva.com Terminal app installed on the same device, you can leverage Android’s handling of custom URL schemes.

When a user clicks a link using Viva's custom scheme, the Android OS intercepts the intent and redirects the user from the mobile browser directly into the local terminal application to handle the payment.

The implementation details and URI format are structured as follows:

1. The Deep Link URI Structure

To launch a sale from a browser link, you need to construct a URI string using Viva’s scheme (vivapayclient://). Because it is running from a web browser, formatting this as an Android intent:// token provides the most reliable fallback if the application is missing from the device.

The base structure requires specific query parameters to execute a sale and safely return the user back to your browser application upon completion.




HTML

<a href="intent://pay/v1?appId=your.website.com&action=sale&amount=1250&currency=978&callback=https://yourwebsite.com/payment-callback#Intent;scheme=vivapayclient;package=com.vivawallet.spoc.payapp;end">
    Pay €12.50 via Viva Wallet App
</a>

2. Parameter Breakdown

Parameter

Type

Required

Description

appId

String

Yes

A unique identifier for your client application or website domain (e.g., com.yourcompany.pos or yourwebsite.com).

action

String

Yes

The operation to execute. For a standard payment, this must be set to sale.

amount

Integer

Yes

The payment total represented as a positive integer in minor units (cents). For example, €12.50 is passed as 1250.

currency

String

Yes

The ISO 4217 numeric currency code. For Euro (€), use 978. For British Pound (£), use 826.

callback

String

Yes

The return URL where Viva will redirect the mobile browser after the transaction finishes. This URL must be url-encoded if it contains complex query strings.

3. Handling the Payment Response

Once the transaction is processed (whether approved, failed, or canceled), the Viva.com Terminal app invokes your specified callback URL. It appends critical payment parameters directly onto your return URL query string.

Your web server or frontend JavaScript needs to parse these parameters to verify the transaction outcome:

  • status: Indicates the result (success or fail).

  • message: A human-readable text explanation of the status.

  • transactionId: The unique tracking reference generated by Viva for successful payments.

⚠️ Security Warning: Never rely solely on front-end client redirects or query parameters to mark an order as paid in your backend database. Always pair this app-to-app flow with a Viva Wallet Webhook (Transaction Payment Created) sent from Viva’s servers directly to your backend server to securely finalize the order processing.


Reacties

Populaire posts van deze blog

bookings for venues (wip)

Tailscale compared