Comments (8)
There's actually another example where the issuing bank's processing systems are down. It happens more than expected.
I can document some of the declination codes here.
from billy.
For recurring billing, current transaction model works like this
Transactions are yielded from subscription periodically, they will be processed at scheduled time. Once failed, it will go into RETRYING status, when the error count exceeds the limit, then it will go into FAILED. When the subscription is canceled, it will go into CANCELED status. If it is done, then it will be in DONE status.
And for invoicing, I am thinking about the process. Here is the state transition diagram
Current transaction model is pretty solid, so I think I can build the invoicing based on it. When an invoice is issued, it is in INIT status. Say, at the end of month, the cloud service provider issues an invoice to John. Upon receiving the invoice, John decides to settle it via credit card, so he updates the payment method (get a tokenized credit card number and assign it to the invoice). Then the invoice goes into PROCESSING status, a corresponding InvoiceTransaction will be generated. If the credit card has no enough fund for charging, and the InvoiceTransaction fails after some attempts, then the invoice goes into PROCESS_FAILED status. John was notified for this problem, he updates his payment method then. By doing that, invoice goes back into PROCESSING status. A while later, the charging is done, then it is SETTLED now.
For some reasons, the service provider want to refund the invoice, then the invoice goes into REFUNDING status. By the time, the upstream balanced API server is down, so its refunding transaction will retry. For a while later, it is done. Then it is REFUNDED eventually.
So, there will be invoice transactions look like this
- type=charge, status=FAILED, payment_uri=/v1/credit_card1
- type=charge, status=DONE, payment_uri=/v1/credit_card2
- type=refund, status=DONE
This is pretty much the story in my mind so far. It basically tries a couple of times when a payment method is set, when it fails, goes into fail status and wait actions from users. The under-layer transaction model provides a retrying mechanism, so temporary issues (server downtime or anything like that) can be avoided. If there are some corner cases are missing, please let me know.
from billy.
@victorlin do you consider what the failure reason is? You shouldn't retry if there is a Hard Failure such any of the following:
- lost or stolen card
- invalid card
- canceled card
from billy.
@matin make sense. will do.
@mahmoudimus @mjallday @msherry
What kind of hard failure errors (code or message) we are expecting from Balanced API? I try to read the source code, but cannot find something useful. I think they are from under-layer API.
from billy.
@victorlin I think the Balanced API should return a flag indicating if it's a hard failure or not. the current error codes are vendor specific and it shouldn't be the job of services that consume the Balanced API to interpret 3rd party error messages.
There's an open issue to address this - balanced/balanced-api#412
from billy.
@mjallday So, how can I tell is it a hard failure or not from the response? For example, I received a response like this
{
"status": "Conflict",
"category_code": "bank-account-already-associated",
"description": "Bank account has already been associated with an account. Your request id is OHMbaa8b6620a2b11e3adde026ba7c1aba6.",
"status_code": 409,
"extras": {},
"category_type": "logical",
"_uris": {},
"request_id": "OHMbaa8b6620a2b11e3adde026ba7c1aba6",
"additional": null
}
from billy.
New transaction state diagram, upon encountering hard failure, it will go into FAILED status immediately.
from billy.
Why would the API expose a flag telling you to retry? Just retry over intervals. Google for "dunning recurring billing" and you'll see a wealth of resources.
from billy.
Related Issues (20)
- Make soft description can be changed by user
- Adjustments HOT 12
- Dogfooding HOT 6
- Generate End-of-Year invoice report for marketplaces
- Figure out a way to make Balanced works with Billy
- Reference Moonpig - A Billing System That Doesn't Suck HOT 1
- Package Billy using Omnibus HOT 2
- Will Billy be integrated into the Balanced dashboard? HOT 1
- appears_on_statement_as parameter for Billy transactions HOT 3
- Put micro-deposit verification logic into Billy
- PHP Client
- Use v1.1 Balanced API instead of v1.0
- Allow 127.0.0.1 and localhost to call API via XHR
- Change debit.succeeded event HOT 5
- Subscription with items
- Allow orders to be used from within Billy
- SSL Cert has expired HOT 5
- Add new status for subscriptions
- Send event when subscription is canceled
- Balanced Payments is shutting down
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 billy.