nov / itunes-receipt Goto Github PK
View Code? Open in Web Editor NEWHandle iTunes In App Purchase Receipt Verification
License: MIT License
Handle iTunes In App Purchase Receipt Verification
License: MIT License
When converting to JSON, many of the fields are missing, most notably the in app purchases are missing.
The json conversion method was added in b991925.
Was there a specific reason for adding the as_json method? Removing the as_json method seems to resolve the issue.
There is a cancellation date provided with the receipt to notify of subscriptions that are no longer valid.
I currently get this error:
"ArgumentError:
wrong number of arguments (1 for 0)"
I'm running on ruby 1.9.3.
When I verify receipts for auto-renewable subscriptions, the value for expires_date
is wrong:
receipt_data = "..." # receipt for auto-renewable subscription
receipt = Itunes::Receipt.verify!(receipt_data, true)
receipt.expires_date
# => "1969-12-31 16:00:02.000000000 -08:00" (UTC epoch + 2 seconds?)
I think Receipt#initialize
is parsing expires_date
as milliseconds, but Apple's validator returns it as three fields (date, date_ms, and date_pst), similar to how it returns purchase_date
. Snippet of a raw response from the validator:
{
"receipt": {
"in_app": [
{
...,
"purchase_date": "2015-08-01 11:47:43 Etc/GMT",
"purchase_date_ms": "1438429663000",
"purchase_date_pst": "2015-08-01 04:47:43 America/Los_Angeles",
"expires_date": "2015-09-01 11:47:43 Etc/GMT",
"expires_date_ms": "1441108063000",
"expires_date_pst": "2015-09-01 04:47:43 America/Los_Angeles",
It looks like at some point Apple standardized how they return their date fields, but expires_date
is being parsed as ms instead of a date string.
This gem is working perfectly for non renewal subscriptions.
For auto renewal subscriptions verification fails. Auto renewal subscription needs shared secret but i don't know where to set My Shared Secret in the code.
Can you please help me....
i have some exceptions since we put it in production. Basically it works i checked with my live app account etc. But for some receipts i have these errors :
no implicit conversion of Symbol into Integer
itunes-receipt (1.0.0) lib/itunes/receipt.rb:54:in `[]'
do you have any ideas you want me to send you a sample receipt?
I've been getting these errors in production. I've fixed the issue on a custom branch of mine by swapping out RestClient for Faraday.
I, [2018-03-01T15:53:16.455400 #19005] INFO -- : Celluloid 0.17.2 is running in BACKPORTED mode. [ http://git.io/vJf3J ] Loading development environment (Rails 4.2.5) irb(main):001:0> require 'itunes' => false irb(main):002:0> Itunes::Receipt.verify!({}) RestClient::SSLCertificateNotVerified: SSL_connect returned=1 errno=0 state=error: certificate verify failed: from /Users/kaom/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/rest-client-1.8.0/lib/restclient/request.rb:445:in
rescue in transmit'`
It would be great if the receipt object would expose the cancellation_date
field for auto-renewable subscriptions!
From the receipt fields docs:
For a transaction that was canceled by Apple customer support, the time and date of the cancellation. Treat a canceled receipt the same as if no purchase had ever been made.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.