File: payment_app.mojom

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (88 lines) | stat: -rw-r--r-- 4,189 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Next MinVersion: 4

module chromeos.payments.mojom;

import "chromeos/components/payments/mojom/payment_app_types.mojom";

// The service that runs in ARC and allows the browser to invoke the TWA payment
// app that is installed in ARC, if it implements payment intents as described
// in https://web.dev/android-payment-apps-overview/.
//
// This mojom interface is used in crosapi as well to forward the payment
// request from Lacros.
//
// At first, only "https://play.google.com/billing" payment method is supported.
//
// Ash Browser:
// --------------------      --------------------------------------------------
// |   Ash Browser    |      |                      ARC                       |
// |                  |      |                                                |
// | ---------------  |      |  --------------    -------    ---------------- |
// | | Web Payment |<-|------|->| PaymentApp |<-->| TWA |<-->| Play Billing | |
// | ---------------  |      |  --------------    -------    ---------------- |
// |                  |      |                                                |
// --------------------      --------------------------------------------------
// Lacros Browser:
// ---------------- ---------------- -----------------------------------------
// |   Lacros     | |     Ash      | |                 ARC                   |
// |   Browser    | |              | |                                       |
// |------------- | | ------------ | | ------------   -----   -------------- |
// ||Web Payment|<|-|>|PaymentApp|<|-|>|PaymentApp|<->|TWA|<->|Play Billing| |
// |------------- | | |Forwarder | | | ------------   -----   -------------- |
// |              | | ------------ | |                                       |
// ---------------- ---------------- -----------------------------------------


//
// Next method ID: 3
[Stable, Uuid="5d046348-1f14-4bfe-840b-75bc2c05ef01"]
interface PaymentAppInstance {
  // Called by the browser to check whether the TWA with |package_name| (e.g.,
  // "com.example.app") in ARC has intent filters for
  // org.chromium.intent.action.PAY and
  // org.chromium.intent.action.IS_READY_TO_PAY with
  // "https://play.google.com/billing" in either
  // "org.chromium.default_payment_method_name" or
  // "org.chromium.payment_method_names" metadata of the PAY intent filter.
  // Other payment methods are ignored for now.
  //
  // Should not invoke any of the TWA activities or connect to any of its
  // services, because this method may be invoked when off the record, e.g.,
  // incognito mode or guest mode.
  IsPaymentImplemented@0(string package_name)
      => (chromeos.payments.mojom.IsPaymentImplementedResult response);

  // Forwards the request to IsReadyToPayServiceHelper.query(), which queries
  // the payment app. The payment app should return true if payments can be
  // made. This should not be invoked when off the record, e.g., incognito mode
  // or guest mode.
  [MinVersion=1]
  IsReadyToPay@1(chromeos.payments.mojom.PaymentParameters parameters)
      => (chromeos.payments.mojom.IsReadyToPayResult response);

  // Forwards the request to WebPaymentIntentHelper.createPayIntent() and fires
  // the resulting intent. This invokes the payment flow.
  //
  // The "String merchantName" parameter to createPayIntent() should be empty
  // (but not null).
  //
  // The total amount for createPayIntent() should always be "0" with currency
  // "ZZZ".
  [MinVersion=2]
  InvokePaymentApp@2(chromeos.payments.mojom.PaymentParameters parameters)
      => (chromeos.payments.mojom.InvokePaymentAppResult response);

  // Requests to abort a previous payment flow (identified by |request_token|)
  // which was opened with InvokePaymentApp().
  //
  // This may be called by the website if a payment should no longer be made
  // (e.g., when an item goes out of stock), or by the browser if the payment is
  // no longer available (e.g., the page was refreshed).
  [MinVersion=3]
  AbortPaymentApp@3(string request_token)
      => (bool aborted);
};