Skip to main content

Requirements

In order to use this API, you must have created and linked your PayPal account, with login credentials to the Braintree control panel.

Creating Local Payment Contexts

To create a local payment context, you will specify all relevant transaction information for that payment scheme.

Braintree currently supports the following non-instant payment schemes:

  • Boleto Bancário
  • OXXO

Boleto Bancario

  • taxId - is a required field. This will be a BR_CPF for personal accounts and BR_CNPJ for business accounts.
  • taxType - is a required field. This is the unique tax identifier for residents of Brazil.
  • billingAddress is a required field.
  • expiryDate - is an optional field. If expiryDate is ommitted, it will default to three days ahead from the day the request was sent.
  • orderId - is an optional field.

mutation

mutation CreateLocalPaymentContext($input: CreateLocalPaymentContext!) {
createLocalPaymentContext(input: $input) {
paymentContext {
id
type
paymentId
approvalUrl
merchantAccountId
createdAt
transactedAt
approvedAt
amount {
value
currencyCode
}
}
}
}

variables

{
"input": {
paymentContext: {
amount: {
value: 1.23,
currencyCode: "BRL",
},
type: "BOLETOBANCARIO",
countryCode: "BR",
returnUrl: "https://example.com/return",
cancelUrl: "https://example.com/cancel",
merchantAccountId: "a_merchant_account_id",
payerInfo: {
givenName: "John",
surname: "Doe",
email: "john.doe@paypal.com",
taxInfo: {
identifier: "71265469000109",
type: "BR_CNPJ"
},
billingAddress: {
streetAddress: "1234 Main Street",
extendedAddress: "#456",
locality: "São Paulo",
region: "SP",
postalCode: "12345-678",
countryCode: "BR"
}
},
}
}
}

response

{
"data": {
"createLocalPaymentContext": {
"paymentContext": {
"id": "a_payment_context_id",
"type": "BOLETOBANCARIO",
"paymentId": "a_payment_id",
"approvalUrl": "https://example.com/approval",
"merchantAccountId": "a_merchant_account_id",
"createdAt": "2021-07-28",
"transactedAt": "2021-07-28",
"approvedAt": "2021-07-28",
"amount": {
"value": 1.23,
"currencyIsoCode": "BRL"
}
}
},
"extensions": {
"requestId": "abc-123-def-456"
}
}

OXXO

  • expiryDate - is an optional field. If expiryDate is ommitted, it will default to three days ahead from the day the request was sent.
  • orderId - is an optional field.

mutation

mutation CreateLocalPaymentContext($input: CreateLocalPaymentContext!) {
createLocalPaymentContext(input: $input) {
paymentContext {
id
type
paymentId
approvalUrl
merchantAccountId
createdAt
transactedAt
approvedAt
amount {
value
currencyCode
}
}
}
}

variables

{
"input": {
paymentContext: {
amount: {
value: 1.23,
currencyCode: "MXN",
},
type: "OXXO",
countryCode: "MX",
returnUrl: "https://example.com/return",
cancelUrl: "https://example.com/cancel",
merchantAccountId: "a_merchant_account_id",
payerInfo: {
givenName: "John",
surname: "Doe",
email: "john.doe@example.com",
}
}
}
}

response

{
"data": {
"createLocalPaymentContext": {
"paymentContext": {
"id": "a_payment_context_id",
"type": "oxxo",
"paymentId": "a_payment_id",
"approvalUrl": "https://example.com/approval",
"merchantAccountId": "a_merchant_account_id",
"createdAt": "2021-07-28",
"transactedAt": "2021-07-28",
"approvedAt": "2021-07-28",
"amount": {
"value": 1.23,
"currencyIsoCode": "MXN"
}
}
},
"extensions": {
"requestId": "abc-123-def-456"
}
}

Error Samples

General API error documentation

errors

{
"errors": [
{
"message": "Payment type country code 'US' is invalid for funding source oxxo.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createBusinessAccount"
],
"extensions": {
"errorClass": "VALIDATION",
"errorType": "user_error",
"inputPath": [
"input",
"paymentContext",
"countryCode",
]
}
}
],
"data": {
"createLocalPaymentContext": null
},
"extensions": {
"requestId": "abc-123-def-456"
}
}

errors

{
"errors": [
{
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createBusinessAccount"
],
"extensions": {
"errorClass": "VALIDATION",
"errorType": "user_error",
"inputPath": [
"input",
"amount",
"value"
]
}
}
],
"data": {
"createLocalPaymentContext": null
},
"extensions": {
"requestId": "abc-123-def-456"
}
}