After creating a cash in OpenFinance transaction it is possible to simulate their transition to final states using the UI provided, as seen in the PIX and OpenFinance Guide. But, it is also possible to simulate these states using API calls.
These transitions trigger webhook calls and allow you to properly test the assynchronous event calls.

If you are not familiar with our webhook approach for assychronous updates, please refer to the Asynchronous Events Guide.

Next, we present you a set of useful request examples to help you achieve this.


Transaction Completion

Reference Endpoint

  • POST /sandbox/payment-initiation/complete/{transactionId}

This endpoint allows you to simulate the successful payment of a PIX transaction, by providing the created transactionId. For the examples bellow, consider the transaction id 3fd0770b-6796-40ea-9820-d98b786bf1e5.


  • The Request Response (200 - OK)
{
  "statusCode": "Done",
  "data": {
    "transactionId": "3fd0770b-6796-40ea-9820-d98b786bf1e5",
    "transactionState": "Completed"
  }
}
  • The Webhook Event Payload
{
  "id": "3fd0770b-6796-40ea-9820-d98b786bf1e5",
  "transactionState": "Completed",
  "transactionDate": "2023-08-04T14:45:34.150Z",
  "transactionOrderId": "in-1414870875-158709817091784",
  "transactionOrderDescription": "This is a test order.",
  "transactionReceipt": "https://api.sandbox.pagfast.com/v1/system/e-receipt/4494a26c-4f21-400a-bbe7-cbef6ea7c3c3/receipt.pdf", 
  "transactionReceiptDate": "2023-08-04T14:45:39.347Z",
  "transactionReceiptVoucher": "D6BE9C802C7846029269C485FE23060C",
  "transactionAmount": "50.000000",
  "transactionType": "Credit",
  "transactionPaymentType": "PIX",
  "stateRegisteredDate": "2023-08-04T14:45:34.332Z",
  "stateCompletedDate": "2023-08-04T14:45:39.150Z",
  "stateCancelledDate": null,
  "stateRefundDate": null,
  "stateReversedDate": null,
  "stateErrorDate": null,
  "stateErrorCause": null,
  "webhookUrl": "https://postman-echo.com/post?test=1",
  "payer": {
    "name": "CRISTINA INACIO OLIVEIRA DA CONCEICAO",
    "taxNumber": "14435549603",
    "bankCode": "999",
    "bankName": null,
    "accountAgency": "99999",
    "accountNumber": "99999",
    "accountDigit": "9"
  },
  "recipient": {
    "name": "Pagfast Cobrança e Serviço em Tecnologia Ltda",
    "taxNumber": "46261360000148",
    "bankCode": "999",
    "bankName": "SANDBOX",
    "accountAgency": "99999",
    "accountNumber": "99999",
    "accountDigit": "9"
  }
}

Transaction Error

Reference Endpoint

  • POST /sandbox/payment-initiation/error/{transactionId}

This endpoint allows you to simulate an error on the payment of a PIX transaction, by providing the created transactionId. For the examples bellow, consider the transaction id fabb7587-523e-43b8-9b6a-ac4a5679f9bd.


  • The Request Response (200 - OK)
{
  "statusCode": "Done",
  "data": {
    "transactionId": "fabb7587-523e-43b8-9b6a-ac4a5679f9bd",
    "transactionState": "Error",
    "stateErrorCause": "PaymentProcessingError"
  }
}
  • The Webhook Event Payload
{
  "id": "fabb7587-523e-43b8-9b6a-ac4a5679f9bd",
  "transactionState": "Error",
  "transactionDate": "2023-08-04T14:45:34.150Z",
  "transactionOrderId": "in-1414870875-158709817091784",
  "transactionOrderDescription": "This is a test order.",
  "transactionReceipt": null, 
  "transactionReceiptDate": null,
  "transactionReceiptVoucher": null,
  "transactionAmount": "50.000000",
  "transactionType": "Credit",
  "transactionPaymentType": "PIX",
  "stateRegisteredDate": "2023-08-04T14:45:34.332Z",
  "stateCompletedDate": null,
  "stateCancelledDate": null,
  "stateRefundDate": null,
  "stateReversedDate": null,
  "stateErrorDate": "2023-08-04T14:45:39.150Z",
  "stateErrorCause": "PaymentProcessingError",
  "webhookUrl": "https://postman-echo.com/post?test=1",
  "payer": null,
  "recipient": null,
}