Ten-minute start
This path does through the API what a bank does for a new customer: create them, open an account, issue a virtual card, then pay with it. The answers below are real answers of the development platform (trimmed).
-
Get a token
Fenêtre de terminal TOKEN=$(curl -s http://localhost:8180/realms/ubo/protocol/openid-connect/token \-d grant_type=password -d client_id=ubo-api -d client_secret=$UBO_CLIENT_SECRET \-d username=$UBO_USER -d password=$UBO_PASSWORD | jq -r .access_token)The token lasts 5 minutes (
expires_in: 300); renew it with therefresh_token. It carries the account’s bank: everything created belongs to it. -
Create the cardholder in an organisation of the bank (
GET /entitieslists them).Fenêtre de terminal curl -s http://localhost:3000/cardholders -H "Authorization: Bearer $TOKEN" \-H 'content-type: application/json' \-d '{"entity_id":"e0000000-0000-0000-0000-000000000011","first_name":"Camille","last_name":"Durand","email":"camille.durand@example.com"}'{ "id": "01a21e88-f904-7423-863e-98684b8b1fec", "entity_id": "e0000000-…-000000000011","first_name": "Camille", "last_name": "Durand", "status": "active","kyc_level": 2, "pep": false, "aml_risk": "standard", … } -
Open their account and credit it
Fenêtre de terminal curl -s http://localhost:3000/accounts -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \-d '{"entity_id":"e0000000-0000-0000-0000-000000000011","cardholder_id":"01a21e88-…","currency_code":"EUR"}'curl -s http://localhost:3000/accounts/$ACCOUNT/credit -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \-d '{"amount":150000,"label":"Initial transfer"}'{ "account_id": "01a21e88-f95c-…", "currency_code": "EUR","booked_cents": 150000, "held_cents": 0, "overdraft_cents": 0, "available_cents": 150000 } -
Issue a virtual card and activate it
Fenêtre de terminal curl -s http://localhost:3000/cards -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \-d '{"entity_id":"e0000000-…-000000000011","cardholder_id":"01a21e88-…","product_code":"VISA-CLQ-PART","form_factor":"VIRTUAL","account_id":"01a21e88-f95c-…"}'{ "id": "01a21e8a-0ec9-7607-8fa8-deb17e39fd17", "last_four": "0033", "expiry_month": 11, "expiry_year": 2030,"status": "created", "product_code": "VISA-CLQ-PART", "form_factor": "VIRTUAL", … }The full number is never returned: it is sealed in the vault. The card is born created; activate it in two steps (the allowed transitions are those of the lifecycle):
Fenêtre de terminal curl -s -X PATCH http://localhost:3000/cards/$CARD/status -H "Authorization: Bearer $TOKEN" \-H 'content-type: application/json' -d '{"status":"pending_activation"}'curl -s -X PATCH http://localhost:3000/cards/$CARD/status -H "Authorization: Bearer $TOKEN" \-H 'content-type: application/json' -d '{"status":"active"}' -
Authorize a payment
In production, requests come from the networks. The
POST /authorizeAPI goes through the same six steps; it serves tests and channels outside the networks.Fenêtre de terminal curl -s http://localhost:3000/authorize -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \-d '{"card_id":"01a21e8a-0ec9-…","amount":4250,"currency":"EUR","mcc":"5411","merchant_name":"Leclerc","merchant_country":"FR","terminal_type":"contactless"}'{ "id": "01a21e8a-0fe2-7566-8cfc-42682e0e27e9", "approved": true, "response_code": "00","response_message": "Approved", "status": "authorized", "amount": 4250, "currency": "EUR","pipeline_duration_ms": 31,"stages": [ { "stage": "decode", "passed": true }, { "stage": "identify", "passed": true }, … ],"checks": [ { "stage": "validate", "kind": "card_status", "label": "Statut de la carte", "outcome": "pass" }, … ] }The amount is held on the account (
held_cents) until the presentment. -
Present the payment
Fenêtre de terminal curl -s -X POST http://localhost:3000/authorizations/$AUTH/capture -H "Authorization: Bearer $TOKEN"curl -s http://localhost:3000/accounts/$ACCOUNT/balance -H "Authorization: Bearer $TOKEN"{ "booked_cents": 145750, "held_cents": 0, "available_cents": 145750 }The cardholder is debited €42.50, the hold released. In production the presentment comes in the clearing file.
And when it is declined?
Section titled “And when it is declined?”An online payment of €9,000 without 3-D Secure:
{ "approved": false, "response_code": "1A", "response_message": "Additional customer authentication required", "status": "declined" }The decision explains why (GET /authorizations/{id}/decision; its texts are in French):
{ "integrity": "ok", "record": { "outcome": "challenge", "response_code": "1A", "stage": "validate", "stage_label": "P3 Validation", "decisive": { "kind": "3ds", "label": "Authentification forte (3-D Secure)", "detail": "Paiement en ligne sans authentification forte ni exemption acceptée — refus 1A" }, "explanation": [ "Étapes franchies : P1 Décodage, P2 Identification.", "Les règles n'ont pas été évaluées : la décision a été prise avant l'étape P4." ], "replayable": false } }
