All Projects → KeepSafe → Cashier

KeepSafe / Cashier

Licence: Apache-2.0 license
A Better Billing Provider for Android.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cashier

Stripe Billing Typographic
⚡️Typographic is a webfont service (and demo) built with Stripe Billing.
Stars: ✭ 186 (+615.38%)
Mutual labels:  billing
flattr-extension
Flattr web extension - monetize your content effortlessly.
Stars: ✭ 25 (-3.85%)
Mutual labels:  monetization
Nodetube
Open-source YouTube alternative that offers video, audio and image uploads, livestreaming and built-in monetization
Stars: ✭ 2,066 (+7846.15%)
Mutual labels:  monetization
Invoiceneko
An Open Sourced Invoice System developed for anyone who needs to generate out an invoice and manage clients
Stars: ✭ 204 (+684.62%)
Mutual labels:  billing
TeadsSDK-iOS
Teads SDK iOS Sample App - Check out an open-source sample of the Teads iOS SDK implementation
Stars: ✭ 22 (-15.38%)
Mutual labels:  monetization
Android-MonetizeApp
A sample which uses Google's Play Billing Library and it makes In-app Purchases and Subscriptions.
Stars: ✭ 149 (+473.08%)
Mutual labels:  monetization
Commerce billing
A payment processing library for Elixir
Stars: ✭ 170 (+553.85%)
Mutual labels:  billing
automated-p2p-transactions
Payme orqali p2p to'lovlarni avtomatlashtirish
Stars: ✭ 29 (+11.54%)
Mutual labels:  billing
cryptoloot
Self Hosted Library for CryptoLoot
Stars: ✭ 46 (+76.92%)
Mutual labels:  monetization
akita
A browser extension that gives you insight into your engagement with Web Monetization.
Stars: ✭ 21 (-19.23%)
Mutual labels:  monetization
Ledgersmb
Repository for the LedgerSMB project -- web app for accounting & ERP
Stars: ✭ 222 (+753.85%)
Mutual labels:  billing
vlitejs
🦋 vLitejs is a fast and lightweight Javascript library for customizing video and audio player in Javascript with a minimalist theme (HTML5, Youtube, Vimeo, Dailymotion)
Stars: ✭ 162 (+523.08%)
Mutual labels:  monetization
academy
🎓 Video tutorials, slide decks and other training materials for developers learning about the FIWARE ecosystem.
Stars: ✭ 12 (-53.85%)
Mutual labels:  monetization
Killbill
Open-Source Subscription Billing & Payments Platform
Stars: ✭ 2,396 (+9115.38%)
Mutual labels:  billing
recurly
A Recurly API client written in golang. Actively maintained and unit tested. No external dependencies.
Stars: ✭ 40 (+53.85%)
Mutual labels:  billing
Node Sales Tax
💰 International sales tax calculator for Node (offline, but provides optional online VAT number fraud check). Tax rates are kept up-to-date.
Stars: ✭ 182 (+600%)
Mutual labels:  billing
ads-for-wp
We are innovating in the Ads space by creating a Lightweight, Easy & Feature Rich Ad solution for WP & AMP
Stars: ✭ 17 (-34.62%)
Mutual labels:  monetization
subscribie
Collect recurring payments online - subscription payments collection automation
Stars: ✭ 36 (+38.46%)
Mutual labels:  billing
killbill-stripe-plugin
Kill Bill plugin for Stripe
Stars: ✭ 16 (-38.46%)
Mutual labels:  billing
DefVideoAds
UnityAds native extension for Defold engine.
Stars: ✭ 37 (+42.31%)
Mutual labels:  monetization

Cashier
Cashier

Build Status Maven Central Release

A general, easy to use billing provider for Android. Provides support for Google Play's in-app billing.

Min SDK: 9

JavaDoc

Overview

Managing multiple billing services in your Android app is a painful experience when each billing service has their own way of doing things. It becomes worse when each service imposes their own way of doing things, such as requiring the handling of a billing result in onActivityResult.

Cashier takes aim to resolve these issues by providing a single consistent API design with different underlying implementations so that you can write your billing code once and easily swap billing providers.

Cashier also aims to bridge the gap between development testing and production testing. When talking about Google Play's in-app-billing, in order to test the full flow of a subscription purchase you need to create a signed APK, upload it to some release channel, add your email to the list of purchase testers, wait a few (or several) hours and then finally test your code. If your code works (which it likely wont, first try) then you're good, however if it doesn't, you're going to have to do the same thing over again. This is obviously not efficient or very nice to develop for. Cashier solves this issue by simulating Google Play as a fake vendor (under the iab-debug module). The fake IAB vendor will respond as if you were talking to Google Play in production. This means you can test your purchase flow while you write the code, rather than creating a signed APK each time. With that, here's a list of features Cashier has:

Features

  • Google Play's In-App-Billing (IAB) - Deprecated

    • Purchasing for products and subscriptions, consuming for consumable products
    • Fake checkout, facilitating faster development
    • Local receipt verification
    • Inventory querying
  • Google Play Billing

    • Purchasing for products and subscriptions, consuming for consumable products
    • Fake checkout, facilitating faster development
    • Local receipt verification
    • Inventory querying
    • For now, developer payload is not supported (will be added in GPB v2)

Installation

Cashier is distributed using MavenCentral.

repositories {
  mavenCentral()
}

dependencies {
  compile 'com.getkeepsafe.cashier:cashier:x.x.x' // Core library, required

  // Google Play Billing
  compile 'com.getkeepsafe.cashier:cashier-google-play-billing:x.x.x'
  debugCompile 'com.getkeepsafe.cashier:cashier-google-play-billing-debug:x.x.x' // For fake checkout and testing
}

Usage

General usage is as follows:

// First choose a vendor
final Vendor vendor = new GooglePlayBillingVendor();

// Get a product to buy
final Product product = Product.create(
  vendor.id(),              // The vendor that produces this product
  "my.sku",                 // The SKU of the product
  "$0.99",                  // The display price of the product
  "USD",                    // The currency of the display price
  "My Awesome Product",     // The product's title
  "Provides awesomeness!",  // The product's description
  false,                    // Whether the product is a subscription or not (consumable)
  990_000L);                // The product price in micros

// Then when you are in your purchasing activity,
// set up your listener
final PurchaseListener listener = new PurchaseListener() {
  @Override
  public void success(Purchase purchase) {
    // Yay, now verify the purchase.receipt() with your backend
  }

  @Override
  public void failure(Product product, Vendor.Error error) {
    // Uh-oh, check error.code to see what went wrong
  }
};

// And kick off the purchase!
final Cashier cashier = Cashier.forVendor(activity, vendor);
cashier.purchase(activity, product, "my custom dev payload", listener);

To test app in debug mode with fake purchase flow:

// Create vendor with fake API implementation
vendor = new GooglePlayBillingVendor(
                new FakeGooglePlayBillingApi(MainActivity.this,
                FakeGooglePlayBillingApi.TEST_PUBLIC_KEY));

// Add products definitions
final Product product = Product.create(
  vendor.id(),              // The vendor that produces this product
  "my.sku",                 // The SKU of the product
  "$0.99",                  // The display price of the product
  "USD",                    // The currency of the display price
  "My Awesome Product",     // The product's title
  "Provides awesomeness!",  // The product's description
  false,                    // Whether the product is a subscription or not (consumable)
  990_000L);                // The product price in micros

FakeGooglePlayBillingApi.addTestProduct(product)

FakeGooglePlayBillingApi uses predefined private key to sign purchase receipt. If you want to verify purchase signature in your code, use corresponding public key defined in FakeGooglePlayBillingApi.TEST_PUBLIC_KEY.

Migrating from In App Billing to Google Play Billing

All you need to do is change vendor implementation from deprecated InAppBillingV3Vendor to GooglePlayBillingVendor. Since both implementations are just different ways to connect to Google Play Store, all your products and purchase flows remain the same.

  1. In your dependencies replace

    compile 'com.getkeepsafe.cashier:cashier-iab:x.x.x'
    debugCompile 'com.getkeepsafe.cashier:cashier-iab-debug:x.x.x' // For fake checkout and testing
    releaseCompile 'com.getkeepsafe.cashier:cashier-iab-debug-no-op:x.x.x'

    with

    compile 'com.getkeepsafe.cashier:cashier-google-play-billing:x.x.x'
    debugCompile 'com.getkeepsafe.cashier:cashier-google-play-billing-debug:x.x.x' // For fake checkout and testing
  2. Replace InAppBillingV3Vendor with GooglePlayBillingVendor. To test the app in debug mode use FakeGooglePlayBillingApi in place of FakeAppBillingV3Api. Definition of products remains the same, but now you need to add them by calling FakeGooglePlayBillingApi.addTestProduct(product)

  3. That's it! Now your app will use the new Google Play Billing API!!

Sample App

For a buildable / workable sample app, please see the cashier-sample-google-play-billing project.

Acknowledgements

A very special thank you to Jeff Young for the awesome logo!

License

Copyright 2017 Keepsafe Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].