Api key provided on integrations tab in Easyflow platform.
Create charge
Creates a new payment charge and starts the payment flow for the order.
This endpoint can be used with different payment methods such as:
- PIX
- Bank Billet
- Credit Card
For PIX and Bank Billet payments, the charge can be created directly by sending the payment data in the request.
For Credit Card payments, the flow is slightly different. Before creating the charge, the card data must be encrypted using the EasyFlow JavaScript SDK. The encrypted token returned by the SDK should then be sent in payments.creditCard.token when creating the charge.
The encrypted card token goes only in this request. No response and no webhook returns it: they show only the display fields of the card (last4Numbers, holderName, expiresAtMonth, expiresAtYear, flag and nickname).
Credit card flow:
- Retrieve installment options for the charge amount.
- Encrypt the credit card data using the EasyFlow SDK.
- Create the charge using the encrypted card token.
EasyFlow JavaScript SDK: https://github.com/easyflow-cash/easyflow-javascript-sdk
Example SDK initialization:
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>window.easyflowSDK.configure({
businessId: 'your-business-id',
})Example card encryption:
const encryptedCard = await window.easyflowSDK.encrypt({
cardNumber: '5480832801033311',
holderName: 'JOHN DOE',
month: '12',
year: '2035',
cvv: '123',
})Recurring payment links:
A payment link with subscription cannot be charged with this endpoint. When paymentLinkId (or, when it is omitted, items[].paymentLinkId of the first item) points to a recurring payment link, the API returns 400 with Invalid param: [paymentLinkId] and errorCode PAYMENT_LINK_RECURRING_USE_SUBSCRIBE. The buyer subscribes through the Easyflow checkout of the payment link.
Headers
x-api-keystringrequiredx-api-secretstringrequiredApi Secret provided on integrations tab in Easyflow platform.
Request body
Content typeapplication/jsonobject
businessIdstringrequiredcustomerIdstringID of a customer of the business, a 24-character hexadecimal identifier. When it is sent,
buyeris not required and the buyer data comes from the customer. Ifbuyer.customerIdis also sent, both must have the same value. For bank billet payments, the customer must have an address.paymentLinkIdstring · uuidID of a payment link. When it is sent, the order is linked to the payment link and the seller is the business of the payment link. It takes precedence over
items[].paymentLinkId. A recurring payment link (withsubscription) is refused witherrorCodePAYMENT_LINK_RECURRING_USE_SUBSCRIBE.buyerobjectShow child attributesHide child attributes
customerIdstringIf this property is provided, it is not necessary to inform the other buyer details. However, please note that if the payment method is boleto, the informed user must have their address details filled in; otherwise, the order will be canceled.
namestringemailstringaddressobjectShow child attributesHide child attributes
zipCodestringstreetstringcomplementstringneighborhoodstringcitystringstatestringnumberstring
deliveryAddressobjectShow child attributesHide child attributes
zipCodestringstreetstringcomplementstringneighborhoodstringcitystringstatestringnumberstring
documentobjectShow child attributesHide child attributes
typestringnumberstring
phoneobjectShow child attributesHide child attributes
areaCodestringdddstringnumberstringisMobileboolean
itemsarray of objectsrequiredShow child attributesHide child attributes
externalReferenceIdstringnamestringrequireddescriptionstringrequiredimageReferencestringquantityintegerrequiredpriceInCentsintegerrequiredpaymentLinkIdstringcommissionedParticipantsarray of objectsShow child attributesHide child attributes
commissionedIdstringThe ID of the business to which you want to split the funds
commissionedValueInCentsintegercommissionedPercentageinteger
metadataarray of objectsShow child attributesHide child attributes
keystringvaluestring
paymentsarray of objectsrequiredShow child attributesHide child attributes
methodstringrequirednumberInstallmentsintegerrequiredvalueInCentsintegerrequiredValue of the payment, in cents, without interest and without the fees paid by the buyer. The sum of
valueInCentsof the payments must be equal to the sum ofpriceInCentstimesquantityof the items plusshipping.valueInCents; otherwise the API returns400withInvalid param: [totalPaymentValueInCents]. Easyflow adds the fees that the buyer pays and the interest ofnumberInstallmentsto the payment.pixobjectShow child attributesHide child attributes
expirationInMinutesnumber
bankBilletobjectShow child attributesHide child attributes
expirationInDaysnumber
creditCardobjectCard data. Required, with all its fields, for credit card payments. The encrypted card token is sent only in this request and is never returned in a response or a webhook.
Show child attributesHide child attributes
tokenstringEncrypted card token returned by the Easyflow JavaScript SDK. Sent only in this request. No response and no webhook returns it.
flagstringlast4NumbersstringexpiresAtMonthintegerexpiresAtYearintegerholderNamestring
shippingobjectShow child attributesHide child attributes
valueInCentsnumberdeliveryTimeobjectShow child attributesHide child attributes
daysnumbertypestring
Responses
200order creation was successful
order creation was successful
Content typeapplication/jsonobject
statusCodeintegerdataobjectShow child attributesHide child attributes
orderIdstringpaymentsarray of strings
400If the provided parameter is invalid, the API will return the following error response:
If the provided parameter is invalid, the API will return the following error response:
Content typeapplication/jsonobject
messagestringInvalid param: []
errorstringBad Request
statusCodeinteger400
errorCodestringCode that identifies the error. Present only on some errors.
401If the request is unauthorized, the API will return the following error response:
If the request is unauthorized, the API will return the following error response:
Content typeapplication/jsonobject
messagestringInvalid field
errorstringUnauthorized
statusCodeinteger401
403If the request is forbidden, the API will return the following error response:
If the request is forbidden, the API will return the following error response:
Content typeapplication/jsonobject
messagestringForbidden resource
errorstringForbidden
statusCodeinteger403
500If an unexpected condition occurs and the server cannot process the request, the API will return the following error response. This response has no error field.
If an unexpected condition occurs and the server cannot process the request, the API will return the following error response. This response has no error field.
Content typeapplication/jsonobject
statusCodeintegerHTTP status code.
messagestringExplanation of the error.