{"id":13529004,"url":"https://github.com/libgdx/gdx-pay","last_synced_at":"2025-04-01T14:33:49.702Z","repository":{"id":43175382,"uuid":"24834448","full_name":"libgdx/gdx-pay","owner":"libgdx","description":"A libGDX cross-platform API for InApp purchasing.","archived":false,"fork":false,"pushed_at":"2025-01-02T06:14:08.000Z","size":16580,"stargazers_count":224,"open_issues_count":7,"forks_count":84,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-01-02T07:24:57.190Z","etag":null,"topics":["android","gdx-pay","iap","in-app-purchase","ios","java","libgdx","moe","multi-os-engine","robovm"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libgdx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-06T04:54:00.000Z","updated_at":"2025-01-02T06:14:13.000Z","dependencies_parsed_at":"2024-01-03T03:54:30.772Z","dependency_job_id":"d2bbfab9-1d87-494f-a572-a68871693fb7","html_url":"https://github.com/libgdx/gdx-pay","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-pay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-pay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-pay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-pay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libgdx","download_url":"https://codeload.github.com/libgdx/gdx-pay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246655513,"owners_count":20812649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","gdx-pay","iap","in-app-purchase","ios","java","libgdx","moe","multi-os-engine","robovm"],"created_at":"2024-08-01T07:00:31.045Z","updated_at":"2025-04-01T14:33:49.695Z","avatar_url":"https://github.com/libgdx.png","language":"Java","funding_links":[],"categories":["Resources"],"sub_categories":["Services"],"readme":"[![Maven Central](http://maven-badges.herokuapp.com/maven-central/com.badlogicgames.gdxpay/gdx-pay/badge.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.badlogicgames.gdxpay%22)\n\nThis project aims to provide a **cross-platform API for InApp purchasing**.\nThe gdx-pay project is a libGDX extension. Current release version is 1.3.8. Please use at least libGDX v1.9.8 or Robovm 2.3.5.\n\nSNAPSHOT builds are published regularly on [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/).\n\n### Supported  payment services\n\n* **Google Play (Android)**: [googlebilling](https://github.com/libgdx/gdx-pay/tree/master/gdx-pay-android-googlebilling)\n\n* **Amazon IAP (Android)**: [amazon](https://github.com/libgdx/gdx-pay/tree/master/gdx-pay-android-amazon)\n\n* **Huawei (Android)**: [huawei](https://github.com/libgdx/gdx-pay/tree/master/gdx-pay-android-huawei)\n\n* **Apple (iOS)**: [RoboVM](https://github.com/libgdx/gdx-pay/tree/master/gdx-pay-iosrobovm-apple)\n\nClick on the links to view the subproject's readme files for service-dependant information and artifacts.\n\n### Installation\n\nThe recommended way to use gdx-pay is via dependency management with Gradle or Maven. Artifacts are available in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.badlogicgames.gdxpay%22).\n\n*project-root/build.gradle:*\n\n    ext {\n        gdxPayVersion = '1.3.8'\n    }\n\nAdd the following dependencies:\n\n*core:*\n\n        implementation \"com.badlogicgames.gdxpay:gdx-pay-client:$gdxPayVersion\"\n\n*html:*\n\n        implementation \"com.badlogicgames.gdxpay:gdx-pay:$gdxPayVersion:sources\"\n        implementation \"com.badlogicgames.gdxpay:gdx-pay-client:$gdxPayVersion:sources\"\n\nYou also need to add the following file to your GdxDefinition.gwt.xml in your html project:\n\n\t    \u003cinherits name=\"com.badlogic.gdx.pay_client\"/\u003e\n\nThat's all you need to use gdx-pay in the core project. Of course, you want to use a certain IAP service in your game.\nLook in the service subproject's readme files linked above.\n    \n### Usage\n\nThe main interface you use to communicate with payment services is the `PurchaseManager`. Add a field holding it \nto your main game class:\n\n    public PurchaseManager purchaseManager;\n\nIn the launcher class you instantiate the PurchaseManager for the payment service you want to use:\n\n    game.purchaseManager = new DesiredPlatformPurchaseManager(...);\n\nSee the documentation of your desired payment service linked above on how to instantiate its `PurchaseManager` implementation.\n\n#### Configuration\n\nBefore using the PurchaseManager for payments, it needs to get installed:\nYou need to provide a callback listener implementing the `PurchaseObserver` interface and a configuration. \nTypically, the configuration just passes the items you want to offer: \n\n    PurchaseManagerConfig pmc = new PurchaseManagerConfig();\n    pmc.addOffer(new Offer().setType(OfferType.ENTITLEMENT).setIdentifier(YOUR_ITEM_SKU));\n    pmc.addOffer(new Offer().setType(OfferType.CONSUMABLE).setIdentifier(YOUR_ITEM_SKU));\n    pmc.addOffer(new Offer().setType(OfferType.SUBSCRIPTION).setIdentifier(YOUR_ITEM_SKU));\n    // some payment services might need special parameters, see documentation\n    pmc.addStoreParam(storename, param)\n    \n    purchaseManager.install(new MyPurchaseObserver(), pmc, true);\n\nWhen the PurchaseManager is sucessfully installed, your `PurchaseObserver` will receive a\n callback and `purchaseManager.installed()` will return `true`. That might take some seconds depending \n on the payment service. You can now request information or purchase items.\n \nIf you are completely done with the `PurchaseManager`, call its `dispose()` method.\n \n#### Request item information\n\nIt is important to know which of the items you added to the configuration are available at which\nprice. Use `getInformation()` to retrieve an item `Information` object to do so:\n\n    Information skuInfo = purchaseManager.getInformation(sku);\n    if (skuInfo == null || skuInfo.equals(Information.UNAVAILABLE)) {\n       // the item is not available...\n       purchaseButton.setDisabled(true);\n    } else {\n       // enable a purchase button and set its price label\n       purchaseButton.setText(skuInfo.getLocalPricing());\n    }\n        \n#### Purchase items\n\nThis is for what you are reading this! It is pretty easy to start a purchasement:\n\n    purchaseManager.purchase(sku);\n    \nIf the purchasement was successfully done, \nyou will receive a call to `PurchaseObserver.handlePurchase()`. If there was an error, \nyou *might* receive a call to your observer's `handlePurchaseError()` or `handlePurchaseCanceled()` \nmethod.\n\n#### Restore purchases\n\nIf the user reinstalls your game or erased its data, it is important to let him restore his past purchases.\nYou can do so by calling\n\n    purchaseManager.purchaseRestore()\n    \nYou will get a callback to your observer's `handleRestore()` method with a list of past transactions.\n\n**Please note:** Don't use this to query the user's bought entitlements on every game start,\nbut persist them yourself. Call this method only when the user hits a \"reclaim\" button. The most important reasons \nfor this:\n\n * (iOS only) Apple will reject your game if it calls `purchaseRestore()` without user interaction\n * You get only reliable results if the device is connected to the internet. If you don't persist\n  entitlements yourself, your paying users are not able to use their purchases offline.\n * `purchaseRestore()` might take some time to fetch its results \n\n### Example project\n\nIf you have questions or problems, take a look at the [example project](https://github.com/libgdx/gdx-pay-example) \ndemonstrating how to configure and use gdx-pay. \n\n### News \u0026 Community\n\nCheck the [libGDX blog](http://www.badlogicgames.com/) for news and updates.\nYou can get help on the [libGDX forum](http://www.badlogicgames.com/forum/) and talk to other users on the \nIRC channel #libgdx at irc.freenode.net or the \n[libgdx discord](https://discord.gg/6pgDK9F).\n\n### Reporting Issues\n\nSomething not working quite as expected? Do you need a feature that has not been implemented yet? Check the [issue tracker](https://github.com/libgdx/gdx-pay/issues) and add a new one if your problem is not already listed. Please try to provide a detailed description of your problem, including the steps to reproduce it.\n\n### Building from source\n\nTo build from source, clone or download this repository, then open it in Android Studio. Perform the following command to compile and upload the library in your local repository:\n\n    ./gradlew publishToMavenLocal\n\nSee build.gradle file for current version to use in your dependencies.\n\n### Contributing\n\nAwesome! If you would like to contribute with a new feature or a bugfix, [fork this repo](https://help.github.com/articles/fork-a-repo) and [submit a pull request](https://help.github.com/articles/using-pull-requests).\nAlso, before we can accept substantial code contributions, we need you to sign the [libGDX Contributor License Agreement](https://github.com/libgdx/libgdx/wiki/Contributing#contributor-license-agreement).\n\n### License\n\nThe gdx-pay project is licensed under the [Apache 2 License](https://github.com/libgdx/gdx-pay/blob/master/LICENSE), meaning you can use it free of charge, without strings attached in commercial and non-commercial projects. We love to get (non-mandatory) credit in case you release a game or app using gdx-pay!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibgdx%2Fgdx-pay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibgdx%2Fgdx-pay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibgdx%2Fgdx-pay/lists"}