@capgo/capacitor-pay 8.1.0 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +355 -69
- package/android/build.gradle +1 -1
- package/android/src/main/java/app/capgo/pay/PayPlugin.java +217 -57
- package/dist/docs.json +1288 -144
- package/dist/esm/definitions.d.ts +555 -26
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js +1 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -0
- package/dist/plugin.js.map +1 -1
- package/docs/google-pay-setup.md +33 -7
- package/ios/Sources/PayPlugin/PayPlugin.swift +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# @capgo/capacitor-pay
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
<a href="https://capgo.app/">
|
|
4
|
+
<img
|
|
5
|
+
src="https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png"
|
|
6
|
+
alt="Capgo - Instant updates for capacitor"
|
|
7
|
+
/>
|
|
8
|
+
</a>
|
|
3
9
|
|
|
4
10
|
<div align="center">
|
|
5
|
-
<h2
|
|
6
|
-
|
|
11
|
+
<h2>
|
|
12
|
+
<a href="https://capgo.app/?ref=plugin_pay"> ➡️ Get Instant updates for your App with Capgo</a>
|
|
13
|
+
</h2>
|
|
14
|
+
<h2>
|
|
15
|
+
<a href="https://capgo.app/consulting/?ref=plugin_pay"> Missing a feature? We'll build the plugin for you 💪</a>
|
|
16
|
+
</h2>
|
|
7
17
|
</div>
|
|
8
18
|
|
|
9
19
|
Capacitor plugin to trigger native payments with Apple Pay and Google Pay using a unified JavaScript API.
|
|
@@ -16,10 +26,10 @@ The most complete doc is available here: https://capgo.app/docs/plugins/pay/
|
|
|
16
26
|
|
|
17
27
|
| Plugin version | Capacitor compatibility | Maintained |
|
|
18
28
|
| -------------- | ----------------------- | ---------- |
|
|
19
|
-
| v8.\*.\* | v8.\*.\* | ✅
|
|
20
|
-
| v7.\*.\* | v7.\*.\* | On demand
|
|
21
|
-
| v6.\*.\* | v6.\*.\* | ❌
|
|
22
|
-
| v5.\*.\* | v5.\*.\* | ❌
|
|
29
|
+
| v8.\*.\* | v8.\*.\* | ✅ |
|
|
30
|
+
| v7.\*.\* | v7.\*.\* | On demand |
|
|
31
|
+
| v6.\*.\* | v6.\*.\* | ❌ |
|
|
32
|
+
| v5.\*.\* | v5.\*.\* | ❌ |
|
|
23
33
|
|
|
24
34
|
> **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.
|
|
25
35
|
|
|
@@ -48,6 +58,8 @@ Before invoking the plugin, complete the native configuration documented in this
|
|
|
48
58
|
|
|
49
59
|
Finish both guides once per app to unlock the native payment sheets on devices.
|
|
50
60
|
|
|
61
|
+
Google Pay request and response types are bundled with this plugin, so you do not need to install `@types/googlepay` unless you also use Google's web JavaScript client elsewhere in your app.
|
|
62
|
+
|
|
51
63
|
## Usage
|
|
52
64
|
|
|
53
65
|
```ts
|
|
@@ -61,6 +73,8 @@ const availability = await Pay.isPayAvailable({
|
|
|
61
73
|
google: {
|
|
62
74
|
// Optional: falls back to a basic CARD request if omitted.
|
|
63
75
|
isReadyToPayRequest: {
|
|
76
|
+
apiVersion: 2,
|
|
77
|
+
apiVersionMinor: 0,
|
|
64
78
|
allowedPaymentMethods: [
|
|
65
79
|
{
|
|
66
80
|
type: 'CARD',
|
|
@@ -135,7 +149,9 @@ if (availability.platform === 'ios') {
|
|
|
135
149
|
},
|
|
136
150
|
},
|
|
137
151
|
});
|
|
138
|
-
|
|
152
|
+
|
|
153
|
+
console.log(result.google.paymentData);
|
|
154
|
+
// Process the payment token on your backend server here.
|
|
139
155
|
}
|
|
140
156
|
```
|
|
141
157
|
|
|
@@ -217,9 +233,11 @@ const result = await Pay.requestPayment({
|
|
|
217
233
|
},
|
|
218
234
|
});
|
|
219
235
|
|
|
220
|
-
// Send `result.google
|
|
236
|
+
// Send `result.google.paymentData` to your backend and use your PSP to start the subscription.
|
|
221
237
|
```
|
|
222
238
|
|
|
239
|
+
`requestPayment()` is the completion path on both platforms.
|
|
240
|
+
|
|
223
241
|
## API
|
|
224
242
|
|
|
225
243
|
<docgen-index>
|
|
@@ -262,6 +280,8 @@ requestPayment(options: PayPaymentOptions) => Promise<PayPaymentResult>
|
|
|
262
280
|
Presents the native pay sheet for the current platform.
|
|
263
281
|
Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.
|
|
264
282
|
|
|
283
|
+
This promise is the completion path on both platforms.
|
|
284
|
+
|
|
265
285
|
| Param | Type |
|
|
266
286
|
| ------------- | --------------------------------------------------------------- |
|
|
267
287
|
| **`options`** | <code><a href="#paypaymentoptions">PayPaymentOptions</a></code> |
|
|
@@ -307,9 +327,10 @@ Get the native Capacitor plugin version
|
|
|
307
327
|
|
|
308
328
|
#### GooglePayAvailabilityResult
|
|
309
329
|
|
|
310
|
-
| Prop
|
|
311
|
-
|
|
|
312
|
-
| **`isReady`**
|
|
330
|
+
| Prop | Type | Description |
|
|
331
|
+
| -------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
332
|
+
| **`isReady`** | <code>boolean</code> | Whether the user is able to provide payment information through the Google Pay payment sheet. |
|
|
333
|
+
| **`paymentMethodPresent`** | <code>boolean</code> | The current user's ability to pay with one or more of the payment methods specified in `IsReadyToPayRequest.allowedPaymentMethods`. This property only exists if `IsReadyToPayRequest.existingPaymentMethodRequired` was set to `true`. The property value will always be `true` if the request is configured for a test environment. |
|
|
313
334
|
|
|
314
335
|
|
|
315
336
|
#### PayAvailabilityOptions
|
|
@@ -337,56 +358,110 @@ Get the native Capacitor plugin version
|
|
|
337
358
|
|
|
338
359
|
#### GooglePayIsReadyToPayRequest
|
|
339
360
|
|
|
340
|
-
|
|
341
|
-
|
|
361
|
+
Self-contained Google Pay request type based on the official request objects and DefinitelyTyped definitions.
|
|
362
|
+
|
|
363
|
+
The plugin forwards the provided JSON to the native Google Pay SDK on Android, while keeping the type surface local
|
|
364
|
+
so consumers do not need to install `@types/googlepay`.
|
|
342
365
|
|
|
343
|
-
| Prop
|
|
344
|
-
|
|
|
345
|
-
| **`
|
|
366
|
+
| Prop | Type | Description |
|
|
367
|
+
| ----------------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
368
|
+
| **`apiVersion`** | <code>number</code> | Google Pay API major version. Use `2` for current integrations. |
|
|
369
|
+
| **`apiVersionMinor`** | <code>number</code> | Google Pay API minor version. Use `0` for current integrations. |
|
|
370
|
+
| **`allowedPaymentMethods`** | <code>GooglePayAllowedPaymentMethod[]</code> | Payment methods you want to test for readiness. |
|
|
371
|
+
| **`existingPaymentMethodRequired`** | <code>boolean</code> | When `true`, Google Pay also indicates whether an existing matching payment method is present. In the `test` environment this always resolves to `true`. |
|
|
346
372
|
|
|
347
373
|
|
|
348
374
|
#### GooglePayAllowedPaymentMethod
|
|
349
375
|
|
|
350
|
-
| Prop | Type |
|
|
351
|
-
| ------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
352
|
-
| **`type`** | <code
|
|
353
|
-
| **`parameters`** | <code><a href="#googlepaycardpaymentmethodparameters">GooglePayCardPaymentMethodParameters</a></code> |
|
|
354
|
-
| **`tokenizationSpecification`** | <code><a href="#googlepaytokenizationspecification">GooglePayTokenizationSpecification</a></code> |
|
|
376
|
+
| Prop | Type | Description |
|
|
377
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
378
|
+
| **`type`** | <code><a href="#googlepaypaymentmethodtype">GooglePayPaymentMethodType</a></code> | Supported payment method type. `CARD` is the only value currently accepted by Google Pay request objects. |
|
|
379
|
+
| **`parameters`** | <code><a href="#googlepaycardpaymentmethodparameters">GooglePayCardPaymentMethodParameters</a></code> | Parameters that control which cards can be shown and what extra data is collected. |
|
|
380
|
+
| **`tokenizationSpecification`** | <code><a href="#googlepaytokenizationspecification">GooglePayTokenizationSpecification</a></code> | Tokenization settings for the selected payment method. In Google Pay, this is required for `PaymentDataRequest` card payment methods, but ignored by `IsReadyToPayRequest`. |
|
|
355
381
|
|
|
356
382
|
|
|
357
383
|
#### GooglePayCardPaymentMethodParameters
|
|
358
384
|
|
|
359
|
-
| Prop
|
|
360
|
-
|
|
|
361
|
-
| **`allowedAuthMethods`**
|
|
362
|
-
| **`allowedCardNetworks`**
|
|
363
|
-
| **`
|
|
364
|
-
| **`
|
|
385
|
+
| Prop | Type | Description |
|
|
386
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
387
|
+
| **`allowedAuthMethods`** | <code>GooglePayAuthMethod[]</code> | Authentication methods your gateway or processor accepts. |
|
|
388
|
+
| **`allowedCardNetworks`** | <code>GooglePayCardNetwork[]</code> | Card networks your gateway or processor accepts. |
|
|
389
|
+
| **`allowPrepaidCards`** | <code>boolean</code> | Whether prepaid cards are allowed. Defaults to `true` in Google Pay. |
|
|
390
|
+
| **`allowCreditCards`** | <code>boolean</code> | Whether credit cards are allowed. Defaults to `true` in Google Pay. |
|
|
391
|
+
| **`allowedIssuerCountryCodes`** | <code>string[]</code> | Restricts users to cards issued in the provided ISO 3166-1 alpha-2 countries. |
|
|
392
|
+
| **`blockedIssuerCountryCodes`** | <code>string[]</code> | Blocks cards issued in the provided ISO 3166-1 alpha-2 countries. This is mutually exclusive with `allowedIssuerCountryCodes`. |
|
|
393
|
+
| **`assuranceDetailsRequired`** | <code>boolean</code> | Whether Google Pay should include assurance details about the selected card. |
|
|
394
|
+
| **`billingAddressRequired`** | <code>boolean</code> | Whether a billing address is required from the buyer. |
|
|
395
|
+
| **`billingAddressParameters`** | <code><a href="#googlepaybillingaddressparameters">GooglePayBillingAddressParameters</a></code> | Additional billing-address controls used when `billingAddressRequired` is `true`. |
|
|
396
|
+
| **`cardNetworkParameters`** | <code>GooglePayCardNetworkParameters[]</code> | Optional network-specific processing parameters for supported networks. |
|
|
397
|
+
| **`cvcRequired`** | <code>boolean</code> | Whether the card verification code should be returned in the payment token. This requires Google enablement for your account. |
|
|
365
398
|
|
|
366
399
|
|
|
367
400
|
#### GooglePayBillingAddressParameters
|
|
368
401
|
|
|
369
|
-
| Prop | Type
|
|
370
|
-
| ------------------------- |
|
|
371
|
-
| **`format`** | <code
|
|
372
|
-
| **`phoneNumberRequired`** | <code>boolean</code>
|
|
402
|
+
| Prop | Type | Description |
|
|
403
|
+
| ------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
404
|
+
| **`format`** | <code><a href="#googlepaybillingaddressformat">GooglePayBillingAddressFormat</a></code> | Billing address format to return when `billingAddressRequired` is `true`. Use `FULL` only when you truly need the extra fields to complete the order. |
|
|
405
|
+
| **`phoneNumberRequired`** | <code>boolean</code> | Whether a billing phone number should also be returned. |
|
|
373
406
|
|
|
374
407
|
|
|
375
|
-
####
|
|
408
|
+
#### GooglePayCardNetworkParameters
|
|
376
409
|
|
|
377
|
-
| Prop
|
|
378
|
-
|
|
|
379
|
-
| **`
|
|
380
|
-
| **`
|
|
410
|
+
| Prop | Type | Description |
|
|
411
|
+
| ------------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
412
|
+
| **`cardNetwork`** | <code><a href="#googlepaycardnetwork">GooglePayCardNetwork</a></code> | Card network these network-specific parameters apply to. |
|
|
413
|
+
| **`acquirerBin`** | <code>string</code> | Acquiring institution identification code used by some network-specific flows. |
|
|
414
|
+
| **`acquirerMerchantId`** | <code>string</code> | Acquirer-assigned merchant identifier used by some network-specific flows. |
|
|
381
415
|
|
|
382
416
|
|
|
383
|
-
####
|
|
417
|
+
#### GooglePayGatewayTokenizationSpecification
|
|
418
|
+
|
|
419
|
+
| Prop | Type | Description |
|
|
420
|
+
| ---------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
421
|
+
| **`type`** | <code>'PAYMENT_GATEWAY'</code> | Tokenize payment data for a supported third-party gateway. |
|
|
422
|
+
| **`parameters`** | <code><a href="#googlepaypaymentgatewaytokenizationparameters">GooglePayPaymentGatewayTokenizationParameters</a></code> | Gateway-specific tokenization parameters. |
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
#### GooglePayPaymentGatewayTokenizationParameters
|
|
426
|
+
|
|
427
|
+
Tokenization parameters for `PAYMENT_GATEWAY` tokenization, which sends the payment data to a supported third-party gateway for tokenization and processing.
|
|
428
|
+
|
|
429
|
+
| Prop | Type | Description |
|
|
430
|
+
| ----------------------- | ------------------- | ----------------------------------------------------------------- |
|
|
431
|
+
| **`gateway`** | <code>string</code> | Google Pay gateway identifier. |
|
|
432
|
+
| **`gatewayMerchantId`** | <code>string</code> | Merchant identifier issued by your payment gateway when required. |
|
|
384
433
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
|
389
|
-
|
|
|
434
|
+
|
|
435
|
+
#### GooglePayDirectTokenizationSpecification
|
|
436
|
+
|
|
437
|
+
| Prop | Type | Description |
|
|
438
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
439
|
+
| **`type`** | <code>'DIRECT'</code> | Tokenize payment data directly for merchant-side decryption. |
|
|
440
|
+
| **`parameters`** | <code><a href="#googlepaydirecttokenizationparameters">GooglePayDirectTokenizationParameters</a></code> | Direct tokenization parameters for payment data cryptography. |
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
#### GooglePayDirectTokenizationParameters
|
|
444
|
+
|
|
445
|
+
| Prop | Type | Description |
|
|
446
|
+
| --------------------- | ------------------- | -------------------------------------------------------------------------- |
|
|
447
|
+
| **`protocolVersion`** | <code>string</code> | Payment data cryptography protocol version. |
|
|
448
|
+
| **`publicKey`** | <code>string</code> | Base64-encoded elliptic-curve public key used to encrypt the payment data. |
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
#### GooglePayCustomTokenizationSpecification
|
|
452
|
+
|
|
453
|
+
| Prop | Type | Description |
|
|
454
|
+
| ---------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
455
|
+
| **`type`** | <code><a href="#googlepaytokenizationtype">GooglePayTokenizationType</a></code> | Tokenization type understood by your Google Pay integration. |
|
|
456
|
+
| **`parameters`** | <code><a href="#record">Record</a><string, string></code> | Tokenization parameters. Google Pay expects string values. |
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
#### ApplePayRequestPaymentResult
|
|
460
|
+
|
|
461
|
+
| Prop | Type | Description |
|
|
462
|
+
| -------------- | ----------------------------------------------------------------------- | ------------------------------------------- |
|
|
463
|
+
| **`platform`** | <code>'ios'</code> | Platform that resolved the payment request. |
|
|
464
|
+
| **`apple`** | <code><a href="#applepaypaymentresult">ApplePayPaymentResult</a></code> | Apple Pay payment payload. |
|
|
390
465
|
|
|
391
466
|
|
|
392
467
|
#### ApplePayPaymentResult
|
|
@@ -411,11 +486,100 @@ The native Android implementation still accepts arbitrary JSON (forward compatib
|
|
|
411
486
|
| **`postalAddress`** | <code>{ street?: string; city?: string; state?: string; postalCode?: string; country?: string; isoCountryCode?: string; subAdministrativeArea?: string; subLocality?: string; }</code> |
|
|
412
487
|
|
|
413
488
|
|
|
489
|
+
#### GooglePayRequestPaymentResult
|
|
490
|
+
|
|
491
|
+
| Prop | Type | Description |
|
|
492
|
+
| -------------- | ------------------------------------------------------------------------- | ------------------------------------------- |
|
|
493
|
+
| **`platform`** | <code>'android'</code> | Platform that resolved the payment request. |
|
|
494
|
+
| **`google`** | <code><a href="#googlepaypaymentresult">GooglePayPaymentResult</a></code> | Google Pay payment payload. |
|
|
495
|
+
|
|
496
|
+
|
|
414
497
|
#### GooglePayPaymentResult
|
|
415
498
|
|
|
416
|
-
| Prop | Type
|
|
417
|
-
| ----------------- |
|
|
418
|
-
| **`paymentData`** | <code><a href="#
|
|
499
|
+
| Prop | Type | Description |
|
|
500
|
+
| ----------------- | --------------------------------------------------------------------- | ------------------------------------ |
|
|
501
|
+
| **`paymentData`** | <code><a href="#googlepaypaymentdata">GooglePayPaymentData</a></code> | Payment data returned by Google Pay. |
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
#### GooglePayPaymentData
|
|
505
|
+
|
|
506
|
+
| Prop | Type | Description |
|
|
507
|
+
| ------------------------ | ------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
508
|
+
| **`apiVersion`** | <code>number</code> | Google Pay API major version returned in the response. |
|
|
509
|
+
| **`apiVersionMinor`** | <code>number</code> | Google Pay API minor version returned in the response. |
|
|
510
|
+
| **`email`** | <code>string</code> | Buyer email address when `emailRequired` was requested. |
|
|
511
|
+
| **`shippingAddress`** | <code><a href="#googlepayaddress">GooglePayAddress</a></code> | Shipping address when `shippingAddressRequired` was requested. |
|
|
512
|
+
| **`paymentMethodData`** | <code><a href="#googlepaypaymentmethoddata">GooglePayPaymentMethodData</a></code> | Selected payment method details and tokenized payload. |
|
|
513
|
+
| **`offerData`** | <code><a href="#googlepayofferdata">GooglePayOfferData</a></code> | Offer redemption data when an offer was applied. |
|
|
514
|
+
| **`shippingOptionData`** | <code><a href="#googlepayselectionoptiondata">GooglePaySelectionOptionData</a></code> | Selected shipping option data when shipping options were used. |
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
#### GooglePayAddress
|
|
518
|
+
|
|
519
|
+
| Prop | Type | Description |
|
|
520
|
+
| ------------------------------- | ------------------- | ----------------------------------------------------------------------------------- |
|
|
521
|
+
| **`name`** | <code>string</code> | Recipient or cardholder name. |
|
|
522
|
+
| **`address1`** | <code>string</code> | First address line. |
|
|
523
|
+
| **`address2`** | <code>string</code> | Second address line. |
|
|
524
|
+
| **`address3`** | <code>string</code> | Third address line. |
|
|
525
|
+
| **`locality`** | <code>string</code> | City or locality. |
|
|
526
|
+
| **`administrativeArea`** | <code>string</code> | State, province, or other administrative area. |
|
|
527
|
+
| **`countryCode`** | <code>string</code> | Two-letter ISO 3166-1 alpha-2 country code. |
|
|
528
|
+
| **`postalCode`** | <code>string</code> | Postal or ZIP code. |
|
|
529
|
+
| **`sortingCode`** | <code>string</code> | Sorting code used in some countries. |
|
|
530
|
+
| **`phoneNumber`** | <code>string</code> | Phone number returned when it was requested. |
|
|
531
|
+
| **`iso3166AdministrativeArea`** | <code>string</code> | ISO 3166-2 code for the administrative area when `FULL-ISO3166` formatting is used. |
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
#### GooglePayPaymentMethodData
|
|
535
|
+
|
|
536
|
+
| Prop | Type | Description |
|
|
537
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
538
|
+
| **`type`** | <code><a href="#googlepaypaymentmethodtype">GooglePayPaymentMethodType</a></code> | Payment method type returned by Google Pay. |
|
|
539
|
+
| **`info`** | <code><a href="#googlepaycardinfo">GooglePayCardInfo</a></code> | Additional information about the selected card. |
|
|
540
|
+
| **`description`** | <code>string</code> | User-facing description of the selected funding source. |
|
|
541
|
+
| **`tokenizationData`** | <code><a href="#googlepaypaymentmethodtokenizationdata">GooglePayPaymentMethodTokenizationData</a></code> | Tokenized payment data you send to your backend or processor. |
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
#### GooglePayCardInfo
|
|
545
|
+
|
|
546
|
+
| Prop | Type | Description |
|
|
547
|
+
| ----------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
548
|
+
| **`assuranceDetails`** | <code><a href="#googlepayassurancedetails">GooglePayAssuranceDetails</a></code> | Optional assurance details returned when `assuranceDetailsRequired` was requested. |
|
|
549
|
+
| **`cardNetwork`** | <code><a href="#googlepaycardnetwork">GooglePayCardNetwork</a></code> | Card network for the selected payment method. |
|
|
550
|
+
| **`cardDetails`** | <code>string</code> | Card details, typically the last four digits. |
|
|
551
|
+
| **`billingAddress`** | <code><a href="#googlepayaddress">GooglePayAddress</a></code> | Billing address returned when `billingAddressRequired` was requested. |
|
|
552
|
+
| **`cardFundingSource`** | <code><a href="#googlepaycardfundingsource">GooglePayCardFundingSource</a></code> | Funding source for the selected card when available. |
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
#### GooglePayAssuranceDetails
|
|
556
|
+
|
|
557
|
+
| Prop | Type | Description |
|
|
558
|
+
| ----------------------------- | -------------------- | ------------------------------------------------------------------------------ |
|
|
559
|
+
| **`accountVerified`** | <code>boolean</code> | Whether Google verified account possession for the selected card. |
|
|
560
|
+
| **`cardHolderAuthenticated`** | <code>boolean</code> | Whether cardholder authentication or ID&V was completed for the selected card. |
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
#### GooglePayPaymentMethodTokenizationData
|
|
564
|
+
|
|
565
|
+
| Prop | Type | Description |
|
|
566
|
+
| ----------- | ------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
567
|
+
| **`type`** | <code><a href="#googlepaytokenizationtype">GooglePayTokenizationType</a></code> | Tokenization type used for the selected payment method. |
|
|
568
|
+
| **`token`** | <code>string</code> | Serialized payment token or gateway payload. |
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
#### GooglePayOfferData
|
|
572
|
+
|
|
573
|
+
| Prop | Type | Description |
|
|
574
|
+
| --------------------- | --------------------- | -------------------------------------------- |
|
|
575
|
+
| **`redemptionCodes`** | <code>string[]</code> | Offer redemption codes applied by the buyer. |
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
#### GooglePaySelectionOptionData
|
|
579
|
+
|
|
580
|
+
| Prop | Type | Description |
|
|
581
|
+
| -------- | ------------------- | ---------------------------------- |
|
|
582
|
+
| **`id`** | <code>string</code> | Identifier of the selected option. |
|
|
419
583
|
|
|
420
584
|
|
|
421
585
|
#### PayPaymentOptions
|
|
@@ -485,34 +649,108 @@ The native Android implementation still accepts arbitrary JSON (forward compatib
|
|
|
485
649
|
|
|
486
650
|
#### GooglePayPaymentDataRequest
|
|
487
651
|
|
|
488
|
-
|
|
489
|
-
|
|
652
|
+
Self-contained Google Pay payment request type based on the official request objects and DefinitelyTyped definitions.
|
|
653
|
+
|
|
654
|
+
The plugin forwards the provided JSON to the native Google Pay SDK on Android, while keeping the type surface local
|
|
655
|
+
so consumers do not need to install `@types/googlepay`.
|
|
490
656
|
|
|
491
|
-
| Prop
|
|
492
|
-
|
|
|
493
|
-
| **`apiVersion`**
|
|
494
|
-
| **`apiVersionMinor`**
|
|
495
|
-
| **`
|
|
496
|
-
| **`
|
|
497
|
-
| **`transactionInfo`**
|
|
657
|
+
| Prop | Type | Description |
|
|
658
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
659
|
+
| **`apiVersion`** | <code>number</code> | Google Pay API major version. Use `2` for current integrations. |
|
|
660
|
+
| **`apiVersionMinor`** | <code>number</code> | Google Pay API minor version. Use `0` for current integrations. |
|
|
661
|
+
| **`merchantInfo`** | <code><a href="#googlepaymerchantinfo">GooglePayMerchantInfo</a></code> | Merchant information displayed in the Google Pay sheet. |
|
|
662
|
+
| **`allowedPaymentMethods`** | <code>GooglePayAllowedPaymentMethod[]</code> | Allowed payment method configurations. |
|
|
663
|
+
| **`transactionInfo`** | <code><a href="#googlepaytransactioninfo">GooglePayTransactionInfo</a></code> | Transaction details such as amount, currency, and checkout behavior. |
|
|
664
|
+
| **`emailRequired`** | <code>boolean</code> | Whether the buyer email address should be returned. |
|
|
665
|
+
| **`shippingAddressRequired`** | <code>boolean</code> | Whether a shipping address should be collected. |
|
|
666
|
+
| **`shippingAddressParameters`** | <code><a href="#googlepayshippingaddressparameters">GooglePayShippingAddressParameters</a></code> | Shipping-address restrictions used when `shippingAddressRequired` is `true`. |
|
|
667
|
+
| **`offerInfo`** | <code><a href="#googlepayofferinfo">GooglePayOfferInfo</a></code> | Merchant-provided offers to pre-populate in the Google Pay sheet. This is part of the official web request object and may not be supported by every native Android flow. |
|
|
668
|
+
| **`shippingOptionRequired`** | <code>boolean</code> | Whether the Google Pay sheet should collect a shipping option. This is part of the official web request object and is used with dynamic price updates. |
|
|
669
|
+
| **`shippingOptionParameters`** | <code><a href="#googlepayshippingoptionparameters">GooglePayShippingOptionParameters</a></code> | Default shipping options for the Google Pay sheet. This is part of the official web request object and is used with dynamic price updates. |
|
|
670
|
+
| **`callbackIntents`** | <code>GooglePayCallbackIntent[]</code> | Callback intents for dynamic price updates and payment authorization on the web. These values are included for completeness with the official Google Pay request object, but the Capacitor plugin does not currently expose the corresponding web callbacks. |
|
|
498
671
|
|
|
499
672
|
|
|
500
673
|
#### GooglePayMerchantInfo
|
|
501
674
|
|
|
502
|
-
| Prop | Type
|
|
503
|
-
| ------------------ |
|
|
504
|
-
| **`merchantId`** | <code>string</code> |
|
|
505
|
-
| **`merchantName`** | <code>string</code> |
|
|
675
|
+
| Prop | Type | Description |
|
|
676
|
+
| ------------------ | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
677
|
+
| **`merchantId`** | <code>string</code> | Google merchant identifier. This is required for recognized production web integrations and may also be supplied on Android. |
|
|
678
|
+
| **`merchantName`** | <code>string</code> | Merchant name displayed in the Google Pay sheet. |
|
|
679
|
+
| **`softwareInfo`** | <code><a href="#googlepaysoftwareinfo">GooglePaySoftwareInfo</a></code> | Optional metadata about the software integrating with Google Pay. |
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
#### GooglePaySoftwareInfo
|
|
683
|
+
|
|
684
|
+
| Prop | Type | Description |
|
|
685
|
+
| ------------- | ------------------- | ---------------------------------------------------------------------------------- |
|
|
686
|
+
| **`id`** | <code>string</code> | Identifier for the software integrating with Google Pay, such as your domain name. |
|
|
687
|
+
| **`version`** | <code>string</code> | Version of the integrating software. |
|
|
506
688
|
|
|
507
689
|
|
|
508
690
|
#### GooglePayTransactionInfo
|
|
509
691
|
|
|
510
|
-
| Prop | Type |
|
|
511
|
-
| ---------------------- | ------------------------------------------------------------------------------- |
|
|
512
|
-
| **`
|
|
513
|
-
| **`
|
|
514
|
-
| **`
|
|
515
|
-
| **`
|
|
692
|
+
| Prop | Type | Description |
|
|
693
|
+
| ---------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
694
|
+
| **`transactionId`** | <code>string</code> | Merchant-generated correlation identifier for the transaction. |
|
|
695
|
+
| **`currencyCode`** | <code>string</code> | ISO 4217 alphabetic currency code. Google Pay requires this for chargeable payment requests. |
|
|
696
|
+
| **`countryCode`** | <code>string</code> | ISO 3166-1 alpha-2 country code where the transaction is processed. This is required for EEA/SCA flows and recommended for country-specific behavior. |
|
|
697
|
+
| **`totalPrice`** | <code>string</code> | Total transaction price using an optional decimal precision of two decimal places. |
|
|
698
|
+
| **`totalPriceLabel`** | <code>string</code> | Custom total label shown with `displayItems`. |
|
|
699
|
+
| **`totalPriceStatus`** | <code><a href="#googlepaytotalpricestatus">GooglePayTotalPriceStatus</a></code> | Status of the total price. |
|
|
700
|
+
| **`transactionNote`** | <code>string</code> | Optional transaction note. Some payment methods, such as UPI on web, require this. |
|
|
701
|
+
| **`checkoutOption`** | <code><a href="#googlepaycheckoutoption">GooglePayCheckoutOption</a></code> | Controls the submit button label shown in the Google Pay sheet. |
|
|
702
|
+
| **`displayItems`** | <code>GooglePayDisplayItem[]</code> | Optional cart line items shown in the Google Pay sheet. |
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
#### GooglePayDisplayItem
|
|
706
|
+
|
|
707
|
+
| Prop | Type | Description |
|
|
708
|
+
| ------------ | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
709
|
+
| **`label`** | <code>string</code> | User-visible line-item label. |
|
|
710
|
+
| **`type`** | <code><a href="#googlepaydisplayitemtype">GooglePayDisplayItemType</a></code> | Category of the line item. |
|
|
711
|
+
| **`price`** | <code>string</code> | Monetary value for the item. Google Pay accepts an optional decimal precision of two decimal places. |
|
|
712
|
+
| **`status`** | <code><a href="#googlepaydisplayitemstatus">GooglePayDisplayItemStatus</a></code> | Whether this line item is final or still pending. |
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
#### GooglePayShippingAddressParameters
|
|
716
|
+
|
|
717
|
+
| Prop | Type | Description |
|
|
718
|
+
| ------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
719
|
+
| **`allowedCountryCodes`** | <code>string[]</code> | Restricts shipping addresses to the provided ISO 3166-1 alpha-2 country codes. |
|
|
720
|
+
| **`phoneNumberRequired`** | <code>boolean</code> | Whether a phone number should be collected with the shipping address. |
|
|
721
|
+
| **`format`** | <code><a href="#googlepayshippingaddressformat">GooglePayShippingAddressFormat</a></code> | Shipping address format to return when `shippingAddressRequired` is `true`. `MIN` is not a valid value for shipping addresses. |
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
#### GooglePayOfferInfo
|
|
725
|
+
|
|
726
|
+
| Prop | Type | Description |
|
|
727
|
+
| ------------ | ----------------------------------- | --------------------------------------------------------- |
|
|
728
|
+
| **`offers`** | <code>GooglePayOfferDetail[]</code> | Merchant-provided offers available for the current order. |
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
#### GooglePayOfferDetail
|
|
732
|
+
|
|
733
|
+
| Prop | Type | Description |
|
|
734
|
+
| -------------------- | ------------------- | ------------------------------------------ |
|
|
735
|
+
| **`redemptionCode`** | <code>string</code> | Redemption code that identifies the offer. |
|
|
736
|
+
| **`description`** | <code>string</code> | User-visible description for the offer. |
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
#### GooglePayShippingOptionParameters
|
|
740
|
+
|
|
741
|
+
| Prop | Type | Description |
|
|
742
|
+
| ----------------------------- | --------------------------------------- | --------------------------------------------------- |
|
|
743
|
+
| **`shippingOptions`** | <code>GooglePaySelectionOption[]</code> | Available shipping options presented to the buyer. |
|
|
744
|
+
| **`defaultSelectedOptionId`** | <code>string</code> | Identifier of the default selected shipping option. |
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
#### GooglePaySelectionOption
|
|
748
|
+
|
|
749
|
+
| Prop | Type | Description |
|
|
750
|
+
| ----------------- | ------------------- | ----------------------------------------------------- |
|
|
751
|
+
| **`id`** | <code>string</code> | Unique identifier for the option. |
|
|
752
|
+
| **`label`** | <code>string</code> | User-visible label for the option. |
|
|
753
|
+
| **`description`** | <code>string</code> | Optional secondary description shown under the label. |
|
|
516
754
|
|
|
517
755
|
|
|
518
756
|
### Type Aliases
|
|
@@ -533,6 +771,11 @@ The native Android implementation still accepts arbitrary JSON (forward compatib
|
|
|
533
771
|
<code>'test' | 'production'</code>
|
|
534
772
|
|
|
535
773
|
|
|
774
|
+
#### GooglePayPaymentMethodType
|
|
775
|
+
|
|
776
|
+
<code>'CARD' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
777
|
+
|
|
778
|
+
|
|
536
779
|
#### Record
|
|
537
780
|
|
|
538
781
|
Construct a type with a set of properties K of type T
|
|
@@ -547,14 +790,32 @@ Construct a type with a set of properties K of type T
|
|
|
547
790
|
|
|
548
791
|
#### GooglePayCardNetwork
|
|
549
792
|
|
|
550
|
-
<code>'AMEX' | 'DISCOVER' | 'JCB' | 'MASTERCARD' | 'VISA' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
793
|
+
<code>'AMEX' | 'DISCOVER' | 'ELECTRON' | 'ELO' | 'ELO_DEBIT' | 'INTERAC' | 'JCB' | 'MAESTRO' | 'MASTERCARD' | 'VISA' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
#### GooglePayBillingAddressFormat
|
|
551
797
|
|
|
798
|
+
<code>'MIN' | 'FULL' | 'FULL-ISO3166' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
552
799
|
|
|
553
|
-
#### Exclude
|
|
554
800
|
|
|
555
|
-
|
|
801
|
+
#### GooglePayTokenizationSpecification
|
|
802
|
+
|
|
803
|
+
<code><a href="#googlepaygatewaytokenizationspecification">GooglePayGatewayTokenizationSpecification</a> | <a href="#googlepaydirecttokenizationspecification">GooglePayDirectTokenizationSpecification</a> | <a href="#googlepaycustomtokenizationspecification">GooglePayCustomTokenizationSpecification</a></code>
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
#### GooglePayTokenizationType
|
|
556
807
|
|
|
557
|
-
<code>
|
|
808
|
+
<code>'PAYMENT_GATEWAY' | 'DIRECT' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
#### PayPaymentResult
|
|
812
|
+
|
|
813
|
+
<code><a href="#applepayrequestpaymentresult">ApplePayRequestPaymentResult</a> | <a href="#googlepayrequestpaymentresult">GooglePayRequestPaymentResult</a></code>
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
#### GooglePayCardFundingSource
|
|
817
|
+
|
|
818
|
+
<code>'UNKNOWN' | 'CREDIT' | 'DEBIT' | 'PREPAID' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
558
819
|
|
|
559
820
|
|
|
560
821
|
#### ApplePaySummaryItemType
|
|
@@ -586,4 +847,29 @@ Construct a type with a set of properties K of type T
|
|
|
586
847
|
|
|
587
848
|
<code>'NOT_CURRENTLY_KNOWN' | 'ESTIMATED' | 'FINAL' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
588
849
|
|
|
850
|
+
|
|
851
|
+
#### GooglePayCheckoutOption
|
|
852
|
+
|
|
853
|
+
<code>'DEFAULT' | 'COMPLETE_IMMEDIATE_PURCHASE' | 'CONTINUE_TO_REVIEW' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
#### GooglePayDisplayItemType
|
|
857
|
+
|
|
858
|
+
<code>'LINE_ITEM' | 'SUBTOTAL' | 'TAX' | 'DISCOUNT' | 'SHIPPING_OPTION' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
#### GooglePayDisplayItemStatus
|
|
862
|
+
|
|
863
|
+
<code>'FINAL' | 'PENDING' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
#### GooglePayShippingAddressFormat
|
|
867
|
+
|
|
868
|
+
<code>'FULL' | 'FULL-ISO3166' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
#### GooglePayCallbackIntent
|
|
872
|
+
|
|
873
|
+
<code>'OFFER' | 'PAYMENT_AUTHORIZATION' | 'SHIPPING_ADDRESS' | 'SHIPPING_OPTION' | 'PAYMENT_METHOD' | (string & <a href="#record">Record</a><never, never>)</code>
|
|
874
|
+
|
|
589
875
|
</docgen-api>
|
package/android/build.gradle
CHANGED
|
@@ -30,7 +30,7 @@ android {
|
|
|
30
30
|
buildTypes {
|
|
31
31
|
release {
|
|
32
32
|
minifyEnabled false
|
|
33
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
lintOptions {
|