CachePurchasePayloadContext
Caches a payload context to retreive as fallback if the store API cannot provide the payload.
Service | Operation |
---|---|
appStore | CACHE_PURCHASE_PAYLOAD_CONTEXT |
Method Parameters
Parameter | Description |
---|---|
storeId | The store platform. |
iapId | The app store's IAP ID. |
payload | The payload string to cache. Send in the payload associated with the product being purchased, as returned by the GetSalesInventory() call... |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string storeId = "googlePlay";
string iapId = "xxxxxxxx";
string payload = "__bc:[1,itemid,0,199,-1]";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.AppstoreService.CachePurchasePayloadContext(storeId, iapId, payload, successCallback, failureCallback);
const char *storeId = "googlePlay";
const char *iapId = "xxxxxxxx";
const char *payload = "__bc:[1,itemid,0,199,-1]";
_bc.getAppstoreService().cachePurchasePayloadContext(storeId, iapId, payload, this);
NSString *storeId = @"googlePlay";
NSString *iapId = @"xxxxxxxx";
NSString *payload = @"__bc:[1,itemid,0,199,-1]";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc appStoreService] cachePurchasePayloadContext:
storeId:storeId
iapId:iapId
payload:payload
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil]
String storeId = "googlePlay";
String iapId = "xxxxxxxx";
String payload = "__bc:[1,itemid,0,199,-1]";
this; // implements IServerCallback
_bc.getAppstoreService.cachePurchasePayloadContext(storeId, iapId, payload, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var storeId = "googlePlay";
var iapId = "xxxxxxxx";
var payload = "__bc:[1,itemid,0,199,-1]";
_bc.appStore.cachePurchasePayloadContext(storeId, iapId, payload, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var storeId = "googlePlay";
var iapId = "xxxxxxxx";
var payload = "__bc:[1,itemid,0,199,-1]";
ServerResponse result = await _bc.appStoreService.cachePurchasePayloadContext(storeId:storeId, iapId:iapId, payload:payload);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var storeId = "googlePlay";
var iapId = "xxxxxxxx";
var payload = "__bc:[1,itemid,0,199,-1]";
var appStoreProxy = bridge.getAppstoreServiceProxy();
var postResult = appStoreProxy.cachePurchasePayloadContext(storeId, iapId, payload);
{
"service":"appStore",
"operation":"CACHE_PURCHASE_PAYLOAD_CONTEXT",
"data":{
"storeId":"googlePlay",
"iapId":"xxxxxxxx",
"payload":"__bc:[1,itemid,0,199,-1]"
}
}
JSON Response
{
"status" : 200,
"data" : {}
}