remp / crm-google-play-billing-module
CRM GooglePlay Billing Module
Installs: 2 565
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^8.1
- aporat/store-receipt-validator: ^4.2
- google/apiclient: ^2.9
- dev-master
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.2.0
- 1.1.0
- 1.0.1
- 1.0.0
- 1.0.0-beta2
- 1.0.0-beta1
- 0.39.0
- 0.38.0
- 0.37.0
- 0.36.0
- 0.35.0
- 0.34.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.0
- 0.22.0
- 0.21.0
- 0.20.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
This package is auto-updated.
Last update: 2024-10-25 12:19:12 UTC
README
Installation
We recommend using Composer for installation and update management. To add CRM GooglePlay Billing extension to your REMP CRM application use following command:
composer require remp/crm-google-play-billing-module
Enable installed extension in your app/config/config.neon
file:
extensions: # ... - Crm\GooglePlayBillingModule\DI\GooglePlayBillingModuleExtension
Add database tables and seed GooglePlay Billing payment gateway and its configuration:
php bin/command.php phinx:migrate php bin/command.php application:seed
Configuration
Payment notifications
To be able to read pub/sub notifications generated by your payments, CRM needs to be able to have an access to your Pub/Sub notifications account via service account credentials.
Head to the Google Developer Console - Credentials and generate new Service account JSON key and download it.
Make sure you're generating the key for the same project and same service account, that's linked to your Google Play console - Developer account - API access.
Enter path to service account JSON with access to Google Play into CRM configuration:
- Visit to CRM admin settings (gear icon).
- Select Payments category.
- Enter path to Google Play Service Account key.
Mapping subscriptions
GooglePlay's in-app subscription is mapped to CRM subscription type via relation table google_play_billing_subscription_types
.
We'll be adding administration interface later. For now it's needed to seed these mapping data manually.
Matching payments with CRM users
GooglePlay's in-app subscription is mapped to CRM users via obfuscatedExternalAccountId
field of SubscriptionResponse
. This field is present in Google Play Billing library v2.2.
For previous version (<2.2) of Google Play Billing library, you have to set field obfuscatedExternalAccountId
into DeveloperPayload. This is deprecated and will be removed after official SubscriptionResponse
in Google's package google/apiclient-services
is updated and response contains getObfuscatedExternalAccountId()
method.
If user cannot be matched, processor creates anonymous unclaimed user (user with user_meta
flag UnclaimedUser::META_KEY
set to true). This is needed to fulfill Google's rules - user registration cannot be prerequisite of Android in-app purchases.
In case you need to link CRM user with app user in different way, you can override it by implementing SubscriptionResponseProcessorInterface
and initializing own implementation as subscriptionResponseProcessor
in config:
subscriptionResponseProcessor: Crm\FooModule\GoogleBillingSubscriptionResponse\MyFooBarSubscriptionResponseProcessor
Commands
google:revalidate-developer-notification
Command serves to revalidate developer notification against Google Billing service.
Support
- Google Play Developer API version 3 is supported.
- Only version 1.0 of DeveloperNotification is supported.
- Only version 1.0 of SubscriptionNotification is supported.
- One-time products are not supported.
- Free trial is accepted without checking if user (MUID) used trial already. We rely on Google; it shouldn't allow multiple free trials for one credit card.