-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rb
More file actions
35 lines (29 loc) · 802 Bytes
/
Copy pathmain.rb
File metadata and controls
35 lines (29 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'sinatra'
require 'jwt'
require 'erb'
get '/' do
seller_secret = "your_seller_secret"
seller_id = "your_seller_id"
@cake_jwt = JWT.encode(
{
"iss" => seller_id,
"aud" => "Google",
"typ" => "google/payments/inapp/item/v1",
"exp" => (Time.now + 3600).to_i,
"iat" => Time.now.to_i,
"request" => {
"name" => "Piece of Cake",
"description" => "Virtual chocolate cake to fill your virtual tummy",
"price" => "10.50",
"currencyCode" => "USD",
"sellerData" => "user_id:1224245,offer_code:3098576987,affiliate:aksdfbovu9j"
}
},
sellet_secret )
erb :index
end
post '/' do
seller_secret = "your_seller_secret"
data = JWT.decode(params[:jwt], seller_secret)
data['response']['orderId']
end