Skip to content

MuhammadQuran17/ppp_stripe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purchasing Power Parity by country with Stripe or other payment gateway (Laravel & Cashier)

"Buy Me A Coffee"

Detailed article is availabe at https://docs.agenytics.com/blog/ppp-stripe

Implementing Purchasing Power Parity (PPP) pricing per country for a Stripe Checkout purchase flow. But you can use it for any other payment gateway, like PayPal, Paddle, Lemon Squeezy, etc. This package uses World Bank PPP data and TrustIP to detect VPN/Proxy.

Installation in Existing Laravel Project

  1. Install the package

    composer require muhammad-umar/ppp-gateway
  2. Publish the assets

    # PPP Data CSV
    php artisan vendor:publish --tag="ppp-gateway-data"

    Optional: You can also publish the config and migrations files:

    php artisan vendor:publish --tag="ppp-gateway-config"
    php artisan vendor:publish --tag="ppp-gateway-migrations"
  3. Run migrations

    php artisan migrate
  4. Import PPP data

    php artisan import:ppp

We have used lifetime product for demonstration purposes. You can use any other product you want.

  1. Configure environment variables

    STRIPE_LIFETIME_PRODUCT_ID=prod_xxxxx
    TRUSTIP_API_KEY=your_trustip_api_key
  2. Configure subscription plans

We have subscription-plans.php config file for payment products. You can configure it as you want. You should use this data to show price in frontend, sending PPPService->getAdjustedPriceData() parameter from your Controller.

  1. Checkout page

From fronted you should send a POST request to /purchase route (see PPPGatewayServiceProvider.php for route registration). It is binded to PurchaseController that will create a checkout session with adjusted price for the selected country.

License

MIT

About

Purchasing Power Parity by country with Stripe or other payment gateway (Laravel, Cashier) using data from World Bank

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages