[SOLVED]Right way to check item in onSuccess function

Hi.
I’m new in SDKBox and I’m trying to implement some IAP functionality into my app.
Basically, I have a scene with some buttons. Inside of each button I have ONLY this thing
sdkbox::IAP::purchase("gold_1");
It’s different in each button.
So, is this the right way to check which item was bought inside onSuccess function?

void PremiumShopGold::onSuccess(sdkbox::Product const& p) {
	  if (p.id == "gold_1") {
		  auto ChData = ChData::getInstance();
		  ChData->Gold += 1000;
	  }
          if (p.id =="gold_2") {
		  auto ChData = ChData::getInstance();
		  ChData->Gold += 5000;
	  }

}

Or I should add something?
Thanks.

Looks right

1 Like

Thank you very much!