Skip to main content

Installation

Install the package via composer:

composer require imdhemy/laravel-purchases

Configuration

Publish the config file:

php artisan liap:config:publish

This creates a file config/liap.php that contains the following configuration keys:

  • routing: (array) Allows you to add custom routing configurations.
  • google_play_package_name: (string) The default Google play package name.
  • appstore_password: (string) The default App Store password.
  • eventListeners: (array) A List of Store events and event handlers.

The Following keys are only required if you are going to request a test notification from the App Store:

  • appstore_private_key_id: (string) Your private key ID from App Store connect (EX: 2X9R4HXF34).
  • appstore_private_key: (string) The path to your private key file (Ex: /path/to/SuperSecretKey_ABC123.p8).
  • appstore_issuer_id: (string) Your issuer ID from the Keys page in App Store Connect (Ex: 57246542-96fe-1a63-e053-0824d011072a).
  • appstore_bundle_id: (string) Your app’s bundle ID (Ex: com.example.testbundleid2021).
caution

You need to set up Google Play Account Credentials. It's not added to the config/liap.php file. Follow this 👉 Guide to set it up.

Routing

LIAP provides you a route to receive the server notifications. The routing key allows you to secure this route. Check the routing document for detailed information.

Event Listeners

Server Notifications is a server-to-server service that notifies you in real time when the status of in-app purchases and refunds changes. Use the data in the notifications to update your user-account database, and to monitor and respond to in-app purchase refunds.

LIAP provides you with a complete list of events that you can listen to. Check Event Listeners to learn how to use them.