Collection Open Keys - Payment Initiation Journey
POST Token
To start a journey, it is necessary to generate a token in which client_id and client_secret must be indicated , according to the model below.
Token generation URL
https://onboard.smartkeys.engdev.fsapps.io/api/portal/onboard/v1/token
cURL for Token generation
curl --location 'https://onboard.smartkeys.engdev.fsapps.io/api/portal/onboard/v1/token' \ --header 'Content-Type: application/json' \ --data '{ "client_id":"****7ec5-2567-4***-ace9-***", "client_secret": "****8136-***a-42ce-***" }'
Response:
{ "access_token": "eyJh******ciOiJ****I1NiIsInR5*****IgOiAiSldUIiwia2lkIiA6ICJJUV96OE****", "expires_in": 3600, "refresh_expires_in": 0, "token_type": "Bearer", "not-before-policy": 0, "scope": "email profile" }
The token returned in the “access_token“ field has a default validity of 1 hour and must be used to make subsequent calls. It must be included in the Authentication parameter of the request header, preceded by the word “Bearer”, example:
'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...'
Once you managed to generate the Token, according to the step by step of the previous step, just make a POST that will return the white label journey link
Request for starting the Digital Journey - using DICT
curl --location 'https://onboard.smartkeys.celcoin.dev.fsapps.io/api/portal/onboard/v1/payment' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \ --data '{ "cpf": "401*****809", "name": "Fernando", "amount": "100.00", "paymentview": "deposit-confirmation", "paymenttype": "DICT" }'
Mandatory fields to fill in the request:
CPF - mandatory field
Transaction amount - required field
Paymentview - required field
Paymenttype - required field
Specificity for Paymentview and Paymenttype fields
Paymentview PIX Instantâneo - deposit-confirmation
Paymentview PIX Agendado - deposit-deposit-scheduling
Paymenttype via DICT - presents the data registered in the Application Panel, option Configure Journeys, field Receipt data
Paymenttype via MANU - it is necessary to pass the “creditor” and “creditorAccount” blocks, as shown in the sketch below.
Example of Request with MANU
curl --location 'https://onboard.smartkeys.celcoin.dev.fsapps.io/api/portal/onboard/v1/payment' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ey*****J*****IsInR5c****CIgOiAiSldU*IiA6ICJ****JUV96OE...' \ --data '{ "cpf": "02981994166", "name": "Fernando", "amount": "0.15", "paymentview": "deposit-confirmation", "paymenttype": "MANU", "creditor": { "cpfCnpj": "167******005", "name": "HOMOLOGACAO PIX", "personType": "PESSOA_NATURAL" }, "creditorAccount": { "accountType": "CACC", "ispb": "92894922", "issuer": "0001", "number": "10173722" } }'
Optional: External ID
When generating the payment initiation, it is possible to add an external ID using the object bellow, it is required:
The field is included inside object “data” at the same level of brandID;
The field name is “externalid".
"metadata":{ "externalId": "000111" },
Response:
The field externalid will be presented as a new parameter in callback url registered in the application.
Optional: Tags
When generating the payment initiation, it is possible to add an tags using the object bellow, it is required:
The array maximum size to be up to 5 itens
The field is included inside object “data” at the same level of brandID;
The name of the tags must not be longer than 36 characters (to maintain the limitation on the number of characters)
limitar os tipos de caracteres para Alfanuméricos e caracteres não reservados:
`a-z`
`A-Z`
`0-9`
`-`, `_`, `.`, `~`
"metadata": { "tags": { "tag": "123456", "tag2": "SomeTag_2", "tag3": "AdditionalInfo", "tag4": "project_id", "tag5": "finalTag" } }
Response:
All fields in Tags will be shown in the callback.
Optional: Preferred Banks
It is an array up to 8 itens from the brand-id list.
"preferredbanks": [ "b09ede32-83db-4019-8ca3-a9a6f9376d0b"]
It is only in the WhiteLabel solution:
And this information is not shown in the callback.
Optional: Pre-selected banks
It is a string with one brand from the brand-id list.
"preselectedbank": "b09ede32-83db-4019-8ca3-a9a6f9376d0b"
call response
{ "url": "https://smartkeys-wl.celcoin.dev.fsapps.io/select-institution?id=yL79m4Kzc7DI0WfL-QKW_k_2b5..." }
Note: if the call is made in a partial request, in the AJAX model, you must capture the POST return to redirect the client, via a window.
How to start the digital journey, using the Data Sharing white label
Once you managed to generate the Token, according to the step by step of the previous step, just make a POST that will return the white label journey link
Request for Digital Journey startup - Data Sharing
curl --location 'https://onboard.smartkeys.celcoin.dev.fsapps.io/api/portal/onboard/v1/reception' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer e****GciOiJ*******nR5cCIgOiAiSldUIiw*****A6ICJJUV96OE...' \ --data '{ "cpf":"01*****8010", "cnpj": "", "name":"fernando" }'
Mandatory fields to fill in the request:
CPF - mandatory field, in all contexts
CNPJ - required field for a data sharing context for legal entities
call response
{ "url": "https://smartkeys-wl.celcoin.dev.fsapps.io/?id=BYYPeLTrbfLABZcSeSMsJPFUWWsWBKq0" }
Response with externalid
{ "url": "https://smartkeys-ui.engdev.fsapps.io/callback?ticket=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICIwMTQ4ZjkxZS01NjA1LTRlYzktYWY3My0wM2UzOGNiNmIwNGUifQ.eyJleHAiOjE2ODA2MjU0MjUsIm5iZiI6MCwiaWF0IjoxNjgwNjIxODI1LCJwZXJtaXNzaW9ucyI6W3sicnNpZCI6IjNlN2Q4NTMxLWQ4MjMtNDg1Ny04NjZiLTZmMTg2OTMyNWY4NiJ9XSwianRpIjoiZjQzYTgzZWYtMGE0MC00ZTgyLThiOWMtZjhiZGFiNjM2ZWZiLTE2ODA2MjE4NTAwODMiLCJhdWQiOiJodHRwczovL2tleWNsb2FrLmZ1bGwtZGV2LmZpbmFuc3lzdGVjaC5jb20uYnIvYXV0aC9yZWFsbXMvc21hcnQta2V5cyIsInN1YiI6ImM4OTJkYjViLTUyMDktNDBhOS1iNGQwLTdjMmM4MzViYWM0OCIsImF6cCI6ImNlbGNvaW4ifQ.nhW9PVOlHE2sgzy4iU2MeqOi_QDAjI0rAf2isytNmXw&state=lPOOqD1D-Fjndvnt63moETZVIiTqpFRf4EVOFtATXuE&externalId=000111" }
ATTENTION: if the call is made in a partial request, in the AJAX model, you must capture the POST return to redirect the client, via window.
Known bugs:
400 - Failed to validate mandatory fields;
401 - Invalid Authentication Token
Alternative journey to start Payment Initiation white label
When starting the journey through the white label, by default, the user is directed to the bank selection screen. As part of this process, it is necessary to send the customer's CPF by parameters in the call to generate the white label link, but in cases where the application that starts the process does not yet have the customer's CPF, there is the possibility of showing the CPF field on this bank selection screen, as well as showing a list of preferred banks on this screen. For these cases, you can use the call below.
Example of Request with MANU
curl --location 'https://onboard.smartkeys.celcoin.dev.fsapps.io/api/portal/onboard/v1/payment' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJh******iOiJSUzI**********iAiSldUIiwia2lkIi*****CJJUV96OE...' \ --data '{ "amount": "100.00", "paymentview": "deposit-confirmation-simple", "paymenttype": "MANU", "preferredbanks": ["b0e14b00-9686-4764-bdac-5fe415b1dc1a", "c8f0bf49-4744-4933-8960-7add6e590841", "95dd24d2-902e-49e1-ad0d-e02d938447ba"], "creditor": { "cpfCnpj": "16*****005", "name": "HOMOLOGACAO PIX", "personType": "PESSOA_NATURAL" }, "creditorAccount": { "accountType": "CACC", "ispb": "92894922", "issuer": "0001", "number": "10173722" } }'
Optional: External ID
In the same method as seen above.
{ "url": "https://smartkeys-wl.celcoin.dev.fsapps.io/select-institution?id=yL79m4Kzc7DI0WfL-QKW_k_2b5..." }
Callback Page (Return of the White Label Payment Initiation flow)
After executing the consent flow and payment approval, the user is directed to the callback page registered at the time of onboarding, this page can check the approved payment status and show a thank you/failure message.
How to check the approved payment status update
Changing the status of the initiated payment can be done in 2 ways, registering a Webhook in the application or consulting the status of this consent via API (Polling)
Example Request for Registering a WebHook
curl --location 'https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/interceptor' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbG******OiJSUzI1N****iIsIn*****R5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \ --data '{ "endpoint": "", "isAuthenticated": true, "user": "", "password": "" }'
Example Request for Get Payment API to check payment status by Payment ID
curl --location 'https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/payment-consumer/v1/pix/payments/0d42f0c8-f5ff-493f-a350-19d5b8b76618' --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \
call response
{ "paymentId": "3****97c-9***0-4**6-b681-***", "status": "ACCEPTED" }
The status parameter can receive the values: "ACCEPTED", "AWAITING_APPROVAL" and "REJECTED"
Example Request for Get Payment API to check payment status by Consent ID
curl --location 'https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/payment-consumer/v1/pix/consents/yfPdbpcWgHQo1VL5vrYzd0xIRuxEUJqPO5ufvEN2esA' --header 'Authorization: Bearer eyJhbGci******NiIsInR5cC*****IgOiAiSldU******Iiwia2lkIiA6ICJJUV96OE...' \
call response
{ "paymentId": "30****97c-***d0-4**6-b681-...", "status": "ACCEPTED" }
The status parameter can receive the values: "ACCEPTED", "AWAITING_APPROVAL" and "REJECTED"