Braintree
Braintree, owned by PayPal, is a payment platform used in over 40 countries that accepts various payment methods, including PayPal, Venmo, and digital wallets (Apple Pay, Google Pay, and Samsung Pay).
Some payment methods are only available in certain countries and regions; see the complete list at: https://developer.paypal.com/braintree/articles/get-started/payment-methods
Configurando um Perfil
En el menú Herramientas > API, puede crear perfiles de API para utilizarlos en sus proyectos. De esta forma, solo tendrá que informar sus credenciales una vez para usar la API en su proyecto.
Vea cómo obtener las credenciales necesarias para configurar el perfil.
Al realizar el deploy de su proyecto, deberá configurar las credenciales de la API en Prod, accediendo al menú API.

To create a profile, we must add the following information:
Nombre
Define el nombre para identificar el perfil de la API. Este nombre es único y se utilizará para referenciar el perfil de la API en las aplicaciones de su proyecto.
Mode
El modo define la disponibilidad del Perfil en Scriptcase.
-
Público - Los usuarios de todos los proyectos podrán visualizar y utilizar el perfil creado.
-
Proyecto - Los usuarios podrán visualizar y utilizar el perfil en el proyecto donde fue configurado.
-
Usuario - Solo el usuario que creó el perfil podrá visualizarlo y utilizarlo en las aplicaciones.
Independientemente del modo utilizado para la creación, los perfiles solo pueden ser editados por usuarios con acceso de administrador en el proyecto. Vea cómo definir los niveles de acceso de los usuarios en Scriptcase.
Gateway
Define la API que se utilizará para crear el perfil.
Merchant ID
Your Merchant ID is the unique identifier for your entire gateway account, including the various merchant accounts that may be on your gateway. Often called a Public ID or Production ID, your Merchant ID will be different for your production and sandbox gateways.
Public Key
This is your user-specific Public ID. Each user associated with your Braintree gateway will have their own public key.
Private Key
This is your user-specific Private Key. Each user associated with your Braintree gateway will have their own private key. Your private key should not be shared outside of using an API call – even with us.
Test Mode
Enables or disables the API’s test mode.
Usage Examples
When using the sc_call_api macro, an object is instantiated, click here to see all Braintree methods.
To use the API, your server will be responsible for generating the client token, containing the authorization and configuration information to initialize the SDK and communicate with Braintree, see how to generate a client token
If the client is not found, a validation error will be returned.
To initialize the JavaScript SDK, we must have the client token generated by the Braintree server’s SDK, see how to obtain a client token
It is also recommended that all transactions initiated by the client include device data to increase transaction accuracy and security, see how to paste device data.
See below some examples of using the API.
Example showing the API profile created in the interface as a parameter in the macro.
$gateway = sc_call_api('braintree');
$response = $gateway->transaction()->sale([
'amount' => '10.00',
'paymentMethodNonce' => $nonceFromTheClient,
'deviceData' => $deviceDataFromTheClient,
'options' => [
'submitForSettlement' => True
]
]);
echo '<pre>';
print_r($response);
Example using credentials in the macro
$merchantId = 'MERCHANT_ID';
$privateKey = 'PRIVATE_KEY';
$publicKey = 'PUBLIC_KEY';
$arr_settings = array('settings' => ['gateway' => 'braintree', 'merchantId'=> $merchantId, 'publicKey' => $publicKey, 'privateKey' => $privateKey, 'testMode' => TRUE]);
$gateway = sc_call_api('', $arr_settings);
echo($clientToken = $gateway->clientToken()->generate());