0
votes

Im my scenario I would like to offer a service with pay per mins price, I don't know the final price until the user press stop button.

the idea is to pre-authorize payment and when user finish to use that service execute the transaction.

Is it possible with Google Pay to pre-authorize a payment with unknown price?

I know with ApplePay we can archive something like that by creating a PKPaymentSummaryItem with non-zero positive integers price and PKPaymentSummaryItemType.pending as type.

2

2 Answers

2
votes

Because Google Pay is only involved in facilitating the payment, and not the actual payment processing, the pre-authorization will need to be handled between you and your payment processor (see list of supported payment processors).

The process will look something like this:

  1. Request Google Pay payment data (returns a payment token),
  2. Call your payment processor with payment token from step 1 to create a pre-authorization with estimated amount,
  3. Determine the actual charge amount
  4. Capture the pre-authorization with the actual amount with your payment processor

I don't know which payment processor you are using, but Stripe documentation should give you a good example of what is required for steps 2 & 4.

1
votes

This scenario like "pay as you go" is not currently supported by Google Play Billing services and library.

Only items or subscriptions with fixed prices can be purchased by users.

The current supported items are here: https://developer.android.com/google/play/billing/billing_overview#in-app-product-types

I don't know if there are services or workarounds which enables you to use this form of payment but even if they exist I think you will have trouble against the Google Play In-App billing policies.