Comments (3)
Vendor docs
Together with a customer we decided to try to support the synchronous flow first. The asynchronous one may follow later.
New payments flow
- Client: Create a payment method and pass that to
POST /orders/:order_id/payments
- Server: Create a
PaymentIntent
with the payment method from the client - report back if the payment needs more actions (including the client secret for the payment intent) - Client: Completes additional action and calls
POST /payments/:payment_id/confirm
- Server: Responds with the result of checking if the transaction is completed, updates payment status on order
from gocommerce.
API docs for updated/new endpoints
POST /orders/:order_id/payments
Payload:
{
"provider": "stripe",
"stripe_payment_method_id": "<the id>"
}
Response: Transaction object
(state if 3D secure is pending)
{
"id": "...", // transaction id
"order_id": "...",
"invoice_number": "...",
"processor_id": "...",
"user_id": "...",
"amount": "...",
"currency": "...",
"status": "pending",
"type": "...",
"created_at": "...",
"provider_metadata": {
"payment_intent_secret": "<client secret>"
}
}
POST /payments/:payment_id/confirm
(payment id from previous response)
Payload: none
Response:
{
"id": "...",
"order_id": "...",
"invoice_number": "...",
"processor_id": "...",
"user_id": "...",
"amount": "...",
"currency": "...",
"status": "paid",
"type": "...",
"created_at": "..."
}
from gocommerce.
Updates to the SDK (gocommerce.js)
GoCommerce.payment(payment_details)
GoCommerce.paymentConfirm(payment_id)
new method
Example
const { status, provider_metadata, id: paymentId } = GoCommerce.payment({ stripe_payment_method_id: "..." })
if (status === "pending") {
const { payment_intent_secret } = provider_metadata
// do 3D secure
try {
GoCommerce.paymentConfirm(paymentId)
}
}
from gocommerce.
Related Issues (20)
- TBD and remaining issues HOT 2
- Install TLS certificate in GoCommerce instance HOT 3
- Bad pagination parameters HOT 1
- Database error on reports/products HOT 1
- Automate migration
- Indexes in postgresql are not namespaced HOT 1
- Make payment providers optional HOT 1
- No downloads returned. HOT 2
- Rip out netlify-commons HOT 1
- transactions list endpoint fails with SQL error
- Invalid http body on /claim endpoint
- Placing an order with multiple digital products allows to download only files for the first added
- Fix invalid paypal transaction updates
- Fix intermittently failing test: TestOrderCreate/MultipleItemsWithDownloads
- How can I use it ? HOT 3
- not working on heroku it show something error in code HOT 2
- [security] Enforce Branch Protections
- BUG - Error douring deploy on Heroku by button
- Different pricing based on user role
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 gocommerce.