Skip to main content

How to use the API to create a charge (cob)?

To create a Pix charge, use the API endpoint /api/v1/charge.

You can find the documentation for this endpoint here.

The required fields to create a Pix charge are:

  • value: The value of the Pix charge to be created, in cents.
  • correlationID: A unique identifier for the Pix charge. CorrelationID

Example​

Your request body will look like this example:

{
"value": 100,
"correlationID": "c782e0ac-833d-4a89-9e73-9b60b2b41d3a"
}

After making the request, if everything went well, the request status code will be 2xx and the response body will contain the created charge.

Here is an example response:

{
"charge": {
"customer": null,
"value": 100,
"identifier": "996ed4b7cc1c...",
"correlationID": "c782e0ac-833d-4a89-9e73-9b60b2b41d3a",
"paymentLinkID": "86f574fb-73...",
"transactionID": "996ed4b7cc1c...",
"status": "ACTIVE",
"giftbackAppliedValue": 0,
"discount": 0,
"valueWithDiscount": 1500,
"expiresDate": "2023-02-25T20:09:06.141Z",
"type": "DYNAMIC",
"createdAt": "2023-02-24T20:09:06.141Z",
"additionalInfo": [],
"updatedAt": "2023-02-24T20:09:14.165Z",
"expiresIn": 86400,
"pixKey": "d65032a3-c0c...",
"brCode": "0002010102...",
"paymentLinkUrl": "http://url.com/pay/...",
"qrCodeImage": "http://url.com/openpix/charge/brcode/image/...",
"globalID": "Q2hhcmdlOjYzZjkxOTZhNjA3ODg1..."
},
"correlationID": "c782e0ac-833d-4a89-9e73-9b60b2b41d3a",
"brCode": "0002010102..."
}

Code examples​

curl 'https://api.woovi.com/api/v1/charge' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "user-agent: node-fetch" \
--data-binary '{"correlationID":"c782e0ac-833d-4a89-9e73-9b60b2b41d3a","value":1500}'