Create new payment with credit card

--

When creating a billing with the credit card payment method, it's possible to redirect the customer to the invoice URL (invoiceUrl) so they can enter their card details through the Asaas interface, or the card and cardholder details can be sent in the creation request for immediate payment processing.

To do this, when executing the billing creation request, simply send the credit card details along with the cardholder information using the creditCard and creditCardHolderInfo objects. It's essential that the cardholder details match exactly with those registered with the card issuer; otherwise, the transaction may be denied due to suspected fraud.

If the transaction is authorized, the billing will be created, and Asaas will return HTTP 200. Otherwise, the billing will not be persisted, and HTTP 400 will be returned.

In Sandbox, transactions are automatically approved. To simulate an error, you need to use the credit card numbers 5184019740373151 (Mastercard) or 4916561358240741 (Visa).

Credit Card Tokenization

  • When making the first transaction for the customer with a credit card, the Asaas response will return the creditCardToken attribute.
  • With this information, in subsequent transactions, the creditCardToken attribute can replace the creditCard and creditCardHolderInfo objects and be provided directly in the request root, eliminating the need to provide the objects again.

🚧

Attention

  • Regardless of the due date provided, the capture (charging the customer's card) will be made at the time of billing creation.
  • If you choose to capture the customer's card details through your system's interface, SSL (HTTPS) usage is mandatory; otherwise, your account may be blocked for credit card transactions.
  • To avoid timeouts and consequent duplicates in the capture, we recommend configuring a minimum timeout of 60 seconds for this request.

Create Credit Card Billing with Pre-Authorization

Pre-Authorization works as a balance reserve on the customer's card, guaranteeing that the expected amount will be available.

Instead of actually debiting the amount, a reservation is made, causing this amount to be subtracted from the card limit until the capture is made or the Pre-Authorization expires.

The difference between creating a Pre-Authorized billing and an immediate capture billing lies only in the authorizeOnly attribute, which should be sent with the value true, indicating that only the Pre-Authorization will be performed for this billing.

📘

  • A Pre-Authorized billing will be automatically reversed after 3 days if not captured.
  • To cancel the Pre-Authorization before the 3 days, you should use the Refund payment feature.
  • The Pre-Authorized billing will be created with the AUTHORIZED status upon successful creation.
  • In Sandbox, captures are automatically approved. To simulate an error, simply use a billing that was not created using Pre-Authorization or with a status other than Authorized.
Language
Authorization
Header
Click Try It! to start a request and see the response here!