Initiate Payment
Required Parameters
orderId
String
Unique transaction ID (min. 4 chars)
price
Integer
Amount in minor currency units
countryCode
Enum
ISO 3166-1 alpha-2 code
currencyCode
Enum
ISO 4217 currency code
userId
String
Unique user identifier
Optional Parameters:
itemName
String
Name of the item being purchased
itemCode
String
Unique code for the item being purchased
dynamic_descriptor
String
Appears on the user’s card/bank statement
webhookUrl
String
URL for receiving payment status callbacks
returnUrl
String
URL to redirect the user to after payment completion
priceIncludesTax
Boolean
Indicates if the price includes tax (default is true)
Here's how you can initialize a payment, please see the example code:
public class TestCodaSDKHandler : MonoBehaviour
{
public Coda.CountryCode _countryCode = Coda.CountryCode.US; // Set this to Coda.CountryCode.ID to set default country as Indonesia for payment initiation.
public Coda.CurrencyCode _currencyCode = Coda.CurrencyCode.USD; // // Set this to Coda.CountryCode.IDR to set default currency code as Indonesian Rupiah for payment initiation.
public void OnPurchaseButtonClick()
{
Coda.PaymentSDK.InitiatePayment(
orderId: "order1234", // Required: Unique transaction ID
price: 1000, // Required: In minor currency units
countryCode: _countryCode, // Required: ISO country code enum
currencyCode: _currencyCode,// Required: ISO currency code enum
userId: "user456", // Required: Unique user identifier
// Optional
itemName: "Special Sword",
itemCode: "sword_001",
dynamic_descriptor: "MYGAME",
webhookUrl: "https://yourdomain.com/webhook",
returnUrl: "https://yourgame.com/success");
}
}If you haven’t built the UI yet, create a basic Purchase/IAP screen.
Create and attach the script that initiates payment, to the empty GameObject or to the UI screen, base upon the architecture and structure of your game.
Call OnPurchaseButtonClick() on the OnClick event of your Buy/Purchase/Upgrade button.

Verification:
When you play with the help of
button on top toolbar and click "Purchase" button in the Game Window, you should be able to see the following screen if you set _countryCode = Coda.CountryCode.US & _currencyCode= Coda.CurrencyCode.USDin the example script shown above.
When you play with the help of
button on top toolbar and click "Purchase" button in the Game Window, you should be able to see the following screen if you set _countryCode = Coda.CountryCode.ID & _currencyCode= Coda.CurrencyCode.IDRin the example script shown above.
Last updated
Was this helpful?