Download the PHP package bijay-x/laravel-in-app-purchase without Composer

On this page you can find all versions of the php package bijay-x/laravel-in-app-purchase. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-in-app-purchase

Laravel In-App Purchase Verification Package

A production-ready Laravel package for server-side verification of in-app purchases and subscriptions for both Apple App Store (iOS) and Google Play Store (Android).

Features

Requirements

Installation

1. Install via Composer

2. Publish Configuration

3. Publish Migrations

Configuration

Environment Variables

Add these to your .env file:

Apple App Store Setup

  1. Go to App Store Connect
  2. Navigate to your app → App Information → App-Specific Shared Secret
  3. Generate or copy your shared secret
  4. Add it to your .env file as IAP_APPLE_SHARED_SECRET

Google Play Store Setup

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Play Android Developer API
  4. Create a Service Account:
    • Go to IAM & Admin → Service Accounts
    • Create a new service account
    • Download the JSON key file
  5. Link the service account to your Google Play Console:
    • Go to Google Play Console → Settings → API access
    • Link your service account
    • Grant View financial data permission
  6. Place the JSON file in storage/app/private/google-service-account.json
  7. Update .env with the path: IAP_GOOGLE_SERVICE_ACCOUNT_PATH=storage/app/private/google-service-account.json

Usage

Basic Verification

Using the Facade

Using Dependency Injection

API Endpoint

The package provides a ready-to-use API endpoint:

POST /api/iap/verify

Request Body:

Response:

Flutter Integration Example

iOS (Apple)

Android (Google)

React Native Integration Example

iOS

Android

Webhooks

The package includes webhook endpoints for real-time subscription updates from Apple and Google.

Apple Webhook

POST /api/iap/webhook/ios or /api/iap/webhook/apple

Configure this URL in App Store Connect:

  1. Go to App Store Connect → Your App → App Information
  2. Set the Server Notification URL to: https://your-api.com/api/iap/webhook/ios

Google Webhook

POST /api/iap/webhook/android or /api/iap/webhook/google

Configure this URL in Google Play Console:

  1. Go to Google Play Console → Your App → Monetization → Subscriptions
  2. Set the Real-time developer notifications URL to: https://your-api.com/api/iap/webhook/android

Webhook Payload Examples

Apple Notification Types

Google Notification Types

Database Schema

The package creates an iap_subscriptions table with the following structure:

VerificationResult DTO

The VerificationResult DTO provides useful methods:

Security Best Practices

  1. Always verify on the server: Never trust client-side purchase data
  2. Use HTTPS: All API endpoints should use HTTPS
  3. Authenticate requests: Add authentication middleware to protect endpoints
  4. Validate user ownership: Ensure the user_id matches the authenticated user
  5. Store credentials securely: Never commit service account files or shared secrets to version control
  6. Rate limiting: Implement rate limiting on verification endpoints
  7. Logging: Monitor logs for suspicious activity

Adding Authentication Middleware

Error Handling

The package handles various error scenarios:

Check the raw_data field in VerificationResult for detailed error information.

Testing

Apple Sandbox Testing

  1. Use sandbox test accounts in App Store Connect
  2. Test purchases will automatically fallback to sandbox URL
  3. Sandbox receipts expire after a short period

Google Testing

  1. Use test accounts in Google Play Console
  2. Test purchases are automatically handled
  3. Use the Google Play Console to manage test subscriptions

Troubleshooting

Apple Verification Issues

Google Verification Issues

License

MIT

Support

For issues, questions, or contributions, please visit the GitHub repository.

Changelog

1.0.0


All versions of laravel-in-app-purchase with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0
google/apiclient Version ^2.15
nesbot/carbon Version ^2.0|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bijay-x/laravel-in-app-purchase contains the following files

Loading the files please wait ...