The example below shows how to use the Card on File feature in a recurring transaction, when the card has already been stored and used previously.
Learn more about this feature in the documentation.
Environment | Method | Endpoint |
|---|---|---|
Sandbox | ||
Production | post |
Request
{
"MerchantOrderId": "2014113245231706",
"Customer":{
"Name":"Aline de Souza",
"Email":"[email protected]",
"Birthdate":"1990-01-01"
},
"Payment": {
"Provider":"Simulado",
"Type": "CreditCard",
"Amount": 1500,
"Installments": 1,
"SoftDescriptor": "123456789ABCD",
"Recurrent": true,
"CreditCard": {
"CardNumber": "4091688625337641",
"Holder": "Teste Holder",
"ExpirationDate": "12/2035",
"SecurityCode": "333",
"SaveCard": "false",
"Brand": "Visa",
"CardOnFile":{
"Usage": "Used",
"Reason":"Recurring"
}
}
}
}{
"MerchantOrderId": "Loja123456",
"Customer":{
"Name":"Aline de Souza",
"Email":"[email protected]",
"Birthdate":"1990-01-01"
},
"Payment": {
"Provider":"Simulado",
"Type": "CreditCard",
"Amount": 1500,
"Installments": 1,
"SoftDescriptor": "123456789ABCD",
"Capture": "false",
"RecurrentPayment": {
"AuthorizeNow": "true",
"EndDate": "2030-12-01",
"Interval": "Monthly"
},
"CreditCard": {
"CardNumber": "4091688625337641",
"Holder": "Teste Holder",
"ExpirationDate": "12/2035",
"SecurityCode": "333",
"SaveCard": "false",
"Brand": "Visa",
"CardOnFile":{
"Usage": "Used",
"Reason":"Recurring"
}
}
}
}PROPERTY | TYPE | SIZE | REQUIRED | DESCRIPTION |
|---|---|---|---|---|
| Text | 50 | Yes | Order identification number. Warning: Allowed characters are a-z, A-Z, 0-9. Special characters and blank spaces are not allowed. |
| Text | 255 | No | Customer's name. Size: 255. |
| Text | 255 | No | Customer's email |
| Date | 10 | No | Customer's birthdate (AAAA/MM/DD). |
| Text | 100 | Yes | Type of the Payment Method. |
| Number | 15 | Yes | Order Amount (to be sent in cents). |
| Text | 3 | No | Currency in which the payment will be made (BRL). |
| Text | 3 | No | Country in which the payment will be made. |
| Text | 13 | No | The store’s name that will be on the shopper’s bank invoice. Does not allow special characters. |
| Number | 2 | Yes | Number of installments. If the transaction is a recurrence, the number of installments will be 1. For installment transactions, the number of installments will be greater than 1. |
| Boolean | — | No (Default false) | Boolean that identifies if the authorization should be done by authomatic capture (true) or posterior capture (false). |
| Boolean | 5 | Yes*| | Indicates that a transaction is own recurrence. |
| Boolean | Yes | Boolean to know if the first recurrence will already be authorized or not. ⚠️For scheduled recursion, send | |
| Text | 10 | Yes*| | End date of the recurring charge. Format: 12/2030 (MM/YYYY). |
| Text | 10 | Yes*| | Recurrence interval:
|
| Text | 19 | Yes | Shopper’s card number. |
| Text | 25 | Yes | Name of the shopper that’s printed on the card. Does not accept special characters. |
| Text | 7 | Yes | Expiration date printed on the card. Example: MM/AAAA. |
| Text | 4 | No | Security code printed on the back of the card. |
| Boolean | — | No (Default false) | Boolean that identifies if the card will be saved to generate a |
| Text | 10 | Yes | Card brand. Possible values: Visa / Master / Amex / Elo / Aura / JCB / Dinners / Discover / Hipercard / Hiper. |
| Text | No | "First" if the card was stored and it’s your first use. "Used" if the card was stored and has been used for another transaction before. | |
| Text | Conditional | Indicates the motive for card storage, if the "Usage" field is "Used".
|
Response
{
"MerchantOrderId": "2014113245231706",
"Customer":{
"Name":"Aline de Souza",
"Email":"[email protected]",
"Birthdate":"1990-01-01"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": true,
"CreditCard": {
"CardNumber": "4091688625337641",
"Holder": "Teste Holder",
"ExpirationDate": "12/2035",
"SaveCard": false,
"Brand": "Visa",
"CardOnFile":{
"Usage": "Used",
"Reason":"Recurring"
}
},
"ProofOfSale": "3827556",
"Tid": "0504043827555",
"AuthorizationCode": "149867",
"SoftDescriptor":"123456789ABCD",
"PaymentId": "737a8d9a-88fe-4f74-931f-acf81149f4a0",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Simulado",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/RecurrentPayment/`{RecurrentPaymentId}`"
},
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/sales/`{PaymentId}`"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/sales/`{PaymentId}`/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/sales/`{PaymentId}`/void"
}
]
}{
"MerchantOrderId": "Loja123456",
"Customer":{
"Name":"Aline de Souza",
"Email":"[email protected]",
"Birthdate":"1990-01-01"
},
"Payment": {
"ServiceTaxAmount": 0,
"Installments": 1,
"Interest": "ByMerchant",
"Capture": false,
"Authenticate": false,
"Recurrent": false,
"CreditCard": {
"CardNumber": "4091688625337641",
"Holder": "Teste Holder",
"ExpirationDate": "12/2035",
"SaveCard": false,
"Brand": "Visa",
"CardOnFile":{
"Usage": "Used",
"Reason":"Recurring"
}
},
"ProofOfSale": "3827556",
"Tid": "0504043827555",
"AuthorizationCode": "149867",
"SoftDescriptor": "123456789ABCD",
"PaymentId": "737a8d9a-88fe-4f74-931f-acf81149f4a0",
"Type": "CreditCard",
"Amount": 1500,
"Currency": "BRL",
"Country": "BRA",
"Provider": "Simulado",
"ExtraDataCollection": [],
"Status": 1,
"ReturnCode": "4",
"ReturnMessage": "Operation Successful",
"RecurrentPayment": {
"RecurrentPaymentId": "61e5bd30-ec11-44b3-ba0a-56fbbc8274c5",
"NextRecurrency": "2015-11-04",
"EndDate": "2019-12-01",
"Interval": "SemiAnnual",
"Link": {
"Method": "GET",
"Rel": "recurrentPayment",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/RecurrentPayment/`{RecurrentPaymentId}`"
},
"AuthorizeNow": true
},
"Links": [
{
"Method": "GET",
"Rel": "self",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/sales/`{PaymentId}`"
},
{
"Method": "PUT",
"Rel": "capture",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/sales/`{PaymentId}`/capture"
},
{
"Method": "PUT",
"Rel": "void",
"Href": "https://apiquerysandbox.cieloecommerce.cielo.com/1/sales/`{PaymentId}`/void"
}
]
}
}PROPERTY | DESCRIPTION | TYPE | SIZE | FORMAT |
|---|---|---|---|---|
| Authorization number, identical to NSU. | Text | 6 | Alphanumeric text |
| Transaction Id on the acquirer. | Text | 20 | Alphanumeric text |
| Authorization code. | Text | 6 | Alphanumeric text |
| Text that will be printed on the carrier’s bank invoice. Does not allow special characters. | Text | 13 | Alphanumeric text |
| Payment ID number, needed for future operations like Consulting, Capture and Cancellation. | Guid | 36 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
| Eletronic Commerce Indicator. Indicates how safe a transaction is. | Text | 2 | Example: 7 |
| Transaction status. | Byte | — | 2 |
| Acquiring return code. | Text | 32 | Alphanumeric text |
| Acquiring return message. | Text | 512 | Alphanumeric text |
| Card brand’s return code that defines the period for transaction submission retry. Valid only for Mastercard. | Text | 2 | Numeric |
| PAR (payment account reference) is the number that associates different tokens to the same card. It will be returned by the Master and Visa brands and passed on to Cielo e-commerce customers. If the card brand doesn’t send the information the field will not be returned. | Alphanumeric | 29 | — |
| Next recurrence Identifier field. | Guid | 36 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
| Date of next recurrence. | Text | 7 | 12/2030 (MM/YYYY) |
| End date of recurrence. | Text | 7 | 12/2030 (MM/YYYY) |
| Interval between recurrences. | Text | 10 | Monthly |
| Boolean to know if the first recurrence is about to be Authorized or not. | Boolean | true ou false |
Warning:
- Send the parameters in
Payment.RecurrentPaymentto create a Scheduled Recurrence;- Send the parameter
Payment.Recurrent=“true” to create an Own Recurrence;- For the Mastercard and Hipercard brands, it is necessary to send the
Payment.InitiatedTransactionIndicatornode to indicate the transaction initiator.