Create Card Transaction
To make a charge you must use this route and create your transaction.
It is possible to use a card_hash, card_id or all card data directly (card_holder_name, card_number, card_expiration_date and card_cvv). The first option is the most recommended for security reasons.
Every time a transaction is successfully completed in our systems, a card_id will be returned that can be used in future purchases. So using card_hash for the first purchase and a card_id for future purchases, you further increase the security of your customer's data without needing to expose sensitive card data.
Marlim is a PCI Compliant company, meaning we are audited to follow all market security rules aimed at protecting your customers' card data. If your system is not enabled to create card_hash, you can transact securely with open card data, since our systems encrypt all data and only our Acquirer (who processes the payment with the Issuing Bank) has access to the real card data. In the following link, we describe the step-by-step process of how to create a card_hash.
Request Body Params
| Attribute | Type | Description |
|---|---|---|
| amount | int32 | Final amount to be charged from the end consumer. Must be passed in cents. |
| installments | string | Number of installments for the transaction, with minimum: 1 and maximum: 12. |
| item_id | string | Transaction ID in your platform. |
| card_holder_name | string | Cardholder name. If you include a card_id or card_hash, this field becomes optional. |
| card_number | string | Card number. If you include a card_id or card_hash, this field becomes optional. |
| card_expiration_date | string | Card expiration date. Numbers only in MMYY format. If you include a card_id or card_hash, this field becomes optional. |
| card_cvv | string | Card verification code. If you include a card_id or card_hash, this field becomes optional. |
| card_id | string | ID of a previously saved and validated card. If you include a card_hash or open card data, this field becomes optional. |
| card_hash | string | Hash of a manually encrypted card using a public key. If you include a card_id or open card data, this field becomes optional. |
| customer | object | Customer object. |
| customer[name] | string | Customer name. |
| customer[email] | string | Customer email. |
| customer[document_number] | string | Customer document number. |
| customer[phone] | object | Customer phone number object. |
| customer[phone][country_code] | string | Customer phone country code (DDI). |
| customer[phone][area_code] | string | Customer phone state code (DDD). |
| customer[phone][number] | string | Customer phone number. |
| customer[address] | object | Customer Address object. |
| customer[address][country] | string | Customer nationality, in country code format. Only ISO 3166-1 alpha-2 (two-letters) format will be accepted. Ex: BR, US, UY... Maximum characters: 2 |
| customer[address][state] | string | Customer's current address state, in state code format. Ex: SP, RJ, MG... Maximum characters: 2 |
| customer[address][city] | string | Customer address city. Maximum characters: 50 |
| customer[address][neighborhood] | string | Customer address neighborhood. Maximum characters: 45 |
| customer[address][street] | string | Customer address street. Maximum characters: 54 |
| customer[address][number] | string | Customer's current address number. Maximum characters: 5 |
| customer[address][complement] | string | Optional parameter for customer's current address complement. Maximum characters: 14 |
| customer[address][zipcode] | string | Customer ZIP code. Maximum characters: 9 |
| soft_descriptor | string | Description that will appear on your customer's invoice. Maximum of 13 characters, alphanumeric and spaces. |
| split | array | Optional parameter for array of objects with Split Payment data. |
| split[][sub_seller_id] | string | Optional parameter to pass the partner ID that will be part of the Split Payment. |
| split[][amount] | int32 | Amount in cents that the partner should receive from the payment. Must be passed in cents. |
| webhook_url | string | Optional parameter to pass the endpoint of your system that will receive information with each transaction update. |
| webhook_auth_token | string | Optional parameter to authenticate notifications sent to webhook_url. If the parameter is not provided, notifications will be sent without authentication. |
| net_value | int32 | Required parameter if your platform passes on acquirer fees to the end consumer. Net value to be received for the transaction. Must be passed in cents. |
| dfp_id | string | Optional parameter of the URL ID that makes up the session_id created in the integration with Marlim's Antifraud. |
| external_sub_seller_document_number | string | Optional parameter to inform the CNPJ of your sales partner. |
| external_sub_seller_id | string | Optional parameter to inform the ID in your platform of your sales partner. |
| chargeback_owner | string | Optional parameter that defines who will be responsible for the transaction chargeback. Accepted values: acquirer or seller Default: acquirer |
| simulate_status | string | Optional parameter that can be passed in test environment to simulate the Antifraud flow. Accepted values: paid, failed, review and rejected. |
| simulate_refused_code | string | Optional parameter that can be passed in test environment to simulate the negative returns flow from the issuing bank. Accepted values: 1000, 1011, 1016 and 5000. |
{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_holder_name": "Luke Skywalker",
"card_number": "5555444433332222",
"card_expiration_date": "1225",
"card_cvv": "123",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877",
"phone": {
"country_code": "+55",
"area_code": "11",
"number": "999887766"
},
"address": {
"country": "BR",
"state": "SP",
"city": "São Paulo",
"neighborhood": "República",
"street": "Rua Aurora",
"number": "123",
"complement": "Apto 42",
"zipcode": "01209001"
}
}
}
Our API does not accept null, undefined or empty string values in any endpoint. If you pass a parameter with any of these 3 values, an error will be returned. If the parameter is not mandatory and you don't want it to be computed, simply remove it from the request.
Split Payment
Marlim offers the Split Payment option so that your application can create a transaction with multiple recipients, just pass an array of objects with sub_seller_id and amount in the split parameter in the request body.
🕹 Request Body example with Split Payment
{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_holder_name": "Luke Skywalker",
"card_number": "5555444433332222",
"card_expiration_date": "1225",
"card_cvv": "123",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877",
"phone": {
"country_code": "+55",
"area_code": "11",
"number": "999887766"
},
"address": {
"country": "BR",
"state": "SP",
"city": "São Paulo",
"neighborhood": "República",
"street": "Rua Aurora",
"number": "123",
"complement": "Apto 42",
"zipcode": "01209001"
}
},
"split": [
{
"sub_seller_id": "sub_k4m6Rw5rlQszEY7fiuRe",
"amount": 900
}
]
}
Chargeback
The parameter chargeback_owner defines the responsibility for chargebacks in transactions:
acquirer: Marlim assumes responsibility for chargebacksseller: your Company assumes responsibility for chargebacks
When chargeback_owner is seller, installments are calculated with specific fees for this modality, resulting in different final values from those calculated when responsibility is Marlim's.
If your company passes on acquirer fees to your end customer, use the Installments endpoint so that you are sure of the correct amount to be charged in the transaction.
🕹 Request Body example with your company responsible for Chargeback
{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_holder_name": "Luke Skywalker",
"card_number": "5555444433332222",
"card_expiration_date": "1225",
"card_cvv": "123",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877",
"phone": {
"country_code": "+55",
"area_code": "11",
"number": "999887766"
},
"address": {
"country": "BR",
"state": "SP",
"city": "São Paulo",
"neighborhood": "República",
"street": "Rua Aurora",
"number": "123",
"complement": "Apto 42",
"zipcode": "01209001"
}
},
"chargeback_owner": "seller"
}
Response Object
| Property | Type | Description |
|---|---|---|
| status | string | Represents the current state of the transaction. Possible values: paid, review, rejected, refused, expired, failed, refunded and chargeback. |
| nsu | string | Code that identifies the transaction in the Acquirer. |
| date_created | dateTime | Transaction creation date in ISODateTime format. |
| date_updated | dateTime | Transaction status update date in ISODateTime format. |
| authorized_amount | int32 | Amount in cents authorized in the transaction. |
| paid_amount | int32 | Amount in cents captured in the transaction. |
| refunded_amount | int32 | Amount in cents refunded in the transaction. |
| installments | string | Number of installments the customer paid in. |
| transaction_id | string | Transaction identifier number in Marlim. |
| item_id | string | Transaction ID in your platform. |
| payment_method | string | Payment method used in the transaction. Possible values: credit_card. |
| card_holder_name | string | Name of the cardholder used in payment. |
| card_brand | string | Card brand used in payment. Possible values: visa, mastercard, amex, hipercard and elo. |
| card_first_digits | string | First 6 digits of the card used in payment. |
| card_last_digits | string | Last 4 digits of the card used in payment. |
| acquirer_status_code | string | Response identifier code from the Issuing Bank. Possible values: 0000, 1000, 1011, 1016 and 5000. |
| acquirer_status_message | string | Message regarding the Issuing Bank's response code. |
| card_id | string | ID of the saved card for future purchases. |
Examples
- Successful Transaction
- Transaction with Split Payment
- Transaction with Card Hash
- Transaction with Card ID
- Failed Transaction
curl -X POST "https://api.marlim.co/v3/transactions" \
-H "Content-Type: application/json" \
-H "api_key: api_key_value" \
-d '{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_holder_name": "Luke Skywalker",
"card_number": "5555444433332222",
"card_expiration_date": "1225",
"card_cvv": "123",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877",
"phone": {
"country_code": "+55",
"area_code": "11",
"number": "999887766"
},
"address": {
"country": "BR",
"state": "SP",
"city": "São Paulo",
"neighborhood": "República",
"street": "Rua Aurora",
"number": "123",
"complement": "Apto 42",
"zipcode": "01209001"
}
}
}'
{
"status": "paid",
"nsu": "032416400102",
"date_created": "2025-07-29T11:38:57.815Z",
"date_updated": "2025-07-29T12:38:57.815Z",
"authorized_amount": 1000,
"paid_amount": 1000,
"refunded_amount": 0,
"installments": "1",
"transaction_id": "k4m6Rw5rlQszEY7fiuRe",
"item_id": "ABC123456789",
"payment_method": "credit_card",
"card_holder_name": "Luke Skywalker",
"card_brand": "visa",
"card_first_digits": "555544",
"card_last_digits": "2222",
"acquirer_status_code": "0000",
"acquirer_status_message": "The acquirer captured the amount on the card.",
"card_id": "card_k4m6Rw5rlQszEY7fiuRe"
}
curl -X POST "https://api.marlim.co/v3/transactions" \
-H "Content-Type: application/json" \
-H "api_key: api_key_value" \
-d '{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_holder_name": "Luke Skywalker",
"card_number": "5555444433332222",
"card_expiration_date": "1225",
"card_cvv": "123",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877"
},
"split": [
{
"sub_seller_id": "sub_k4m6Rw5rlQszEY7fiuRe",
"amount": 900
}
]
}'
{
"status": "paid",
"nsu": "032416400102",
"date_created": "2025-07-29T11:38:57.815Z",
"date_updated": "2025-07-29T12:38:57.815Z",
"authorized_amount": 1000,
"paid_amount": 1000,
"refunded_amount": 0,
"installments": "1",
"transaction_id": "k4m6Rw5rlQszEY7fiuRe",
"item_id": "ABC123456789",
"payment_method": "credit_card",
"card_holder_name": "Luke Skywalker",
"card_brand": "visa",
"card_first_digits": "555544",
"card_last_digits": "2222",
"acquirer_status_code": "0000",
"acquirer_status_message": "The acquirer captured the amount on the card.",
"card_id": "card_k4m6Rw5rlQszEY7fiuRe"
}
curl -X POST "https://api.marlim.co/v3/transactions" \
-H "Content-Type: application/json" \
-H "api_key: api_key_value" \
-d '{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_hash": "fc417fdc29d7ba484ecb4ba9e40966a1_Q2FyZCBOb3RlOiA0OTAxNzIwMDgwMzQ0NDQ4CkNhcmQgSG9sZGVyIE5hbWU6IEx1a2UgU2t5c2F3a2VyCkNhcmQgRXhwaXJhdGlvbiBEYXRlOiAxMTIyCkNhcmQgQ1ZWOiAxMjM=",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877"
}
}'
{
"status": "paid",
"nsu": "032416400102",
"date_created": "2025-07-29T11:38:57.815Z",
"date_updated": "2025-07-29T12:38:57.815Z",
"authorized_amount": 1000,
"paid_amount": 1000,
"refunded_amount": 0,
"installments": "1",
"transaction_id": "k4m6Rw5rlQszEY7fiuRe",
"item_id": "ABC123456789",
"payment_method": "credit_card",
"card_holder_name": "Luke Skywalker",
"card_brand": "visa",
"card_first_digits": "555544",
"card_last_digits": "2222",
"acquirer_status_code": "0000",
"acquirer_status_message": "The acquirer captured the amount on the card.",
"card_id": "card_k4m6Rw5rlQszEY7fiuRe"
}
curl -X POST "https://api.marlim.co/v3/transactions" \
-H "Content-Type: application/json" \
-H "api_key: api_key_value" \
-d '{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_id": "card_k4m6Rw5rlQszEY7fiuRe",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877"
}
}'
{
"status": "paid",
"nsu": "032416400102",
"date_created": "2025-07-29T11:38:57.816Z",
"date_updated": "2025-07-29T12:38:57.816Z",
"authorized_amount": 1000,
"paid_amount": 1000,
"refunded_amount": 0,
"installments": "1",
"transaction_id": "k4m6Rw5rlQszEY7fiuRe",
"item_id": "ABC123456789",
"payment_method": "credit_card",
"card_holder_name": "Luke Skywalker",
"card_brand": "visa",
"card_first_digits": "555544",
"card_last_digits": "2222",
"acquirer_status_code": "0000",
"acquirer_status_message": "The acquirer captured the amount on the card.",
"card_id": "card_k4m6Rw5rlQszEY7fiuRe"
}
curl -X POST "https://api.marlim.co/v3/transactions" \
-H "Content-Type: application/json" \
-H "api_key: api_key_value" \
-d '{
"amount": 1000,
"installments": "1",
"item_id": "ABC123456789",
"soft_descriptor": "Marlim Store",
"card_holder_name": "Luke Skywalker",
"card_number": "5555444433332222",
"card_expiration_date": "1225",
"card_cvv": "123",
"customer": {
"name": "Luke Skywalker",
"email": "luke@jedimaster.sw",
"document_number": "00099988877"
}
}'
{
"errors": {
"type": "card",
"message": "Some of your card numbers are incorrect. Check the numbers and try again."
}
}