My request is
`{
"packageName": "com.test.package",
"sku": "title",
"status": "inactive",
"subscriptionPeriod": "P1M",
"purchaseType": "subscription",
"listings": {
"en-US": {
"title": "title",
"description": "title"
}
},
"defaultLanguage": "en-US",
"defaultPrice": {
"priceMicros": "100000000",
"currency": "SGD"
}
}`
to the post call for inserting a product (reference : [https://www.googleapis.com/androidpublisher/v2/applications/packageName/inappproducts]).
Getting error response for this request
`{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "inAppProductRegionsMissingPricing",
"message": "Must provide a price for each region the app has been published in."
}
],
"code": 403,
"message": "Must provide a price for each region the app has been published in."
}
}`
Can anyone explain this error, because i have set a default price ?
And also how do i get all the countries list and its currencies in which the app is published in from google play console ?
Go to PRICING & DISTRIBUTION Page of your app in https://play.google.com/apps/publish/
In Countries find out how many region you have selected for this app.
while inserting the in app product you have provide price for all region you have selected.
so suppose if you have selected Pakistan as region
PK (2 letter ISO country code as key for each price for each region within price array)
then you request should be
{
"packageName": "com.test.package",
"sku": "title",
"status": "inactive",
"subscriptionPeriod": "P1M",
"purchaseType": "subscription",
"listings": {
"en-US": {
"title": "title",
"description": "title"
}
},
"defaultLanguage": "en-US",
"defaultPrice": {
"priceMicros": "100000000",
"currency": "SGD"
},
"prices": {
"PK": {
"priceMicros": "100000000",
"currency": "SGD"
}
}
}
You really don't want to do this, imagine you having to send all that to about 150 countries. You can just parse the ['autoConvertMissingPrices' => true] when inserting or updating a product so Google does the conversion.
In my case here is what I do. { 'autoConvertMissingPrices' => true }
$purchase = $service->inappproducts->update(
'app.package.name',
'product_sku',
$product,
['autoConvertMissingPrices' => true]
);
Related
I am integrating Paypal checkout in an Android App using REST APIs provided by Paypal and my country is India so I am following this guide from PayPal.
How I did as per docs:
Get access-token (/v1/oauth2/token) for further api calls.
Use the Create Order API to create a payment (v2/checkout/orders)and in the response we will get approval url at where you need to redirect user to make the payment.
Now my question is how do I know if payment transaction was successful or not in mobile app because I am using WebView in my app to load approval url.
Order is created like this and I load href inside webview:
{
"id": "1KK44573EX7352015",
"status": "CREATED",
"links": [
{
"href": "https://www.sandbox.paypal.com/checkoutnowtoken=1KK44573EX7352015",
"rel": "approve",
"method": "GET"
}
]
}
I did this way:
As soon as Payment is successfully completed by customer the return_url gets called with query parameters : PayerID & token(orderID). At that time we can update user's payment status in our database (Amount is not deducted yet still because order is yet not approved or captured).
After that we can capture our order (Make sure invoice-id is not duplicate) otherwise status will be not completed.
If order is not approved on the time of capture we get this kind of error:
{
"name": "UNPROCESSABLE_ENTITY",
"details": [
{
"issue": "ORDER_NOT_APPROVED",
"description": "Payer has not yet approved the Order for payment. Please redirect the payer to the 'rel':'approve' url returned as part of the HATEOAS links within the Create Order call or provide a valid payment_source in the request."
}
],
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "47af43e..",
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-ORDER_NOT_APPROVED",
"rel": "information_link",
"method": "GET"
}
]
}
If there is duplicate invoice-id you will see error at the time of capture:
{
"name": "UNPROCESSABLE_ENTITY",
"details": [
{
"issue": "DUPLICATE_INVOICE_ID",
"description": "Duplicate Invoice ID detected. To avoid a potential duplicate transaction your account setting requires that Invoice Id be unique for each transaction."
}
],
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "86e0cc7f....",
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-DUPLICATE_INVOICE_ID",
"rel": "information_link",
"method": "GET"
}
]
}
If there is currency based issue:
{
"name": "UNPROCESSABLE_ENTITY",
"details": [
{
"location": "body",
"issue": "CURRENCY_NOT_SUPPORTED",
"description": "Currency code is not currently supported. Please refer https://developer.paypal.com/docs/integration/direct/rest/currency-codes/ for list of supported currency codes."
}
],
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "d666b5e5eb0c0",
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-CURRENCY_NOT_SUPPORTED",
"rel": "information_link",
"method": "GET"
}
]
}
If your order is successfully captured with status as COMPLETED:
{
"id": "8G0042477K865063U",
"status": "COMPLETED",
"purchase_units": [
{
"reference_id": "default",
"shipping": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "10, east street",
"address_line_2": "first building",
"admin_area_2": "Mumbai",
"admin_area_1": "Maharashtra",
"postal_code": "400029",
"country_code": "NZ"
}
},
"payments": {
"captures": [
{
"id": "4K670967VH2547504",
"status": "PENDING",
"status_details": {
"reason": "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"
},
"amount": {
"currency_code": "NZD",
"value": "170.00"
},
"final_capture": true,
"seller_protection": {
"status": "ELIGIBLE",
"dispute_categories": [
"ITEM_NOT_RECEIVED",
"UNAUTHORIZED_TRANSACTION"
]
},
"invoice_id": "INV-1234567888",
"links": [
{
"href": "https://api.sandbox.paypal.com/v2/payments/captures/4K670967VH2547504",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v2/payments/captures/4K670967VH2547504/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/8G0042477K865063U",
"rel": "up",
"method": "GET"
}
],
"create_time": "2020-10-31T13:35:58Z",
"update_time": "2020-10-31T13:35:58Z"
}
]
}
}
],
"payer": {
"name": {
"given_name": "Sumit",
"surname": "Shukla"
},
"email_address": "testg32#gmail.com",
"payer_id": "VW87TYSM2GMZ4",
"address": {
"address_line_1": "10, east street",
"admin_area_2": "Mumbai",
"admin_area_1": "Maharashtra",
"postal_code": "400029",
"country_code": "NZ"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/8G0042477K865063U",
"rel": "self",
"method": "GET"
}
]
}
After that you can redirect user to thank you page and update mobile app screen based on database values.
I filled in the necessary information in my class but I do not know how to test it. Nothing indicates it in the documentation. Moreover it refers to 2 variables MERCHANT_HOSTED_SIGNIN & MERCHANT_HOSTED_SIGNUP but impossible to know where they are!
For information, a part of my loyaltyClass :
"discoverableProgram": {
"kind": "walletobjects#discoverableProgram",
"merchantSignupInfo": {
"signupWebsite": {
"kind": "walletobjects#uri",
"uri": "https://mywebsite.com/googlePay/signup/",
"description": "My description"
},
"signupSharedDatas": [
"firstName",
"lastName",
"streetAddress",
"addressLine1",
"addressLine2",
"addressLine3",
"city",
"state",
"zipcode",
"country",
"email",
"phone"
]
},
"merchantSigninInfo": {
"signinWebsite": {
"kind": "walletobjects#uri",
"uri": "https://mywebsite.com/googlePay/signin/"
}
},
"state": "trustedTesters"
}
I had to contact the Google Pay Passes team to activate registration and login.
According to the documentation for the Google Play Developer API, I should be able to batch insert or update requests. However, I’m running into an issue where it appears that either the documentation is wrong, the API is broken, or I’m just missing something.
I’m POSTing to the URL: https://www.googleapis.com/androidpublisher/v2/applications/inappproducts/batch?access_token=<my token here>&autoConvertMissingPrices=true'
MyContent-Typeis set to:application/json
And the body of myPOST` is the following:
{
"entrys": [{
"batchId": "<my batch id>",
"methodName": "update",
"inappproductsupdaterequest": {
"inappproduct": {
"packageName": "<my package name>",
"sku": "<my product sku>",
"status": "active",
"purchaseType": "managedUser",
"defaultPrice": {
"priceMicros": "<my price>",
"currency": "USD"
},
"listings": {
"en-US": {
"title": "<my title> ",
"description": "<my description>"
}
},
"defaultLanguage": "en-US"
}
}
}]
}
When I POST this, I get the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter: [entry[0].inappproductsUpdateRequest.package_name]",
"locationType": "parameter",
"location": "[entry[0].inappproductsUpdateRequest.package_name]"
}
],
"code": 400,
"message": "Required parameter: [entry[0].inappproductsUpdateRequest.package_name]"
}
}
If I’m reading this correctly, they want the package name parameter as a child element under inappproductsUpdateRequest. However, when I try moving or copying (tried both) "packageName": "<my package name>" as a child under inappproductsUpdateRequest, I get the error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Unknown field name: packageName",
"locationType": "other",
"location": "entrys.inappproductsupdaterequest"
}
],
"code": 400,
"message": "Unknown field name: packageName"
}
}
I get the same error when I try package_name instead of packageName.
Any thoughts?
Have you tried the requested casing inappproductsUpdateRequest that the response shows? I'm guessing you do need snake case on package_name rather than packageName, but you may need to try both there too.
I am using Firebase Database for my mobile and web application. I wanted to get advise for how to structure the JSON Tree. I have the following use case in mind:
Mobile app user logs in and gets all nearby restaurants in a list. User sets order on one restaurant. The restaurant owner uses web or mobile application to see incoming orders and accepts them. After accepting the order, the mobile app user gets response that his order has been accepted. Now my idea for the structure was the following:
SO we have one node at top level for each restaurant and each restaurant node contains a requests node which saves all the requests for this restaurants.
Is that structure ok or could this be structured better?
Consider a data structure like this, you don't want to retrieve all the request when you get a restaurant and this way, you can get all the requests for a restaurant and all the requests from a particular user.
{
"requests": {
"req1": {
"status": 0,
"time": 1473593287,
"user": { "u2": true }
},
"req2": {
"status": 0,
"time": 1473593227,
"user": { "u1": true }
},
"req3": {
"status": 0,
"time": 1473594287,
"user": { "u1": true }
},
"req4": {
"status": 0,
"time": 1473594227,
"user": { "u2": true }
},
},
"restaurant-requests": {
"resA": {
"req1": true,
"req2": true
},
"resB": {
"req3": true,
"req4": true
}
},
"restaurants": {
"resA": {
"name": "Example Restaurant A",
"address": "1 Example Street"
},
"resB": {
"name": "Example Restaurant B",
"address": "2 Example Street"
}
},
"user-requests": {
"u1": {
"req2": true,
"req3": true
},
"u2": {
"req1": true,
"req4": true
}
},
"users": {
"u1": {
"address": "123 Example Street"
},
"u2": {
"address": "124 Example Street"
},
},
}
That's what I would do..
good luck!
I want to fetch the Network list and its associated email Address from Facebook in Android. I am using the Facebook SDK for Android. But in response JSON from the Facebook, I am not getting the Network Name and the associated email address. Currently following permission are given.
Utility.mFacebook.authorize(LoginActivity.this,
new String[] { "publish_stream","read_stream", "offline_access","user_education_history", "email" },
Facebook.FORCE_DIALOG_AUTH,
facebookListener.new LoginDialogListener())
UPDATE: From Facebook developer site we can get network name in affiliation here
affiliations - The list of network affiliations, as affiliation elements, each of which contain year, type, status, name, and nid child elements. If no affiliations are returned, this element will be blank. The user's primary network (key: nid) will be listed first.
getting the following response in JSON format, but no affiliation tag in response,
{
"work": [
{
"employer": {
"id": "xxxxxxxxxxxx",
"name": "xyz"
},
"start_date": "0000-00",
"end_date": "0000-00"
}
],
"locale": "en_US",
"link": "http://www.facebook.com/abc.xyz.12",
"education": [
{
"type": "College",
"school": {
"id": "112520115426955",
"name": "University of Pennsylvania"
}
}
],
"updated_time": "2012-11-01T06:31:14+0000",
"id": "0000000000000000",
"first_name": "XYZ",
"timezone": 5.5,
"username": "abc.xyz.12",
"email": "abc#xyz.com",
"verified": true,
"name": "XYZ ABC",
"last_name": "ABC",
"gender": "male"
}
Please let me know, is there any permission required for same. or any other way to get this.
Thanks in Advance!.
This is the FQL query to get an user's affiliation:
select affiliations from user where uid=YOUR_UID_HERE
Example link to graph api explorer with the FQL query below.
https://developers.facebook.com/tools/explorer/?fql=select%20affiliations%20from%20user%20where%20uid%3D1060290170%0A%0A