Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IAP purchase validation support for FB Instant Games #1126

Merged
merged 10 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
351 changes: 182 additions & 169 deletions apigrpc/apigrpc.pb.go

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions apigrpc/apigrpc.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions apigrpc/apigrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,14 @@ service Nakama {
};
}

// Validate FB Instant IAP Receipt
rpc ValidatePurchaseFBInstant (api.ValidatePurchaseFBInstantRequest) returns (api.ValidatePurchaseResponse) {
option (google.api.http) = {
post: "/v2/iap/purchase/fbinstant",
body: "*"
};
}

// Write a record to a leaderboard.
rpc WriteLeaderboardRecord (api.WriteLeaderboardRecordRequest) returns (api.LeaderboardRecord) {
option (google.api.http) = {
Expand Down
52 changes: 50 additions & 2 deletions apigrpc/apigrpc.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,39 @@
]
}
},
"/v2/iap/purchase/fbinstant": {
"post": {
"summary": "Validate FB Instant IAP Receipt",
"operationId": "Nakama_ValidatePurchaseFBInstant",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiValidatePurchaseResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/apiValidatePurchaseFBInstantRequest"
}
}
],
"tags": [
"Nakama"
]
}
},
"/v2/iap/purchase/google": {
"post": {
"summary": "Validate Google IAP Receipt",
Expand Down Expand Up @@ -4652,10 +4685,11 @@
"enum": [
"APPLE_APP_STORE",
"GOOGLE_PLAY_STORE",
"HUAWEI_APP_GALLERY"
"HUAWEI_APP_GALLERY",
"FB_INSTANT_STORE"
],
"default": "APPLE_APP_STORE",
"description": "- APPLE_APP_STORE: Apple App Store\n - GOOGLE_PLAY_STORE: Google Play Store\n - HUAWEI_APP_GALLERY: Huawei App Gallery",
"description": "- APPLE_APP_STORE: Apple App Store\n - GOOGLE_PLAY_STORE: Google Play Store\n - HUAWEI_APP_GALLERY: Huawei App Gallery\n - FB_INSTANT_STORE: FB Instant Store",
"title": "Validation Provider,"
},
"apiSubscriptionList": {
Expand Down Expand Up @@ -4989,6 +5023,20 @@
},
"title": "Apple IAP Purchases validation request"
},
"apiValidatePurchaseFBInstantRequest": {
"type": "object",
"properties": {
"signedRequest": {
"type": "string",
"description": "Base64 encoded FB Instant signedRequest receipt data payload."
},
"persist": {
"type": "boolean",
"title": "Persist the purchase"
}
},
"title": "FB Instant IAP Purchase validation request"
},
"apiValidatePurchaseGoogleRequest": {
"type": "object",
"properties": {
Expand Down
41 changes: 40 additions & 1 deletion apigrpc/apigrpc_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion console/console.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions console/console.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3017,10 +3017,11 @@
"enum": [
"APPLE_APP_STORE",
"GOOGLE_PLAY_STORE",
"HUAWEI_APP_GALLERY"
"HUAWEI_APP_GALLERY",
"FB_INSTANT_STORE"
],
"default": "APPLE_APP_STORE",
"description": "- APPLE_APP_STORE: Apple App Store\n - GOOGLE_PLAY_STORE: Google Play Store\n - HUAWEI_APP_GALLERY: Huawei App Gallery",
"description": "- APPLE_APP_STORE: Apple App Store\n - GOOGLE_PLAY_STORE: Google Play Store\n - HUAWEI_APP_GALLERY: Huawei App Gallery\n - FB_INSTANT_STORE: FB Instant Store",
"title": "Validation Provider,"
},
"apiSubscriptionList": {
Expand Down
2 changes: 1 addition & 1 deletion console/console_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions console/ui/src/app/console.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ export enum ApiStoreProvider {
APPLE_APP_STORE = 0,
GOOGLE_PLAY_STORE = 1,
HUAWEI_APP_GALLERY = 2,
FB_INSTANT_STORE = 3,
}

/** A list of validated subscriptions stored by Nakama. */
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

replace github.com/heroiclabs/nakama-common => ../nakama-common

require (
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/heroiclabs/nakama-common v1.29.0 h1:UVeKSwPHHt7918hZly+ZglT2tXW+p0cF41Xxr07x/aE=
github.com/heroiclabs/nakama-common v1.29.0/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down
Loading
Loading