Comments (1)
Closing this since it's not an issue and just confusion with how to pull the data out.
for future reference something like this can be achieved for checking webhook payloads.
func handleStripeWebhooks(req: Request) throws -> EventLoopFuture<Response> {
try StripeClient.verifySignature(for: req, secret: "whsec_1234")
// Stripe dates come back from the Stripe API as epoch and the StripeModels convert these into swift `Date` types.
// Using a custom decoder to successfully parse out the time.
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .secondsSince1970
let event = try req.content.decode(StripeEvent.self, using: decoder)
switch (event.type, event.data?.object) {
case (.accountUpdated, .account(let account)):
return req.eventLoop.makeSucceededFuture(Response(status: .ok))
case (.paymentIntentSucceeded, .paymentIntent(let paymentIntent)):
print("Payment capture method: \(paymentIntent.captureMethod?.rawValue)")
return req.eventLoop.makeSucceededFuture(Response(status: .ok))
default: return req.eventLoop.makeSucceededFuture(Response(status: .ok))
}
}
from stripe-kit.
Related Issues (20)
- Ephemeral Keys? HOT 2
- No ID in CustomerRoutes update method
- Incorrect Ephemeral Keys Endpoint HOT 1
- ChargePaymentMethodDetailsType of type link does not exist
- Mistake in the mapping of allowed documents for verificationSessions/Reports
- CustomerSearchResult Data field is incorrect HOT 1
- AddHeaders not available on UsageRecordRoutes
- Incorrect API paths in TerminalReaderRoutes
- Initting objects does not have nil defaults. HOT 1
- Cannot create a PaymentLink
- Cannot retrieve connected account (using old URL) HOT 3
- Missing enum on PaymentMethodCardNetwork HOT 1
- previousAttributes on Webhook events HOT 14
- EventObject is not actually Encodable
- Failing to decode EventObject of type 'application'
- Subscription schedule applicationFeePercent incorrect type
- Subscription schedule fromSubscription incorrect type
- Subscription schedule phase prorationBehavior missing case
- MIssing IIN from paymentmethodcard
- how complete is the stripe kit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stripe-kit.