Create a Pre-authorized Card Payment
Process a complete two-step payment transaction. First, authorize it to reserve the funds. Then, capture it to finalize the charge. This guide walks you through every step of this common ecommerce flow with the Getnet Global API.
Requirements
Before following the steps, you need to:
- Create your account by contacting the Integration Support team to get your API credentials
client_idandclient_secret. - Generate your token with your credentials using the Authentication endpoint.
Getnet provides a Postman Collection to help you replicate these use cases locally. You can also test the API in sandbox using the API Reference available in the documentation.
Use case specifics
When integrating any Getnet solution, market-specific requirements apply. Be sure to review the resources below before you go live:
You can also use test cards to simulate specific scenarios. You can find more information about specific requirements for each country in the Developer Resources section of the Getnet documentation.
Payment facilitators: When Getnet enables your credential as a payment facilitator, you must also send thedata.sub_merchantobject on this request. See Payment Facilitators.
Two-step payment process
The following sequence diagram shows the interactions between your system and the Getnet Global API in the two-step payment process. It covers the initial authorization, the subsequent capture, and the two methods to verify the final status.
Getnet also supports creating and capturing payments in one step. For more details, see the Create Single-Step Payments guide.
Tokenize card data (optional)
Instead of sending the raw card number in your payment request, you can use tokenization. Tokenization enhances security and reduces your PCI DSS compliance scope. To use a tokenized card:
- Tokenize the card by calling the Card Tokenization endpoint with the
card_numberandcustomer_id. - In your payment request, replace the
card.numberfield withcard.number_tokenusing the token value received from the tokenization endpoint.
number_token, you must exclude the card.number property from the request. For complete details on tokenization, see the Tokenization and Vault documentation.Step 1: Authorize the payment
A two-step payment starts with authorization. This step validates the customer's payment details and places a hold on the funds with the card issuer. It does not transfer the funds yet. Use the Create - Authorize endpoint to start the transaction.
Some countries and card schemes impose specific pre-authorization limits, adjustment rules, and capture windows. Review the pre-authorization reference for country-by-country requirements.
data.payment.payment_method attribute in your request to CREDIT_PRE_AUTHORIZATION. This setting reserves the funds without capturing them immediately.Country-specific requirements: Some markets may require additional mandatory fields. In Uruguay, you must include aratesarray with theivakey. Sendregional_regulation_codeonly when the transaction qualifies for a regional regulation or tax benefit. Each entry takes acode(17934or19210) and an optionalinvoiceof up to 9 alphanumeric characters. When you omit theinvoice, Getnet derives it from yourorder_id. Review the Taxes and Regulations reference for more information.
The table below lists the minimum fields you need to send:
| Attribute | Description | Required |
|---|---|---|
idempotency_key | Unique identifier to prevent duplicate charges. | Yes |
order_id | Merchant reference ID used for reconciliation. Up to 100 characters in Argentina, Chile, and Mexico; 36 in other countries. | Yes |
request_id | Trace identifier for idempotency audits and support follow-up. | Recommended |
data.amount | Transaction amount in cents. | Yes |
data.currency | ISO currency code used in the transaction. | Yes |
data.customer | Customer details (name, email, phone, document, full billing address). Recommended in production by the Getnet antifraud engine. | Recommended |
data.payment.payment_method | Must be CREDIT_PRE_AUTHORIZATION for a two-step flow. | Yes |
data.payment.transaction_type | Defines how the transaction is processed (FULL, INSTALL_NO_INTEREST, INSTALL_WITH_INTEREST). | Yes |
data.payment.number_installments | Number of installments (use 1 for a single payment). | Yes |
data.payment.card | Card data set (number, brand, expiration_month, expiration_year, security_code, cardholder_name). | Yes |
data.additional_data.device | Device fingerprint information (ip_address, device_id, finger_print) for antifraud analysis. | Recommended |
For antifraud analysis, the Getnet antifraud engine recommends the following fields:
| Object / Field | Description |
|---|---|
customer.first_name | Customer's first name |
customer.last_name | Customer's last name |
customer.email | Customer email address |
customer.phone_number | Phone number (international format) |
customer.document_type | Document type (e.g., CPF, DNI, etc.) |
customer.document_number | Document number (without punctuation) |
customer.billing_address.street | Street name |
customer.billing_address.number | Address number |
customer.billing_address.district | District or neighborhood |
customer.billing_address.city | City |
customer.billing_address.state | State or province |
customer.billing_address.country | Country code (ISO) |
customer.billing_address.postal_code | Postal or ZIP code |
additional_data.device.ip_address | Customer’s IP address |
additional_data.device.device_id | Device fingerprint session ID (UUIDv4) |
additional_data.device.finger_print | Fingerprint hash generated by the antifraud script |
The Getnet antifraud engine recommends that you send antifraud data in production. The more data you send, the more accurate the risk analysis. See the Antifraud documentation for complete implementation details.
payment_id. You use it to identify this transaction in the next step.The following code block shows an example of a request and response to authorize a payment:
Example of response:
Getnet provides a list of test cards that you can use in the Stage environment to simulate various transaction scenarios.
Step 2: Capture the payment
After a successful authorization, you must capture the funds to finalize the transaction. Use the Capture endpoint to transfer the previously authorized funds to your account.
payment_id from the authorization step and the idempotency_key. If you send the amount, it must be equal to or lower than the authorized amount.status field in the response body is CAPTURED.The following code block shows an example of a request and response to capture a payment:
Example of response:
Step 3: Check the payment status (optional)
AUTHORIZED. After you complete the capture step, this status changes to CAPTURED.Because some payments are processed asynchronously, the status can change over time. To get the latest status of a transaction, use the Get Transaction endpoint.
For real-time updates without polling, Getnet recommends that you use webhooks to receive notifications for every status change.
Next steps
Now that you have successfully created a two-step payment, you can explore more features of the Getnet Global API:
- Learn how to create a Single-Step Payment.
- Learn how to create a Recurring Payment.
- Learn more about 3DS Payments.
On this page