Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »


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":"e1987ec5-2567-4048-ace9-...",
    "client_secret": "bb4c8136-874a-42ce-..."
}'

 

Response:

{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...",
    "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": "40193135809",
    "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 eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \
--data '{
    "cpf": "02981994166",
    "name": "Fernando",
    "amount": "0.15",
    "paymentview": "deposit-confirmation",
    "paymenttype": "MANU",
    "creditor": {
        "cpfCnpj": "16781564005",
        "name": "HOMOLOGACAO PIX",
        "personType": "PESSOA_NATURAL"
    },
    "creditorAccount": {
        "accountType": "CACC",
        "ispb": "92894922",
        "issuer": "0001",
        "number": "10173722"
    }
}'

 

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 eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \
--data '{
    "cpf":"01658698010",
    "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"
}

 

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 eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \
--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": "16781564005",
        "name": "HOMOLOGACAO PIX",
        "personType": "PESSOA_NATURAL"
    },
    "creditorAccount": {
        "accountType": "CACC",
        "ispb": "92894922",
        "issuer": "0001",
        "number": "10173722"
    }
}'

 

call response

 

{
    "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 eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \
--data '{
    "endpoint": "",
    "isAuthenticated": true,
    "user": "",
    "password": ""
}'

 

 

Example Request for Pet 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": "30ddc97c-90d0-4ba6-b681-...",
    "status": "ACCEPTED"
}

The status parameter can receive the values: "ACCEPTED", "AWAITING_APPROVAL" and "REJECTED"

 

Example Request for Pet 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 eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJJUV96OE...' \

 

call response

{
    "paymentId": "30ddc97c-90d0-4ba6-b681-...",
    "status": "ACCEPTED"
}

The status parameter can receive the values: "ACCEPTED", "AWAITING_APPROVAL" and "REJECTED"

 

  • No labels