Petr Hudík
Petr Hudík

Reputation: 11

Handling Subscription Plan Selection in Google Play for a PWA App

I have the PWA app installed via the GooglePlay store. I use the following code in the app to create a subscription.

        const paymentMethodData = [
          {
            supportedMethods: 'https://play.google.com/billing',
            data: {
              sku: 'my_subscription_id',
            },
          },
        ];
        const request = new PaymentRequest(paymentMethodData);
        const paymentResponse = await request.show();
        const purchaseToken = paymentResponse.details.purchaseToken;

After the user pays the subscription, I confirm the payment on the backend. But as a user in the Google play settings Confirm Plan.

Google play subscription

How can I select a plan in google play? In subscription settings I have only one active plan, I don't understand why I should select a plan.

The Google Play Billing API documentation says to add a "sku" to the request, which is the ID of the product. That's why I put the subscription id in there, if I add the plan id to the SKU it will return an error.

I didn't find any mention in the documentation about the ability for the user to select the plan - I don't even know whether to specify this on the frontend or the backend.

Upvotes: 1

Views: 313

Answers (0)

Related Questions