Skip to content

Listening for event: MicroTxnAuthorizationResponse_t #12

@anpShawn

Description

@anpShawn

Working on a system where I need to listen for the "MicroTxnAuthorizationResponse_t" callback. (Briefly covered here: https://partner.steamgames.com/documentation/MicroTxn#InGamePurchasing)

SteamWrap is already set up to listen for some events, so I attempted to piggyback the current system. I started by defining a new event in SteamWrap.cpp

static const char* kEventTypeOnMicroTxnAuthorizationResponse = "MicroTxnAuthorizationResponse";

Then I updated CallbackHandler with the following:

STEAM_CALLBACK( CallbackHandler, OnMicroTxnAuthorizationResponse, MicroTxnAuthorizationResponse_t , m_CallbackMicroTxnAuthorizationResponse );

and

m_CallbackMicroTxnAuthorizationResponse( this, &CallbackHandler::OnMicroTxnAuthorizationResponse )

Then I added the actual callback function:

void CallbackHandler::OnMicroTxnAuthorizationResponse( MicroTxnAuthorizationResponse_t *pCallback )
{
	SendEvent(Event(kEventTypeOnMicroTxnAuthorizationResponse, true));
}

For now the event just returns true for testing. Lastly I updated Steam.hx to recognize the event inside of steamWrap_onEvent

case "MicroTxnAuthorizationResponse": 
				trace("mtxn callback received");

There appear to be no errors when rebuilding the extension with build.bat. However, no event is fired when I attempt to authorize a purchase in-game. Will keep digging, but not sure where to go next. Is there another step for adding an event that I have missed?

My only guess so far is that something also needs to show up in Steam.cpp. When searching for the other event names it seems they show up in that file a few times, but that file also seems like it was the result of some kind of build or auto-generation process. I thought rebuilding the extension might fix that, but I was wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions