//////////
Search
Duplicate

Purchase Product

태그

1. Start Purchasing

Start purchasing a product with StovePC.StartPurchase.
// input parameters // StovePCOrderProduct[] products : Order product information StovePCResult result = StovePC.StartPurchase(products); if(result == StovePCResult.NoError) { // handle success }
C++
복사
When the StovePC.StartPurchase function is successfully processed, the OnStartPurchase callback is called.
The StovePCPurchase structure passed to the callback contains meta information about product purchase.
StovePCPurchase.TransactionMasterNo: Unique Transaction Master Number
StovePCPurchase.TempPaymentUrl : One-time URL for payment
StovePCPurchase.PurchaseProgress : Purchase progress status
1: Payment in progress (page displayed in external browser or webview using TempPaymentUrl)
2: Purchase complete (Payment is completed due to the purchase of a product with a selling price of 0, so it is not necessary to display the page in an external browser or webview using TempPaymentUrl) (optional)
Note: PurchaseProgress 2 is only used when you have a product which is priced 0 (free)
When necessary, the game opens up the one-time payment URL through an external browser (or built-in browser).
private void OnStartPurchase(StovePCPurchase purchase) { StringBuilder sb = new StringBuilder(); sb.AppendLine("OnStartPurchase"); sb.AppendFormat(" - purchase.TransactionMasterNo : {0}" + Environment.NewLine, purchase.TransactionMasterNo.ToString()); sb.AppendFormat(" - purchase.TempPaymentUrl : {0}" + Environment.NewLine, purchase.TempPaymentUrl); sb.AppendFormat(" - purchase.PurchaseProgress : {0}", purchase.PurchaseProgress); Debug.Log(sb.ToString()); if(purchase. PurchaseProgress == 1) { // open external browser Application.OpenURL(purchase.TempPaymentUrl); } else if(purchase. PurchaseProgress == 2) { // Processing purchase completion (e.g. purchase completion message box) } }
C++
복사
If an error occurs while running StovePC.StartPurchase function, the OnError callback is called. External errors can be checked through the ExternalError field of the StovePCError structure.
Normally, when the OnError callback is called for the StovePC.StartPurchase function call, the game exposes a message about the failure to the game user. The table below provides a guide on what messages to display to game users.
ExternalError
Description
Message to User
500
Internal Server Error
Temporary error, please try again later.
50001
Store does not exist, or is under maintenance
The service is under maintenance.
50002
Product does not exist, or is unavailable for sale
This product cannot be purchased due to maintenance.
50003
Non-exhibited products
This product is not currently available for purchase.
50004
Products’ available duration is over
This product is not currently available for purchase.
50005
Product price is inconsistent (check if product price is changed)
Product price information has been changed.
50009
Exceeds maximum amount for purchase per user
You have exceeded the maximum amount for purchase
50010
Exceeds the total number of sales available for purchase
No more quantities left
50031
Purchase quanty is “0”
Please select 1 or more quantity
999999
undefined error
The service is encountering unexpected error.