Credit card sale
Now with the token in hand, we can use it to carry out the credit card transaction. Remember, a token can only be used in a single call and has an expiration time.
Payment upfront
Payment is made in full at the time of purchase, without any installment or credit arrangement.
Info
POST https://gateway.paag.dev/api/transactions/sale
Accept: application/json
Content-Type: application/json
Authorization: Bearer <api_token>
{
"external_card_token": "43d339e3-069c-4e76-975c-d1e166d52288", // <--- Token generated by paag-tokenization.js
"amount": 1.00,
"document_number": "84510190050",
"first_name":"Davi",
"last_name": "Jhones",
"street_address_1":"Beiramar Continental",
"street_address_2":"Village Park",
"city":"Florianópolis",
"state":"SC",
"country":"BR",
"zip": "55555",
"mobile_phone":"5548998552125",
"email":"sample@paag.io",
"merchant_transaction_id":"805c5a08-1435-4791-9ba1-1df4c624ce25"
}
Installment payment
It allows customers to make a purchase and spread the cost over multiple months (max 12).
In installment payments, the sample data is described below - note the addition of the parameter months, which can range from 2 to 12:
Info
POST https://gateway.paag.dev/api/transactions/sale
Accept: application/json
Content-Type: application/json
Authorization: Bearer <api_token>
{
"external_card_token": "43d339e3-069c-4e76-975c-d1e166d52288", // <--- Token generated by paag-tokenization.js
"months": 12, // <--- Number of installments
"amount": 100.00,
"document_number": "84510190050",
"first_name":"Davi",
"last_name": "Jhones",
"street_address_1":"Beiramar Continental",
"street_address_2":"Village Park",
"city":"Florianópolis",
"state":"SC",
"country":"BR",
"zip": "55555",
"mobile_phone":"5548998552125",
"email":"sample@paag.io",
"merchant_transaction_id":"805c5a08-1435-4791-9ba1-1df4c624ce25"
}
Playground - Credit card sale
[POST] https://gateway.paag.dev/api/transactions/sale
You will use the same API for both single and installment payments. The only difference is that for installment payments, you should include the parameter months.
You should use installment payments only when you want to divide the purchase into more than one payment, meaning two installments or more. For a single payment purchase, you do not need to specify 1 or 01 for the months parameter.
BODY PARAMS
| Field name | Data type | Filter type |
|---|---|---|
external_card_token |
string | Token generated by paag-tokenization.js |
merchant_transaction_id |
string | Transaction id on the side of the merchant. |
amount |
float | Decimal value of the amount being charged (in R$) |
document_number |
string | Document number for the one being charged. Usually CPF for people and CNPJ for companies. |
first_name |
string | First name of the one being charged. |
last_name |
string | Last name of the one being charged. |
email |
string | Email address for the one being charged. |
street_address_1 |
string | |
street_address_2 |
string | |
city |
string | |
state |
string | |
country |
string | |
zip |
string | |
mobile_phone |
string | |
months |
string | (OPTIONAL) Number of desired months for the purchase to be divided into equal parts. Minimum of 2 and maximum of 12. |
Examples
Credit Card
Responses
200 - Success
{
"transaction": {
"id": "781ae244-ef1a-4dd9-a637-425df29b55b7",
"merchant_id": "ea6b792b-ccb4-4d32-ba46-b7076c5acc42",
"user_id": "0b15988e-9501-46a0-92c1-8673b6ca07cf",
"processor_id": "49602284-ecff-49c6-97c7-971aaab4cd20",
"merchant_transaction_id": "aeb31758-c8e3-447e-b158-64df0d719cf3",
"transaction_type": "card",
"first_name": "Dom",
"last_name": "Casmurro",
"email": "asdf@asfsdaf.et",
"updated_at": "2024-02-19T17:24:21+0000",
"created_at": "2024-02-19T17:24:20+0000",
"events": [
{
"id": "7f31666a-32fa-464b-b9e0-6bd19cc53fad",
"success": true,
"status": "settled",
"event_type": "sale",
"amount": "1500.00",
"ip_address": null,
"processor_transaction_id": "F67DD3B1ADFC4178936054106F19423C",
"batch_id": "f67dd3b1-adfc-4178-9360-54106f19423c",
"qrcode": null,
"qrcode_image": null,
"pix_key_type": null,
"pix_key_value": null,
"pix_message": null,
"updated_at": "2024-02-19T17:24:21+0000",
"created_at": "2024-02-19T17:24:20+0000"
}
],
"document_number": "84510190050",
"status": "success",
"flow_type": null,
"error": null,
"e2e_id": null
}
}