How to implement inApp purchases in Android and IOS

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kubecz3k
:warning: Old Version Published before Godot 3 was released.

In general I’m asking this question so I could share my finding in this subject, especially since android part is not documented in docs yet.

:bust_in_silhouette: Reply From: kubecz3k

For iOS there are official docs on this matter here:

For GooglePlay there were some info on old forums written by Volhz, which are unavailable by now, I will post the content below.

  1. add android module
    open setting window (Menu > Scene > Project Settings)
    Category : android , Property : modules , Type : String then press Add button
    find android/modules and edit it to org/godotengine/godot/GodotPaymentV3
  2. with latest build, you can do like this with GDScript

    func _ready():
     var payment = Globals.get_singleton("GodotPayments")
         payment.setAutoConsume(false) # default : true
         payment.requestPurchased() # callback : has_purchased
         payment.purchase("item_name") # callback : purchase_success, purchase_fail, purchase_cancel,
         payment.consume("item_name") # callback : consume_success
         func purchase_success(receipt, signature, sku):
         print("purchase_success : ", sku)
    func purchase_fail():
    func purchase_cancel():
    func purchase_owned(sku):
         print("purchase_owned : ", sku)
    func consume_success(receipt, signature, sku):
         print("consume_success : ", sku)
    func has_purchased(receipt, signature, sku):
         if sku == "":
              print("has_purchased : nothing")
              print("has_purchased : ", sku)

**UPDATE:** This is actually on new forum as well, if you are interested in topic you should check:

It's still available on the new forum:

This should go in the docs, though I'm puzzled about the fact that people need to add the `org/godotengine/godot/GodotPaymentV3` manually if it's a built-in feature. It should be togglable.
[wrap=footnote]Akien | 2016-06-22 12:35[/wrap]

Oh nice, was not aware of this. Added link to the answer itself
[wrap=footnote]kubecz3k | 2016-06-22 14:32[/wrap]

android guide:
ios guide:
[wrap=footnote]sinxwal | 2017-12-12 21:34[/wrap]

Were do you test this and make sure the library is working?

I get this error message on the macOSX. 
Failed to retrieve non-existent singleton 'GodotPayments' 

when I run my application (game)
[wrap=footnote]hsojo91 | 2018-07-10 23:01[/wrap]


This link in the "UPDATE" comment above appears to be spam. The link redirects to some other domain and asks you to install some chrome extension.  I do not think there is a "new" forum.
[wrap=footnote]jfriv | 2021-03-28 05:02[/wrap]