question

choi dong geun avatar image
choi dong geun asked

How should the rule context be handled in azure function?

I use automation -> rule to com.playfab.The player_receipt_validation is connected to the azure function.

The purchase information code when using the existing legacy is as follows.
var TitleId = JSON.parse(context.playStreamEvent.ReceiptContent)["productId"];


In azure function, there is an HttpRequest, but how can I get the above information?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

If you follow the instructions on PlayFab CloudScript using Azure Functions Quickstart Guide - PlayFab | Microsoft Docs to import CS2AFHelperClasses.cs module, you may get all information via PlayStreamEventEnvelope property in PlayerPlayStreamFunctionExecutionContext (please refer to the definition in CS2AFHelperClasses.cs). The data structure will be as follows:

"PlayStreamEventEnvelope": 
{
	"EntityId": "xxxxxxxxxxxxxx",
	"EntityType": "player",
	"EventName": "/* name of the event triggered this rule */"",
	"EventNamespace": "com.playfab",
	"EventData": "/* event payloads here*/",
	"EventToBeDropped": false
},
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.