Schedule an authorization

This example does not authorize immediately but schedules a future authorization.

EnvironmentMethodEndpoint
Sandboxhttps://apisandbox.braspag.com.br/v2/sales/
Productionhttps://api.braspag.com.br/v2/sales/
⚠️

To schedule the first transaction in the recurrence series, set the Payment.RecurrentPayment.AuthorizeNow parameter to "false" and add the Payment.RecurrentPayment.StartDate parameter.

Request

{  
   "MerchantOrderId":"2017091101",
   "Customer":{  
      "Name":"Nome do Comprador",
      "Identity":"12345678909",
      "IdentityType":"CPF",
      "Address":{  
         "Street":"Alameda Xingu",
         "Number":"512",
         "Complement":"27 andar",
         "ZipCode":"12345987",
         "City":"São Paulo",
         "State":"SP",
         "Country":"BRA",
         "District":"Alphaville"
      }
   },
   "Payment":{
      "Provider":"Simulado",
      "Type":"CreditCard",
      "Amount":10000,
      "Installments":1,
      "CreditCard":{
         "CardNumber":"5412217070050381",
         "Holder":"Nome do Portador",
         "ExpirationDate":"12/2021",
         "SecurityCode":"123",
         "Brand":"Visa"
      },
      "RecurrentPayment":{
         "AuthorizeNow":false,
         "StartDate":"2017-12-31",
         "EndDate":"2019-12-31",
         "Interval":"Monthly"
      }
   }
}
--request POST "https://apisandbox.braspag.com.br/v2/sales/"
--header "Content-Type: application/json"
--header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--header "MerchantKey: 0123456789012345678901234567890123456789"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{  
   "MerchantOrderId":"2017091101",
   "Customer":{  
      "Name":"Nome do Comprador",
      "Identity":"12345678909",
      "IdentityType":"CPF",
      "Address":{  
         "Street":"Alameda Xingu",
         "Number":"512",
         "Complement":"27 andar",
         "ZipCode":"12345987",
         "City":"São Paulo",
         "State":"SP",
         "Country":"BRA",
         "District":"Alphaville"
      }
   },
   "Payment":{
      "Provider":"Simulado",
      "Type":"CreditCard",
      "Amount":10000,
      "Installments":1,
      "CreditCard":{
         "CardNumber":"5412217070050381",
         "Holder":"Nome do Portador",
         "ExpirationDate":"12/2021",
         "SecurityCode":"123",
         "Brand":"Visa"
      },
      "RecurrentPayment":{
         "AuthorizeNow":false,
         "StartDate":"2017-12-31",
         "EndDate":"2019-12-31",
         "Interval":"Monthly"
      }
   }
}
--verbose

Below are the header field properties for this request:

Property (header)TypeSizeRequiredDescription
MerchantIdGuid36YesMerchant identifier in Split de Pagamento
MerchantKeyText40YesPublic key for Dual Authentication in Split de Pagamento
Content-TypeHeader40YesApplication/json
RequestIdGuid36NoRequest identifier defined by the merchant, used when the merchant uses different servers for each GET/POST/PUT request.
Property (body)DescriptionTypeSizeRequired?
Payment.ProviderPayment method provider name.Text15Yes
Payment.TypePayment method type.Text100Yes
Payment.AmountOrder amount, in cents.Number15Yes
Payment.InstallmentsNumber of installments.Number2Yes
Payment.RecurrentPayment.StartDateStart date for the recurrence.Text10No
Payment.RecurrentPayment.EndDateEnd date for the recurrence.Text10No
Payment.RecurrentPayment.IntervalRecurrence interval.
Monthly (default) / Bimonthly / Quarterly / SemiAnnual / Annual
Text10No
Payment.RecurrentPayment.DailyIntervalRecurrence pattern in days. Do not use together with Interval.Number2No*
Payment.RecurrentPayment.AuthorizeNow"true" – authorizes at the time of the request. "false" – for future scheduling.Boolean***Yes
CreditCard.CardNumberShopper's card number.Text16Yes
CreditCard.HolderShopper's name printed on the card. Note: Field size rules may vary depending on the acquirer.Text25Yes
CreditCard.ExpirationDateExpiration date printed on the card, in the MM/YYYY format.Text7Yes
CreditCard.SecurityCodeSecurity code printed on the back of the card.Text4Yes
CreditCard.BrandCard brand.Text10Yes

Response


{
  [...]
  "Payment": {
    "ServiceTaxAmount": 0,
    "Installments": 1,
    "Interest": "ByMerchant",
    "Capture": true,
    "Authenticate": false,
    "Recurrent": false,
    "CreditCard": {
      "CardNumber": "455187******0181",
      "Holder": "Nome do Portador",
      "ExpirationDate": "12/2021",
      "SaveCard": false,
      "Brand": "Undefined"
    },
    "Type": "CreditCard",
    "Amount": 10000,
    "Currency": "BRL",
    "Country": "BRA",
    "Provider": "Simulado",
    "Status": 20,
    "RecurrentPayment": {
      "RecurrentPaymentId": "32703035-7dfb-4369-ac53-34c7ff7b84e8",
      "ReasonCode": 0,
      "ReasonMessage": "Successful",
      "NextRecurrency": "2017-12-31",
      "StartDate": "2017-12-31",
      "EndDate": "2019-12-31",
      "Interval": "Monthly",
      [...]
      "AuthorizeNow": false
    }
  }
}

--header "Content-Type: application/json"
--header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--data-binary
{
  [...]
  "Payment": {
    "ServiceTaxAmount": 0,
    "Installments": 1,
    "Interest": "ByMerchant",
    "Capture": true,
    "Authenticate": false,
    "Recurrent": false,
    "CreditCard": {
      "CardNumber": "455187******0181",
      "Holder": "Nome do Portador",
      "ExpirationDate": "12/2021",
      "SaveCard": false,
      "Brand": "Undefined"
    },
    "Type": "CreditCard",
    "Amount": 10000,
    "Currency": "BRL",
    "Country": "BRA",
    "Provider": "Simulado",
    "Status": 20,
    "RecurrentPayment": {
      "RecurrentPaymentId": "32703035-7dfb-4369-ac53-34c7ff7b84e8",
      "ReasonCode": 0,
      "ReasonMessage": "Successful",
      "NextRecurrency": "2017-12-31",
      "StartDate": "2017-12-31",
      "EndDate": "2019-12-31",
      "Interval": "Monthly",
      [...]
      "AuthorizeNow": false
    }
  }
}
PropertyDescriptionTypeSizeFormat
RecurrentPaymentIdIdentifier field for the next recurrence.GUID36xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
NextRecurrencyDate of the next recurrence.Text705/2019 (MM/YYYY)
StartDateStart date of the recurrence.Text705/2019 (MM/YYYY)
EndDateEnd date of the recurrence.Text705/2019 (MM/YYYY)
IntervalInterval between recurrences.Text10Monthly / Bimonthly / Quarterly / SemiAnnual / Annual
AuthorizeNowDefines whether the first recurrence will be authorized immediately.Boolean***true or false