int StorePurchaseProduct(char *product_id);
Initiates a product purchase from your app's store.
Return Value
Returns one if successful. Be sure to use the global Store callback specified in StoreInit() to get results from the iTunes Store.
Parameters
product_id Specifies a pre-defined product id in your store to be purchased. It is recommended to use the reverse domain name format for your product id's, so that there is no chance of name collisions with other product id's.
Remarks
StorePurchaseProduct() initiates a purchase request for an item in your app's store. In order to use In-App Purchase features, you will need an Apple Developer account with an application defined, and In-App Purchase enabled for your application. Additionally, you will want to set up at least one item for sale before using In-App Purchase.
See iTunes Connect for more information on configuring your application for In-App Purchase.
Availability
Available in DragonFireSDK 2.0 and later.
Example
#include "DragonFireSDK.h"
const char *ErrorNoError(int value) { if (value) return("ERROR! "); return(""); }
void OnStoreEvent(int type,int flag,int value,char *desc) { switch (type) { case 1: // Product Request printf("Product Request event result: %svalue:%d desc:%s\n",ErrorNoError(flag),value,desc); break; case 2: // Provide Content printf("Provide Content event result: %svalue:%d desc:%s\n",ErrorNoError(flag),value,desc); break; case 3: // Record Transaction printf("Record Transaction event result: %svalue:%d desc:%s\n",ErrorNoError(flag),value,desc); break; } }
int OnButton(int id) { switch (id) { case 1: StorePurchaseProduct("com.mycompany.myapp.my_product_id"); break; case 2: StoreRequestProductData("com.mycompany.myapp.my_product_id,com.mycompany.myapp.my_product_id2"); break; }
return(id); }
void AppMain() { StoreInit(OnStoreEvent);
ButtonAdd("Images/Button", 10, 10, OnButton, 1); ButtonAdd("Images/Button", 10, 50, OnButton, 2); }
void AppExit() {
}
void OnTimer() {
} |