SG Payment system incorporates third-party vendors billing system to help you implement in-app purchasing (IAP) function easier.
Please follow settings bellow before using Apple In-App Purchase service.
IAPInit(productIDs: [String]) -> VoidDescription
1 2 3 4 5 |
productIDs.append("ConsumbleItem") productIDs.append("NonConsumable") productIDs.append("AutoSubscription") productIDs.append("NonAutoSbuscriptions") SGSDK.Instance.IAPInit(productIDs: productIDs) |
Pay(payRequest: SGPayRequest) -> VoidDescription
SGSDK.Instance.Pay(payRequest: initPayReq(productId: productIDs[0], payMethod: "managed"))
1 2 3 4 5 6 7 8 9 10 11 12 13 |
private func initPayReq(productId: String, payMethod: String) -> SGPayRequest { let req = SGPayRequest() req.ProductId = productId req.PaymentMethod = payMethod req.PaymentChannel = "AppStore" req.ServerId = "Server ID" req.ServerName = "Server Name" req.RoleId = "9487" req.RoleName = "Roger" req.RoleLevel = 99 req.PayNotifyUrl = "PAY_NOTIFY_URL" return req } |
GetOrder(orderId: String, gameKey: String, openId: String, sign: String) -> VoidDescription
gameKey | Your developer identification. |
openId | SG member ID. You can obtain it through GetOpenID() after user login. |
orderId | Order ID you passed in when making the purchase. |
sign |
Signature generated from above three parameters. Please refer to signature algorithm. |
RestorePurchase() -> VoidDescription