Collection Open Keys - Payment Initiation
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":"*****-2567-4048-****-6e**7b9f****", "client_secret": "b**c8136-****-42ce-****-ac422f5*****" }'
Response:
{ "access_token": "*****ciOiJSUzI1NiIsInR******SldUIiwia2lkIiA6ICJJUV96OEhCYTFqdlZPMGVVcDl6aW5ldmJVaG9uSlI2cEJsOHBoQnVsSXAwIn0.eyJleHAiOjE2ODA2MjE3OTIsImlhdCI6MTY4MDYxODE5MiwianRpIjoiNmMyMjAyMjUtOTJlZS00YTFkLWE3MGUtMWFjZGZmNDE3OGI4IiwiaXNzIjoiaHR0cHM6Ly9rZXljbG9hay5mdWxsLWRldi5maW5hbnN5c3RlY2guY29tLmJyL2F1dGgvcmVhbG1zL3NtYXJ0LWtleXMiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOTEzYTBmZjYtNjE4Yy00NDM3LWE0ZWUtMmU0ZmQyYzVmMDU4IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZTE5ODdlYzUtMjU2Ny00MDQ4LWFjZTktNmU2ZDdiOWY3N2ZjIiwiYWNyIjoiMSIsInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsImRlZmF1bHQtcm9sZXMtc21hcnQta2V5cyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiZTE5ODdlYzUtMjU2Ny00MDQ4LWFjZTktNmU2ZDdiOWY3N2ZjIjp7InJvbGVzIjpbInVtYV9wcm90ZWN0aW9uIl19LCJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJzY29wZSI6ImVtYWlsIHByb2ZpbGUiLCJjbGllbnRJZCI6ImUxOTg3ZWM1LTI1NjctNDA0OC1hY2U5LTZlNmQ3YjlmNzdmYyIsImNsaWVudEhvc3QiOiIxMC4yNDAuMC4xMCIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LWUxOTg3ZWM1LTI1NjctNDA0OC1hY2U5LTZlNmQ3YjlmNzdmYyIsImNsaWVudEFkZHJlc3MiOiIxMC4yNDAuMC4xMCJ9.fRaM_i2uIohrN8WcOmlD4M3bJf4lu8zEtKKNv3dW9xiP2QmvDTCX3LIgcwakMFTahjZdIJFK95ioaEPvQpLK38QXAKJPMfzEjar39ruUNth4pqiE8iPBGTV4lNSIMArMI-pgBOpJCr2lLDfKnjvrkIqf1rrnCGdZc8UhpxkJtbtFBVDlvQBnFp-N_KiKyYIIvUvEqzHxetag9W715b9DqoDynHp_Pf7kkk1g5P4U7cQjKlKAYNoIlNiJuhrqnaFQjE-E3iltf_PDzSxQRFvavI4dJYX8dofzNLKDgmXLJ6iqfh9g7G-ny383JJp1ObKy-N876DPzimWrtdX4FAgBpA", "expires_in": 3600, "refresh_expires_in": 0, "token_type": "Bearer", "not-before-policy": 0, "scope": "email profile" }
POST Payment Initiation
With the generated token, it is necessary to pass it in the authorization of the call /consents , to obtain the user's consent and information, according to the model below.
https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/payment-initiation/v1/consents
curl --location 'https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/payment-initiation/v1/consents' \ --header 'Content-Type: application/json' \ --data '{ "data": { "loggedUser": { "document": { "identification": "12345678909", "rel": "CPF" } }, "creditor": { "cpfCnpj": "*****08000166", "name": "HOMOLOGACAO PIX", "personType": "PESSOA_NATURAL" }, "payment": { "amount": "1.15", "currency": "BRL", "date": "2023-07-06", "details": { "creditorAccount": { "accountType": "CACC", "ispb": "92894922", "issuer": "0001", "number": "10173722" }, "localInstrument": "DICT", "proxy": "55155114845" }, "type": "PIX" } }, "brandId": "95dd24d2-902e-49e1-ad0d-e02d938447ba" }'
Response:
{ "authorizationUrl": "https://openfinance.dev.fbank.opb.obm.engdev.fsapps.io/orgs/finansystech/auth?client_id=xcFd-8KjONJT2FCEHCnTK&scope=openid%20consent%3Aurn%3Afinansystech-dev%3A173d2e64-b51c-40f3-89f6-a04b429bbd33%20accounts%20credit-cards-accounts%20customers%20loans%20financings%20unarranged-accounts-overdraft%20invoice-financings%20resources&response_type=code%20id_token&redirect_uri=https%3A%2F%2Fsmartkeys-ui.engdev.fsapps.io%2Fcallback&request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3AJtyZkiseLta9akkCRRpCT" }
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.
GET Authorization URL
After the user's definitions regarding the data they want to share and the sharing period, we must obtain the redirection URL for the login at the transmitter, where the interaction_id for the login is obtained, according to the model below.
https://openfinance.dev.fbank.opb.obm.engdev.fsapps.io/orgs/finansystech/auth?client_id=xcFd-8KjONJT2FCEHCnTK&https://openfinance.dev.fbank.opb.obm.engdev.fsapps.io/orgs/finansystech/auth?client_id=https://onboard.smartkeys.engdev.fsapps.io/api/portal/onboard/v1/reception
curl --location 'https://openfinance.dev.fbank.opb.obm.engdev.fsapps.io/orgs/finansystech/auth?client_id=xcFd-8KjONJT2FCEHCnTK&scope=openid%20consent%3Aurn%3Afinansystech-dev%3Ae119d330-4e42-4f9b-ae25-8fabb53de785%20accounts%20credit-cards-accounts%20customers%20loans%20financings%20unarranged-accounts-overdraft%20invoice-financings%20resources&response_type=code%20id_token&redirect_uri=https%3A%2F%2Fsmartkeys-ui.engdev.fsapps.io%2Fcallback&request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3AkdDMUphtJfrVHFm4nC-5H'
POST Callback
After the user confirmation step in the transmitting institution's environment, the transaction callback is returned, according to the model below.
https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/payment-initiation/v1/consents/callback
curl --location 'https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/payment-initiation/v1/consents/callback' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJSY0hYOGxFRl93QmxFNUF3eXY2TV9JQUFEUm1pSzV5SWlnWDhDeXpzNzdvIn0.eyJleHAiOjE2ODkxOTEyODQsImlhdCI6MTY4OTE4NzY4NCwianRpIjoiYTYwZmUyNDUtNmY2ZC00NzBlLTljY2ItM2ZkYmIzZWQ5YzEzIiwiaXNzIjoiaHR0cHM6Ly9rZXljbG9hay5jZWxjb2luLnNoYXJlZC5mc2FwcHMuaW8vYXV0aC9yZWFsbXMvc21hcnQta2V5cyIsImF1ZCI6ImFjY291bnQiLCJzdWIiOiI2ZmJjN2YyOC0yNDNkLTQ3MDMtOGE2MC0xYTEyOWUwNGFjOTMiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiIwMzNmNzgxNi02ZDNlLTRkYzYtODgzMi1mNzZlNDdhMzE2M2YiLCJhY3IiOiIxIiwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIm9mZmxpbmVfYWNjZXNzIiwiZGVmYXVsdC1yb2xlcy1zbWFydC1rZXlzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyIwMzNmNzgxNi02ZDNlLTRkYzYtODgzMi1mNzZlNDdhMzE2M2YiOnsicm9sZXMiOlsidW1hX3Byb3RlY3Rpb24iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSIsImNsaWVudElkIjoiMDMzZjc4MTYtNmQzZS00ZGM2LTg4MzItZjc2ZTQ3YTMxNjNmIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJjbGllbnRIb3N0IjoiMjAuOTkuMjEwLjIzNSIsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2UtYWNjb3VudC0wMzNmNzgxNi02ZDNlLTRkYzYtODgzMi1mNzZlNDdhMzE2M2YiLCJjbGllbnRBZGRyZXNzIjoiMjAuOTkuMjEwLjIzNSJ9.FrIov1Lfl4IzB90nnu4QfXxoZVlOBjBIvk7L1EtKe9G_DyeRC2kbxRFpI1ig6FIiD2lIU4Ff5VKWMw7AWVOuddREeKeyVaUz8hdQHxO5MtpAIomZ_268GD_Vd9nBUKPP3x79lCswgFe3VHKj0UnxTRx5BmceFEhBGqFBZa0knKgMAQANsWgyMApPzMch7uOers_bQHxPVMZ44MFySB3U10MsYqIOefUzYilj0bbPrCzlAPWF8fvu3lzOFfm5sHTnyU5Swj1HeQbvCNsSY5Vg0K5UXenAoj63vQI5zKoXqhH7rZp7pZGZIWVnqP15nvy9KtOUfkjbQnwqjwW_MTJ7tQ' \ --data '{ "code": "", "id_token": "", "state": "" }'
Default response
{ "url": "https://smartkeys-ui.engdev.fsapps.io/callback?ticket=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICIwMTQ4ZjkxZS01NjA1LT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6cCI6ImNlbGNvaW4ifQ.nhW9PVOlHE2sgzy4iU2MeqOi_QDAjI0rAf2isytNmXw&state=lPOOqD1D-Fjndvnt63moETZVIiTqpFRf4EVOFtATXuE&externalId=000111" }
GET Consent by ID
In order to use the GET Consent ID, it is necessary to use the ConsentID bellow:
“state=lPOOqD1D-Fjndvnt63moETZVIiTqpFRf4EVOFtATXuE”
curl --location 'https://api-smartkeys.celcoin.dev.fsapps.io/api/smart-keys/payment-initiation/v1/consents/lPOOqD1D-Fjndvnt63moETZVIiTqpFRf4EVOFtATXuE' \
--header 'type: smart-keys' \
--header 'Authorization: Bearer {{application_token}}'
Response
All the data from ConsentID (user information, error status, journeyID and others), example bellow:
{
"creditor": {
"cpfCnpj": "55155114845",
"name": "HOMOLOGACAO PIX",
"personType": "PESSOA_NATURAL"
},
"debtorAccount": null,
"payment": {
"amount": "1.15",
"currency": "BRL",
"date": "2024-02-15",
"details": {
"creditorAccount": {
"accountType": "CACC",
"ispb": "92894922",
"issuer": "0001",
"number": "10173722"
},
"localInstrument": "DICT",
"proxy": "55155114845"
},
"type": "PIX"
},
"creationDateTime": {
"$date": "2024-02-15T18:44:33.829Z"
},
"status": "CONSUMED",
"statusUpdateDateTime": {
"$date": "2024-02-15T18:44:56.799Z"
},
"expirationDateTime": {
"$date": "2024-02-15T18:49:33.829Z"
},
"loggedUser": {
"document": {
"identification": "12345678909",
"rel": "CPF"
}
},
"businessEntity": null,
"kind": "PAYMENT",
"brandId": "b09ede32-83db-4019-8ca3-a9a6f9376d0b",
"clientId": "09d206b9-7e21-44f0-bb8b-33744eb4197c",
"consentId": "urn:finansystech-dev:f689dca5-3d97-4a04-aae2-2dfb4f87d195",
"organizationName": "Finansystech Mock",
"organizationLogo": "https://finansystech-pub.s3.sa-east-1.amazonaws.com/f_logo.svg",
"metadata": {},
"journeyId": "",
"endToEndId": "E139358932024021515444PJg7I76ZUm",
"pixStatus": "ACSC",
"paymentId": "a2b1d61d-1177-4b6b-9d41-1bcc8221e94c"
}v1/consents/lPOOqD1D-Fjndvnt63moETZVIiTqpFRf4EVOFtATXuE' \
--header 'type: smart-keys' \
{
"creditor": {
"cpfCnpj": "55155114845",
"name": "HOMOLOGACAO PIX",
"personType": "PESSOA_NATURAL"
},
"debtorAccount": null,
"payment": {
"amount": "1.15",
"currency": "BRL",
"date": "2024-02-15",
"details": {
"creditorAccount": {
"accountType": "CACC",
"ispb": "92894922",
"issuer": "0001",
"number": "10173722"
},
"localInstrument": "DICT",
"proxy": "55155114845"
},
"type": "PIX"
},
"creationDateTime": {
"$date": "2024-02-15T18:55:50.707Z"
},
"status": "REJECTED",
"statusUpdateDateTime": {
"$date": "2024-02-15T18:57:04.166Z"
},
"expirationDateTime": {
"$date": "2024-02-15T19:00:50.707Z"
},
"loggedUser": {
"document": {
"identification": "12345678909",
"rel": "CPF"
}
},
"businessEntity": null,
"kind": "PAYMENT",
"brandId": "b09ede32-83db-4019-8ca3-a9a6f9376d0b",
"clientId": "09d206b9-7e21-44f0-bb8b-33744eb4197c",
"consentId": "urn:finansystech-dev:05437902-54d6-4fda-8fe0-b13cef39e3fb",
"organizationName": "Finansystech Mock",
"organizationLogo": "https://finansystech-pub.s3.sa-east-1.amazonaws.com/f_logo.svg",
"metadata": {},
"journeyId": "",
"rejectionReason": {
"code": "",
"detail": ""
}
}