Closed wecrtech closed 3 years ago
Any update?
thanks for the report. What is your project id?
Have you configured purchases on dashboard for your project? https://pango.gitbook.io/pango-platform/console-details/project-settings/user-payment-methods
@timoshenkoav We are trying to add "google" payment to payment methods put it gives me error "failed to parse purchase settings"
{
"credentials":{
"type": "service_account",
"project_id": "test-90b92",
"private_key_id": "25ba9cb676679b6342chdcbc2830b17746f25e9dd7a",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDkZkM79XOGfXAC\nNeQfc+a53KzdZfjNpQInDRRm8S2uisEMWIS+Kgp2i7Z7F8cMpB719dhdnPAfliXB\nZ9FIzlC/xZQ+4/wvwEwTFpvjx1u6Wja6KdecIVob0/aXMTncbcKHv8OJ+MjWw5o9\nPxMLRs9YT5kUu6e2RPmMRpnqLjk1PFuUJwvQzq833D4VN0LYFD650wLZQcfIQwhq\nBwrWjuaBI1pY707WBFUAQRDNlZKcwAEGkkzAJAgksaxn4Gsefzz/+N9T7qZycTeo\nn5wzDV3fRXqtsJEIxn6lXvpnZhoDzbbna/yZWr/79rshmlGKAMlfFCwwQ9m0/0hO\n8Sn0yr2zAgMBAAECggEABbnWl6s4oTeF1lhZhrxWHXS91LMYwLcRTb9TMp17QrPx\n0QhrE4VkS8KG6aEX+WYn7IykRvyHPJN8ENQ0d/nMJnKim80FZoEQpy3a7KPz1cEr\nPBGOeTiQ1L/En9e5FqCdzt9s3ImjJ1cyB7UMGi1FR3Z/ZPirZLNn+i9O6KS5fta5ZC3nx3Z55MRnWmCqv14ZqwZyUrk/h/xopdCHpNJZagu/AXTtEmztnx\nSfizdjAQ9QKBgGHcI4hxWASqMtMEagvMrU10cUv/dVlzQyGG91HLKopmVABONGFY\npqdlaVL+jKnW1LrIvDx1eZh0UV3W+uR2iaGorICGNgfiLg7A/ri/4TnIogyQ/7hC\nZMk8WKG3Ncl3yhWCgBZ3L/wLhE/cpuWcg+vZ2HUHfDIWfFNGGpvs2prnAoGBAOui\nHETfdx1uYIXon7elLEELWAfLx9/c95a160wrB4+gaXqY4t3wB5J6r9Cvlwk1RK+O\n7+ZHUifeQcgq09vLiig17Awf6+VTOaEzEZpoR+Y8Tskl4kwugm0pzXT/r2pfPYHJ\n1x1836WcmCarGwyjh112yoK/dOZCPKYYe2+CN9W9AoGBAPT74jky6d7fezP9wo9O\nH2Y5zSen4mkgJ9oDxVtjUuFl0eL19rsGFmrkIC2+z9dIWTn2+dYsVvpTtvbDP1hU\nsPLQyFhN34QM5Quh9/DBScZ9P9WBSTKbrwuRFZu/e9+w99MSIPUP1pN0YFHxdwvj\nIImDKZKSvkckk6BXqslSwgc7\n-----END PRIVATE KEY-----\n",
"client_email": "test-90b92@appspot.gserviceaccount.com",
"client_id": "111677902137463905436",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test-90b92%40appspot.gserviceaccount.com"
},
"application": "AnchorFree-Backend/1.0"
}
try to set the escaped string as value - not direct json
@timoshenkoav Sorry, an error again with escaped string
oh, sorry. wrap(escape) only credentials field, here is the example
{
"credentials":"{\"type\":\"service_account\",\"project_id\":\"xxx\",\"private_key_id\":\"xxx\",\"private_key\":\"...\\n\",\"client_email\":\"xxx@yyy.iam.gserviceaccount.com\",\"client_id\":\"zzz\",\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\",\"client_x509_cert_url\":\"https://www.googleapis.com/robot/v1/metadata/x509/yyy.iam.gserviceaccount.com\"}",
"application":"AnchorFree-Backend/1.0"
}
@timoshenkoav Thanks, it has added successfully now, i will test purchase method now...
Hello @timoshenkoav , After adding payment method "google". We are trying to test purchase, it gives us the same error: INVALID_PURCHASE, can you please help us? , we did all steps which in the documentation.
Our Project ID: 012011_hot_vpn
override fun onPurchasesUpdated(responseCode: BillingResult, purchases: MutableList<Purchase>?) {
purchases?.let {
if (responseCode.responseCode == 0 && it.size > 0) {
// Acknowledged
purchases.forEach {
if (it.purchaseState == Purchase.PurchaseState.PURCHASED) {
// Acknowledge the purchase if it hasn't already been acknowledged.
if (!it.isAcknowledged) {
val acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(it.purchaseToken)
billingClient?.acknowledgePurchase(acknowledgePurchaseParams.build()) {
Log.d(TAG, "acknowledgePurchase: ${it.responseCode}")
}
}
}
hydraPurchase(it.originalJson)
}
}
}
}
private fun hydraPurchase(googleJson: String){
Log.d(TAG, "googleJson: $googleJson")
UnifiedSDK.getInstance().backend.purchase(googleJson, object : CompletableCallback {
override fun complete() {
//purchase request success
Log.d(TAG, "Sdk Purchase complete")
dialog.dismiss()
startActivity<SplashActivity>()
finishAffinity()
}
override fun error(e: VpnException) {
//failed to process purchase
Log.d(TAG, "Sdk Purchase error: ${e.message}")
}
})
}
googleJson:
{"orderId":"GPA.3345-5585-7632-52607","packageName":"com.wecr.hotvpn","productId":"6_months_plan","purchaseTime":1623217407078,"purchaseState":0,"purchaseToken":"pgbfbdjniccinekgmkfaadjc.AO-J1Oy4bARE8-N7YlMLOFy6JaulkI_62o1bILsnmeDrjd6oERgsVWRSvwRr3_InLnacbKJ60RupkBxP4Pb38oL0T5XR7a2buQ","quantity":1,"autoRenewing":true,"acknowledged":false}
Error LOG
E/USDK-CarrierBackend: c.b.f.c.f: Error on request ApiRequest{url='https://d1pijg9qb98hxx.cloudfront.net/user/purchase', method='POST', body='{"result":"INVALID_PURCHASE"}'} INVALID_PURCHASE
com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized\n{\n \"code\" : 401,\n \"errors\" : [ {\n \"domain\" : \"androidpublisher\",\n \"message\" : \"The current user has insufficient permissions to perform the requested operation.\",\n \"reason\" : \"permissionDenied\"\n } ],\n \"message\" : \"The current user has insufficient permissions to perform the requested operation.\"\n
Please check the service account permissions to access payments/purchases
@timoshenkoav We can not find "access service account", we searched but we find nothing, can you please help us? . Thanks for your support
Hello @timoshenkoav, We made sure that the the service account has all permissions to access payments/purchases and still give me the same error!
We already missed purchase permission once we enable it it works fine now, Thanks
Hi @wecrtech After adding payment method. I am using below function to pass the purchase json from google. sdk.getBackend().purchase("json from google", new CompletableCallback() { @override public void complete() { //purchase request success }
@override public void error(VpnException e) { //failed to process purchase } }); Passing json is {"orderId":"GPA.3370-5552-7700-38075","packageName":"com.quantum4u.vpn","productId":"com.vpn.onemonth","purchaseTime":1624727413110,"purchaseState":0,"purchaseToken":"hbllfnlmflaidnmiioamnhfb.AO-J1Oz4EUweDMdhVURH83ovJtUG6TcySARQT89RDgcv_cLrRABalmnSwjxt60-EBj2pVVQmgRE2Bb2fN4QNjdFs37ixbzdsTA","autoRenewing":true,"acknowledged":true}
and getting error is below PartnerApiException{code=200message=nullcontent=INVALID_PURCHASE}
Please help me.
@singhmeenu please check you have configured payment method correctly on dashboard
@singhmeenu please check you have configured payment method correctly on dashboard
yes @timoshenkoav , checked it and and also grant permission for all
here is payment method which i added
using carried-id is qua_android_fastvpn
Hello Mr/Mrs,
I tried to handle the purchase but it gives me an error INVALID_PURCHASE, i attached all the details, can you please check? I sent all details to a.timoshenko@anchorfree.com
Thanks for help in advance.