로딩중입니다
Client Reward Integration : Unity iOS
4/29/2016 5:30:47 PM

IGAW Reward Server Integration: Client Type

In case the internal server to receive callbacks from the IGAW reward server is difficult to set up, the additional client integration can be achieved to treat reward supplies. 



Set Reward Server Integration Method

Edit (*)reward server integration method to handle reward callback through client.

Use SetUseIgaworksRewardServer api to determine the use of  IGAW reward server.

public class MySampleScene : MonoBehaviour {

    // Use this for initialization
    void Start () {
        //When Unity engine is reset, reset the plug-in
	//Set usage status of IGAW reward server as true
        IgaworksCorePluginIOS.SetUseIgaworksRewardServer(true);
    }    
}

+(*)Reward server integration method: Required when you need to integrate reward pay service. 

  • false : Use your own callback server.
  • true : Use IGAWorks reward server.



Register and Implement Reward Delegate and Operate

Register and implement delegate in order to receive reward information from IGAW reward server.

public class MySampleScene : MonoBehavior {
	
	void Start() {
		
		IgaworksCorePluginIOS.IgaworksCoreWithAppKey("APP_KEY", "HASH_KEY", true);
		
                //Add delegate listener
		IgaworksCorePluginIOS.SetCallbackHandler("MySampleScene"); 

		//Add reward delegate
		IgaworksCorePluginIOS.onRewardRequestResult += HandleOnRewardRequestResult;
		IgaworksCorePluginIOS.onRewardCompleteResult += HandleOnRewardCompleteResult;
	 
	}

	public void HandleOnRewardRequestResult(string rewardInfo) {
		//Reward information will be sent to here.
	}

	public void HandleOnRewardCompleteResult(string result) {
		//Final processing result will be sent.
	}
}


View and Pay Reward Information

Untreated reward information from IGAW reward server transferred to HandleOnRewardRequestResult delegate.


Reward information transfers in parameter type. Will be in string and parsing process.

  • isSuccess : Reward process result.
  • message : Reward process result message.
  • itemName : Reward name to be paid.
  • itemKey : reward item key to be paid (deprecated).
  • campaignName : Compleded campaign name.
  • campaignKey : Completed campaign key.
  • rewardKey : Completed transaction reward key.
  • quantity : Quantity of cyber money users have to receive.


Call DidGiveRewardItemWithRewardKey API including rewardKey to transfer the information to IGAW reward server.

public void HandleOnRewardRequestResult(string rewardInfo) {
	// rewardInfo : isSuccess=1&message=Success&itemName=1point&itemKey=(null)&campaignName=REGISTRATION TYPE CAMPAIGN for TEST&campaignKey=1296784231&rewardKey=RzBVMIkF-15x5Y5qpU4vawj-33gdK3LKoaRx7p15NmjjdgnCc9uKlFSRjZypYzTLlrRe2BHByfM4x0AlP6X2n0vth4EYV-kUZ&quantity=1

	// Extract and send rewardKey
	AdPopcornOfferwallPluginIOS.DidGiveRewardItemWithRewardKey($rewardKey);
}


See the reward process result

The result of DidGiveRewardItemWithRewardKey API will transfer to HandleOnRewardCompleteResult delegate.

Reward payment is processed after getting the result.

  • isSuccess : Reward process result.
  • message : Reward process result message.
  • resultCode : Reward result code.(Check the table below for result code). 
  • completedRewardKey : Payment completed rewardKey


public void HandleOnRewardCompleteResult(string result) {
	// Result for AdPopcornOfferwallPluginIOS.DidGiveRewardItemWithRewardKey will be sent.
	// result : isSuccess=1&message=Success&resultCode=1&completedRewardKey=RzBVMIkF-15x5Y5qpU4vawj-33gdK3LKoaRx7p15NmjjdgnCc9uKlFSRjZypYzTLlrRe2BHByfM4x0AlP6X2n0vth4EYV-kUZ

	// Give reward to user when the result of rewardKey sent via DidGiveRewardItemWithRewardKey API is "Succeed".
}

Result Code Definition

Definition of result code transferred to delegate.

CodeDescription
1Succeed
100Error when tried to finish
200Unknown error (Exception)
1400Wrong app key
1410Wrong reward type setting
3000Wrong hash key



Integration Test

After performing and completing the test ad using the test devices at adPOPcorn Management page [OfferWall Management > QA and Optimization > Test Device Setting], Integration is completed as you see the reward successfully collected.