Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewangeta authored Aug 8, 2020
1 parent e7e3f49 commit f9b596b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ func handleStripeWebhooks(req: Request) throws -> EventLoopFuture<HTTPResponse>

try StripeClient.verifySignature(payload: req.body, header: signature, secret: "whsec_1234")
// Stripe dates come back from the Stripe API as epoch and the StripeModels convert these into swift `Date` types.
// Use a date decoding stragetdy to successfully parse out the `created` property.
// Use a date and key decoding strategy to successfully parse out the `created` property and snake case strpe properties.
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .secondsSince1970
decoder.keyDecodingStrategy = .convertFromSnakeCase

let event = try decoder.decode(StripeEvent.self, from: req.bodyData)

Expand Down

0 comments on commit f9b596b

Please sign in to comment.